Migrate all dependencies to geozero#113
Conversation
Co-authored-by: robfitzgerald <7003022+robfitzgerald@users.noreply.github.com>
|
@copilot please try again now that the copilot rate limit has been addressed. i have added two additional criteria to the list, run |
…ests, run fmt and clippy Co-authored-by: robfitzgerald <7003022+robfitzgerald@users.noreply.github.com>
Completed the migration in commit a5210de. Here's what was done: Remaining source files migrated:
Key technical notes:
Unit tests added for: Also ran: |
yamilbknsu
left a comment
There was a problem hiding this comment.
Changes make sense and they compile. Thank you!
Migrates bambam from individual geospatial crates (
wkt,wkb,geojson) togeozero, a unified geospatial format library. This simplifies versioning and APIs for geospatial data formats across the codebase.Changes Made
Cargo.toml Updates
wkt,wkb,geojson; addedgeozerowith featureswith-geo,with-wkb,with-wkt,with-geojsongeozero = { workspace = true }(was missing)bambam,bambam-core,bambam-gtfs,bambam-omf): removedwkt/wkb/geojsondependenciesSource File Migrations
wkt::ToWkt→.to_wkt().to_string()geozero::ToWkt→.to_wkt()returningResult<String>Geometry::try_from_wkt_str(s)WktReader(s).to_geo()wkt::Wkt<f32>::parse()+.try_into()WktReader(s).to_geo()+ map coords to f32wkb::writer::write_geometry(...)geom.to_wkb(CoordDimensions::xy())geojson::GeoJson::parse()+geo_types::Geometry::try_from()GeoJsonString(s).to_geo()geojson::Geometry::from()wrapped ingeojson::Featuregeom.to_json()wrapped inserde_json::json!FeatureKey technical note:
geozero::ToWktonly implementsGeozeroGeometryforGeometry<f64>. Geometries stored asf32(used in several OSM and OMF paths) are converted withgeo::Convertbefore callingto_wkt().GeoJSON roundtrip: The GeoJSON deserializer now handles Feature-wrapped JSON by extracting the
geometryfield before passing toGeoJsonString, since geozero's parser requires a plain geometry JSON string.Unit Tests Added
New tests covering geozero usage without large mock data:
isochrone_output_format: WKT, WKB, and GeoJSON serialize/deserialize roundtrips; empty geometry; invalid input error casesextent_format: WKT polygon and multipolygon parsing; invalid WKT error casegrid_ops:create_grid_rowwith polygon geometry; invalid template error caseus_states_lookup: embedded GeoJSON state file load;GeoJsonStringgeometry parseCode Quality
cargo fmtacross therust/directorycargo clippy --fixacross therust/directorycargo test --lib)📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.