yeesian / ArchGDAL.jl

A high level API for GDAL - Geospatial Data Abstraction Library
https://yeesian.github.io/ArchGDAL.jl/stable/
Other
137 stars 25 forks source link

Linear rings have a `GeoInterface.trait` of `LineStringTrait` #420

Open asinghvi17 opened 2 months ago

asinghvi17 commented 2 months ago

When looking into a polygon, the constituent geometries print as linear rings but possess LineStringTraits. This is a problem "upstream" in GeometryOps when reconstructing geometries from ArchGDAL inputs.

Consider the following MWE:

import GeoInterface as GI, ArchGDAL as AG
polygon = GI.Polygon([GI.LinearRing([(cos(t), sin(t)) for t in LinRange(0, 2pi, 100)])])
GI.geomtrait(GI.getgeom(polygon, 1)) # LinearRingTrait
ag_polygon = GI.convert(AG, polygon)
GI.geomtrait(GI.getgeom(ag_polygon, 1)) # LineStringTrait

@which GI.geomtrait(GI.getgeom(ag_polygon, 1)) reveals:

https://github.com/yeesian/ArchGDAL.jl/blob/8d5751294552b42abc5eef9e3b8c9d6ef4140632/src/geointerface.jl#L365-L369

which seems incorrect...

yeesian commented 2 months ago

Thank you! I appreciate making it correct before making it fast