Skip to content

Accept empty geographic feature selections - #320

Open
antonsoo wants to merge 2 commits into
perrygeo:masterfrom
antonsoo:fix/empty-feature-collections
Open

antonsoo wants to merge 2 commits into
perrygeo:masterfrom
antonsoo:fix/empty-feature-collections

Conversation

@antonsoo

@antonsoo antonsoo commented Oct 24, 2026 •

Copy link
Copy Markdown

Return an empty iterator for valid empty FeatureCollections and readable zero-feature datasets. A spatial filter can produce these selections, and RFC 7946 section 3.3 permits an empty features array. Currently, GeoDataFrames and collections are rejected by a truthiness check, while empty files fail the vector-source probe.

For inputs that are not existing local paths, parse inline GeoJSON before probing file sources. This keeps the documented file-only engine setting from sending JSON text to fiona.open(), and preserves original feature IDs instead of replacing them through GDAL.

The regressions and recorded polygon/point selections cover both engines, GeoJSON/GeoPackage/Shapefile and in-memory inputs. All 131 tests pass with older dependencies; current Affine/Shapely require the same two existing deprecation-warning filters as the baseline. Ruff checks/formatting, an installed-wheel replay and composition with the NaN-nodata correction pass. Working geometry, properties and query/statistics results remain unchanged.

Existing local paths retain priority even when the filename is valid JSON, such as 123 or {}; regressions cover string and Path inputs.

@antonsoo

Copy link
Copy Markdown
Author

I found a dispatch regression while auditing this change: local filenames such as 123 and {} could be parsed as JSON. The updated commit gives existing local paths priority and adds string/Path regressions. Both file engines and all 256 earlier recorded-data configurations still pass; the full suite now has 131 passing tests with the previously noted dependency-warning filters.

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.

1 participant