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

Proposal: geometrycolumn(x) = first(geometrycolumns(x)) #163

Open
asinghvi17 opened this issue Sep 23, 2024 · 5 comments
Open

Proposal: geometrycolumn(x) = first(geometrycolumns(x)) #163

asinghvi17 opened this issue Sep 23, 2024 · 5 comments

Comments

@asinghvi17
Copy link
Member

It's difficult to teach users why they should have to use first(geometrycolumns(x)), and it's not easy to remember when starting out.

Would it make sense to have a convenience function geometrycolumn(x)? Then things like df[:, Not(GI.geometrycolumn(df))] just work, without exposing users to the annoyances inherent in geospatial datasets.

@rafaqz
Copy link
Member

rafaqz commented Sep 23, 2024

Makes sense to me, except it's easy to mix them up

@visr
Copy link
Member

visr commented Sep 24, 2024

Do you want it to just pick one in case of multiple geometry columns, or to give an error? geometrycolumn(x) = only(geometrycolumns(x)) is also an option.

@evetion
Copy link
Member

evetion commented Sep 25, 2024

Can you provide an example where one would use first(...) like that? I wonder if we could provide something like getgeom on a table or similar. And maybe setting an active geometry column in the metadata (like geopandas)?

@asinghvi17
Copy link
Member Author

asinghvi17 commented Sep 25, 2024

Hmm, getgeom on a table might be better than this. But my thought was for simple operations like plotting:

# current state
df[!, first(GI.geometrycolumns(df))]
# alternatives
df[!, GI.geometrycolumn(df)]
# or
GI.getgeom(df)

Where this would really be useful is when constructing filter statements where you need a symbol:

# current state
filter(df, first(GI.geometrycolumns(df)) => x -> intersects(df, somegeom))
# alternative
filter(df, GI.geometrycolumn(df) => x -> intersects(df, somegeom))

An "active geometry column" would be nice, but that would be an extra bit of metadata.

@rafaqz
Copy link
Member

rafaqz commented Sep 25, 2024

I also think we should just have both

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

4 participants