Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type that's both a Feature as a Geometry #87

Open
evetion opened this issue Jan 10, 2023 · 2 comments
Open

Type that's both a Feature as a Geometry #87

evetion opened this issue Jan 10, 2023 · 2 comments

Comments

@evetion
Copy link
Member

evetion commented Jan 10, 2023

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
Copy link
Member Author

evetion commented Jan 10, 2023

One reason would be to prevent an stackoverflow due to :

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

@rafaqz
Copy link
Member

rafaqz commented Jan 10, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants