Skip to content

fix: update JS/WASM flatgeobuf and geojson bindings for split crate API#2

Open
brad-richardson wants to merge 1 commit intofix/js-parquet-bindingsfrom
fix/js-flatgeobuf-geojson-bindings
Open

fix: update JS/WASM flatgeobuf and geojson bindings for split crate API#2
brad-richardson wants to merge 1 commit intofix/js-parquet-bindingsfrom
fix/js-flatgeobuf-geojson-bindings

Conversation

@brad-richardson
Copy link
Copy Markdown
Owner

Summary

  • readFlatGeobuf: Updated to use FgbReader + FlatGeobufRecordBatchIterator from the new geoarrow-flatgeobuf crate (replaces the old monolithic geoarrow::io::flatgeobuf API removed in Remove geoarrow crate from JS bindings deps geoarrow/geoarrow-rs#1133)
  • writeGeoJSON: Updated to use GeoJsonWriter from the new geoarrow-geojson crate
  • readGeoJSON: Removed — the upstream geoarrow-geojson crate has no reader yet. A decoder using arrow-json's DecoderFactory is planned (#1416), pending apache/arrow-rs#9021. See also #1303.

Stacked on fix/js-parquet-bindings.

Test plan

  • cargo check --features io_flatgeobuf passes
  • cargo check --features io_geojson passes
  • cargo check --features io_flatgeobuf,io_geojson,io_parquet passes
  • cargo clippy --features io_flatgeobuf,io_geojson,io_parquet -- -D warnings clean
  • npm run build (full WASM build) — to verify after merge with parquet PR

🤖 Generated with Claude Code

Restore flatgeobuf and geojson IO modules that were commented out in
geoarrow#1133 when the monolithic geoarrow crate was split. Updates to use the
new geoarrow-flatgeobuf and geoarrow-geojson crate APIs.

readGeoJSON is dropped — the upstream geoarrow-geojson crate has no
reader yet. A GeoJSON decoder is planned via arrow-json's DecoderFactory
(geoarrow#1416), pending apache/arrow-rs#9021. See also geoarrow#1303.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 1, 2026 21:22
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the JS/WASM IO bindings to match the new split geoarrow-* crate APIs, replacing the removed monolithic geoarrow::io::* modules and aligning feature flags/dependencies accordingly.

Changes:

  • Re-enabled io::flatgeobuf and io::geojson modules behind io_flatgeobuf / io_geojson feature flags.
  • Migrated readFlatGeobuf to flatgeobuf::FgbReader + geoarrow_flatgeobuf::reader::FlatGeobufRecordBatchIterator.
  • Migrated writeGeoJSON to geoarrow_geojson::writer::GeoJsonWriter and removed the readGeoJSON binding.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
js/src/io/mod.rs Enables the flatgeobuf and geojson submodules behind feature gates.
js/src/io/flatgeobuf.rs Reimplements FlatGeobuf reading using the new geoarrow-flatgeobuf reader API.
js/src/io/geojson.rs Switches GeoJSON writing to geoarrow-geojson and removes the reader binding.
js/src/error.rs Expands the internal error enum to cover new error sources (Arrow / FlatGeobuf / IO).
js/Cargo.toml Adds new split-crate dependencies and updates feature definitions.
js/Cargo.lock Locks new transitive dependencies introduced by the split crates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread js/src/io/flatgeobuf.rs
Comment on lines +24 to +30
let properties_schema = header
.properties_schema(true)
.unwrap_or_else(|| std::sync::Arc::new(arrow_schema::Schema::empty()));
let geometry_type = header.geoarrow_type(CoordType::Interleaved)?;
let selection = fgb_reader.select_all_seq()?;
let options = FlatGeobufReaderOptions::new(properties_schema, geometry_type)
.with_batch_size(batch_size.unwrap_or(65536));
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the FlatGeobuf header lacks column metadata, header.properties_schema(true) returns None and this code falls back to an empty schema. That will silently drop all properties/attribute columns for heterogeneous FlatGeobuf files (only geometry will be read). Consider inferring the properties schema via geoarrow_flatgeobuf::reader::schema::FlatGeobufSchemaScanner (scan first N features) or returning an explicit error instead of defaulting to Schema::empty().

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants