enhance GeoJson model, parsing utilities, and geometry handling#55
Open
enhance GeoJson model, parsing utilities, and geometry handling#55
Conversation
This: - add `GeoJson` model based on `geojson-pydantic` - normalize all GeoJSON inputs to `FeatureCollection` - support loading GeoJSON from spatial files (e.g., GeoJSON, Shapefile, etc.) via GeoPandas - enable safe use as fields in other Pydantic models - add fixtures and tests covering all GeoJSON types and edge cases
This: - add GeometryCollection handling in `GeoJson` model - improve GeoJson docstrings to clarify GeoJSON compatibility and GFW API usage context - enhance `from_file_or_geojson` docstrings with clearer behavior and examples - add fixture for GeometryCollection GeoJSON input - reorganize and expand geometry serialization tests for all geometry types
This: - introduce `assert_valid_geojson` helper to centralize GeoJson validation logic - refactor existing tests to remove duplicated GeoJson assertions - expand invalid GeoJSON test cases - add serialization/deserialization round-trip tests using `model_dump` - add `__geo_interface__` round-trip compatibility tests
…col support This: - introduce `OnInvalid` enum to standardize error-handling strategies - add `SupportsGeoJsonInterface` runtime-checkable protocol for GeoJSON-compatible objects - update `GeoJson.from_file_or_geojson()` to support files, dicts, strings, and `__geo_interface__` - add `parse_file_path()` helper using Pydantic `FilePath` validation - add `parse_geojson_json()` helper using Pydantic `Json` validation - improve `GeoJson` tests to: - add coverage for invalid sources and validation failures - add protocol compatibility tests (`GeoDataFrame`, shapely, GeoJson) - validate `OnInvalid` error behaviour paths - ensure serialization and `__geo_interface__` round-trip integrity
…ixtures This: - add `GeoJson.to_geometry()` to convert features into a single `Geometry` or `GeometryCollection` - expand fixtures for all GeoJSON geometry types and feature collections - extend tests for geometry serialization, round-trip validation, and error cases - improve test naming, docstrings, and coverage for GeoJson parsing utilities
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This:
GeoJsonmodel for representing custom regions of interestFeatureCollectionfor consistent internal representation__geo_interface__GeoJson.to_geometry()to convert into a singleGeometryorGeometryCollectionSupportsGeoJsonInterfaceruntime-checkable protocol for GeoJSON-compatible objectsOnInvalidenum to error-handling behaviorparse_file_path()andparse_geojson_json()