Open JosiahParry opened 1 week ago
As a package developer I often want to grab the geometry column from an sf object.
For that, sf
provides the generic st_geometry()
.
Perhaps I should edit the text, I often want to get the geometry column name. st_geometry()
is indeed useful for accessing the underlying sfc. But often i need to know which column is the geometry column by name or position and the sf_column
attribute helps with that .
A quick search shows that the top hit is in fact a function called sf_column()
for the same purpose! There are a good handful of folks who have built something similar https://github.com/search?q=%22sf_column%22&type=code
As a package developer I often want to grab the geometry column from an sf object. However, it is not safe to assume that the column is called
geometry
. For this reason I grab thesf_column
attribute. This is done viaattr(x, "sf_column")
. It would be great if there were a helper function to get this. For example: