Skip to content

Small-union geometry storage with read-time geometry restrictions (stacked on #128) - #130

Draft
asinghvi17 wants to merge 17 commits into
json1-rewritefrom
small-union-geometry
Draft

asinghvi17 wants to merge 17 commits into
json1-rewritefrom
small-union-geometry

Conversation

@asinghvi17

@asinghvi17 asinghvi17 commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Stacked on #128 (base json1-rewrite).

Geometry fields now store Geometry{D,T}, a small union of the seven GeoJSON geometry kinds, so Feature and FeatureCollection are parameterized on {D,T,P} only, with no geometry type parameter. To restrict which kinds a file may contain, use GeoJSON.read(src; geometrytype=Union{Polygon,MultiPolygon}) instead of a type parameter. Any other kind raises an ArgumentError.

Fresh session, Julia 1.13 #128 This PR
Compile, ordinary reads 4.7 s 5.0 s
Compile, files read with different explicit schemas 8.9 s 7.1 s
Package specializations, explicit schemas 153 86

Steady-state read, write and iteration speed is unchanged. Restricted reads add no allocations.

Breaking vs #128: {D,T,G,P} becomes {D,T,P}; custom AbstractGeometry subtypes can't be stored in these fields; Feature with geometry = nothing needs explicit {D,T}. Details are in the CHANGELOG.

Also: slimmer tests (569 → 534 checks, each protecting a distinct behaviour), and a fix for GeometryCollection iteration, which previously threw.

Tested on Julia 1.10, 1.13 and nightly, plus juliac --trim=safe. Reproduce the numbers with benchmark/compile_latency.jl.

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
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