Skip to content

enhance GeoJson model, parsing utilities, and geometry handling#55

Open
lykmapipo wants to merge 8 commits intodevelopfrom
feature/base-geojson
Open

enhance GeoJson model, parsing utilities, and geometry handling#55
lykmapipo wants to merge 8 commits intodevelopfrom
feature/base-geojson

Conversation

@lykmapipo
Copy link
Collaborator

This:

  • Introduce GeoJson model for representing custom regions of interest
  • Normalize all GeoJSON inputs to FeatureCollection for consistent internal representation
  • Support GeoJSON from spatial files, GeoDataFrame, dicts, JSON strings, and __geo_interface__
  • Implement GeoJson.to_geometry() to convert into a single Geometry or GeometryCollection
  • Add SupportsGeoJsonInterface runtime-checkable protocol for GeoJSON-compatible objects
  • Introduce OnInvalid enum to error-handling behavior
  • Add validation helpers parse_file_path() and parse_geojson_json()
  • Expand fixtures covering all GeoJSON geometry types and feature collections
  • Add unit tests for geometry parsing, conversion, and serialization round-trips

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
@lykmapipo lykmapipo self-assigned this Mar 14, 2026
@lykmapipo lykmapipo added the enhancement New feature or request label Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant