Skip to content

Commit b4ad832

Browse files
asinghvi17claude
andcommitted
Add coordtype implementation for GeometryBasics types
Implemented GeoInterface.coordtype for GeometryBasics geometry types. GeometryBasics encodes the coordinate type T in the type parameters of Point{Dim,T}, AbstractGeometry{Dim,T}, Simplex{Dim,T,N}, and Mesh{Dim,T,E,V}. Added version guard for compatibility. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 86fc11c commit b4ad832

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ext/GeometryBasicsGeoInterfaceExt.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,13 @@ function _collect_with_type(::Type{PT}, geom) where {PT <: Point{2}}
159159
return [PT(GeoInterface.x(p), GeoInterface.y(p)) for p in getgeom(geom)]
160160
end
161161

162+
# coordtype implementation - GeometryBasics encodes coordinate type in eltype
163+
if :coordtype in names(GeoInterface; all = true)
164+
# For types with coordinate type T as a type parameter
165+
GeoInterface.coordtype(::GeoInterface.AbstractGeometryTrait, geom::Point{Dim,T}) where {Dim,T} = T
166+
GeoInterface.coordtype(::GeoInterface.AbstractGeometryTrait, geom::AbstractGeometry{Dim,T}) where {Dim,T} = T
167+
GeoInterface.coordtype(::GeoInterface.AbstractGeometryTrait, geom::Simplex{Dim,T,N}) where {Dim,T,N} = T
168+
GeoInterface.coordtype(::GeoInterface.PolyhedralSurfaceTrait, geom::Mesh{Dim,T,E,V}) where {Dim,T,E,V} = T
169+
end
170+
162171
end

0 commit comments

Comments
 (0)