I’m probably late to the game, but since I’ve been working a lot with R lately, I finally got around to give the Simple Features for R package a proper shot. And boy should I have done that earlier. If you use R with spatial data and haven’t checked it out yet, please do. Here’s a brief list of my favorite features (pun intended):
- Much faster reading and writing data
- No more clumsy working with attribute data – instead of
mylayer@data$attribute, just go straight to
- If you work with PostGIS a lot, you’ll feel right at home with the spatial operators (and they automatically use spatial indexes!)
- Mapping with ggplot2 is much more intuitive than before, using the geom_sf function.
- The automatic faceted plots by attribute when you use the plain
plotfunction are also pretty cool.
- If you need to run functions that don’t work on simple feature collections, it is super easy to just convert them to a data frame (
my_df <- as.data.frame(my_sf)), run the function, and convert them back (
my_sf <- st_as_sf(my_df)) – geometries, CRS, etc. are picked up correctly automatically.
I'm sure I'm missing more great stuff, but this is just a first impression after a day of work with
sf. Overall, working with spatial data in R feels much more natural with
sf, with less extra code and special cases than before. Kudos to Edzer and the other contributors for this one!