I'm using shapefiles of history U.S. state boundaries from NHGIS to make maps in R. These shapefiles are much higher resolution than I need when making maps at the scale of the country: over 2 million observations for one file. Is there a way that I can reduce the resolution of these shapefiles in R? If necessary, I can do it in QGIS instead.
You can use
gSimplify from the
rgeos package, and if you add the
topologyPreserve=TRUE flag it will preserve the topology.
Note that you can still end up with overlapping lines - we need an implementation of this robust D-P algorithm in R:
[that link possibly behind a paywall]
A standard method for "thinning" linear shapes (including polygon boundaries) is the Douglas-Peucker algorithm. At least two
R packages implement this:
dp in the shapefiles package and
thinnedSpatialPoly in the Guerry package.
Note that thinning adjacent polygons typically creates slight gaps and overlaps in their boundaries: it does not respect the topological relationships among them. I am not aware of any
R package that maintains topology while thinning. For small-scale mapping purposes like these that should not be a serious issue.
Incidentally, because nobody knows how to pronounce German anymore :-), Tom Poiker changed the spelling of his name a while ago.