From 9ec77c7a243b33bcbe23b5b30445bd1048b738f2 Mon Sep 17 00:00:00 2001 From: Anshul Singhvi Date: Tue, 16 Sep 2025 16:26:00 +0200 Subject: [PATCH] Add coordtype implementation for GeoInterface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implements the coordtype function for AbstractGeometry, Feature, and AbstractFeatureCollection types. GeoJSON encodes the coordinate type in its type parameter T. Implementation is guarded to work with older GeoInterface versions. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/geointerface.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/geointerface.jl b/src/geointerface.jl index ab2431b..b13b56a 100644 --- a/src/geointerface.jl +++ b/src/geointerface.jl @@ -99,3 +99,10 @@ function _extent2(x) end GI.crs(::GeoJSONT) = GeoFormatTypes.EPSG(4326) + +# coordtype implementation - GeoJSON encodes type in parameter T +if :coordtype in names(GI; all = true) + GI.coordtype(::GI.AbstractGeometryTrait, ::AbstractGeometry{D,T}) where {D,T} = T + GI.coordtype(::GI.FeatureTrait, ::Feature{D,T}) where {D,T} = T + GI.coordtype(::GI.FeatureCollectionTrait, ::AbstractFeatureCollection{D,T}) where {D,T} = T +end