Skip to content

Linear rings have a GeoInterface.trait of LineStringTrait #420

@asinghvi17

Description

@asinghvi17

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:

function GeoInterface.geomtrait(
geom::Union{map(T -> AbstractGeometry{T}, linetypes)...},
)
return GeoInterface.LineStringTrait()
end

which seems incorrect...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions