How Does Sf Geometry Column, Chapter 5 Geometry Operations

Is there an sf-native (i.e. “correct”) way of extracting everything except the geometry column from a simple features object? This works

df but the select( , -geometry) step feels unnecessary. Also, it doesn”t remove the geometry attributes.

Đang xem: Sf geometry column


Set the st_geometry property to NULL.

library(sf)nc Also (though this won”t remove the attr(nc, “sf_column”):



To drop the geometry column, use st_drop_geometry():

library(sf)nc % st_drop_geometry()class(nc_df2)#> <1> “data.frame”Before st_drop_geometry() was added to the sf package (in November, 2018), one could produce the same result using the st_set_geometry() function, like this:

library(sf)nc <1> “sf” “data.frame”nc_df % st_set_geometry(NULL)class(nc_df)#> <1> “data.frame”



Xem thêm: 5Th Grade Geometry 5Th Grade Games For 5Th Graders Online, 5Th Grade Geometry Games


df Or just df<,-geometry_column> if you don”t want to create new object


df – your object

geometry_column – column where geometry is stored

Thanks for contributing an answer to Geographic Information Systems Stack Exchange!

Please be sure to answer the question. Provide details and share your research!

But avoid

Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

Post Your Answer Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

See also  Ap L Geometry Term S - Illustrated Mathematics Dictionary

Not the answer you're looking for? Browse other questions tagged r sf or ask your own question.

How do I use a Simple Feature Collection (sfc) from the sf package with the elevatr package to load elevation data?

Xem thêm: What Does Proverbs 8 13 Mean? Proverbs 8:13 Kjv The Fear Of The Lord

site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev2021.8.2.39897

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

See more articles in category: Geometry

Leave a Reply

Check Also
Back to top button