Search code examples
rgisesrishapefile

Combining bordering shapefiles in R


I have five shapefiles of bordering counties in California that I am trying to combine into one large shapefile and maintain the original borders of the counties. I then want to plot points such as this so the map only needs to be a simple map of county boundaries. Is there a way to do this in R or will I have to use something like ArcGIS?

There is extensive documentation about merging within a shapefile such as here where both shapefiles have the same coordinates. But no documentation on shapefiles that only partially share coordinates.


Solution

  • If you only need to put all the borders into one data set then you can do that with sp/rgdal easily enough, but if you need to actually merge borders geometrically (clip/join/dissolve) and so on the support in R is not that simple.

    Roughly the simple option is read each shapefile with readOGR, then spRbind them together. If rgdal presents difficulties for building/installing then there are other options for reading shapefiles in various packages.

    btw, "something like ArcGIS" but much closer to "free": www.manifold.net