georust / geozero

Zero-Copy reading and writing of geospatial data.
Apache License 2.0
356 stars 38 forks source link

RFC: API improvements #2

Closed pka closed 3 years ago

pka commented 4 years ago

The geometry processing API has worked well for different implementations, so there are no short term changes planned. Mid term improvements:

There is a initial high-level Reader API and Writer API, covering basic file reading/writing. The current core Reader/Writer implementations have the following Structs for writing and functions for reading:

flatgeobuf:

Code examples:

let mut geos = Geos::new();
read_geojson(geojson.as_bytes(), &mut geos);
let mut fgb = FgbReader::open(&mut filein)?;
fgb.select_bbox(8.8, 47.2, 9.5, 55.3)?;
let mut json = GeoJsonWriter::new(&mut fout);
fgb.process_features(&mut json)

These struct/functions should be named more uniformly. Proposal:

Code examples:

let mut out = GeosWriter::new();
geojson::process(geojson.as_bytes(), &mut out);

Feedback welcome! @georust ?

pka commented 4 years ago

Version 0.5.0

Writer structs:

Structs for DB type encoding/decoding:

Reader functions:

pka commented 3 years ago

Version 0.7.0

Conversion: Format GeozeroGeometry GeozeroDatasource GeomProcessor Geometry Conversion
geo-types geo_types::Geometry<f64> - geo_types::GeoWriter ToGeo
GeoJSON GeoJson GeoJsonReader, GeoJson geojson::GeoJsonWriter ToJson
GDAL gdal::vector::Geometry - gdal::GdalWriter ToGdal
GEOS geos::Geometry - geos::GeosWriter ToGeos
SVG - - svg::SvgWriter ToSvg
WKB Wkb, Ewkb, GpkgWkb - wkb::WkbWriter ToWkb
WKT - - wkt::WktWriter ToWkt
FlatGeobuf FgbFeature FgbReader - -

Structs for DB type encoding/decoding:

Reader functions: