简体   繁体   中英

How to change the “Active geometry column” in an sf table to a different geometry column in the same table?

I have an sf table with two sfc (ie there are two geometry columns in the sf). When I look at the properties of the sf, one of the two geometry columns is listed as the Active Geometry column. How do I easily make the other geometry column the active one?

I've tried the instructions here https://r-spatial.github.io/sf/reference/st_geometry.html , but found no joy.

Here's the expression that was not working for me:

sf_new_data2a <- st_set_geometry(sf_new_data2a, sf_new_data2a$geometry.1)

Just found this and it worked for me:

st_geometry(sf_table_name) <- "name_of_another_geometry_column"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM