GeoInterface.jl icon indicating copy to clipboard operation
GeoInterface.jl copied to clipboard

Type that's both a Feature as a Geometry

Open evetion opened this issue 2 years ago • 2 comments

Over at https://github.com/JuliaGeo/GeoInterface.jl/blob/main/src/utils.jl#L64, we assert that if somethings a Feature, it can't be a Geometry as well, but is there a reason why we forbid this?

I've got a struct thing with x, y, z, other, props and I want it to be both at the same time. A Feature and a Point.

evetion avatar Jan 10 '23 00:01 evetion

One reason would be to prevent an stackoverflow due to :

function coordinates(t::AbstractFeatureTrait, feature) 
    geom = geometry(feature)
    isnothing(geom) ? [] : coordinates(geom)
end

evetion avatar Jan 10 '23 00:01 evetion

Hmm nothing was designed for that possibility but I guess it could work?

Often it's feature properties will win because isfeature is checked first. I guess that's an issue: packages might also check isgeomtry first and never even treat it as a feature. The order doesn't matter if they're mutually exclusive.

rafaqz avatar Jan 10 '23 00:01 rafaqz