Wednesday, April 5, 2017

Two new libraries for working with Spatial data in R

A quick heads up for those interested in using R for spatial analysis and mapping data. There are two relatively new libraries you might want to check out:

  • The first one is the ggspatial library, created by Dewey Dunnington. ggspatial is a great package that makes it super simple to create maps using ggplot. It uses a single geom_spatial() for all types of spatial objects (polygons, lines, dots, etc.) and it dispenses the use fortify(), making things much faster.


  • Another library some of you might find useful is sf (as in simple features), created by Edzer Pebesma. This library makes it much faster to conduct several spatial operations, like reading/writing data, intersecting spatial objects, computing shortest distance matrices etc. The sf library is integrated with ggplot2 for creating maps with geom_sf() and it also makes it easy to connect to spatial data bases. This promises to be a real game changer for spatial analysis in R.