Skip to content
Prev 8807 / 29559 Next

How to replace coordinates of Polygons

On Mon, 19 Jul 2010, Ben Mazzotta wrote:

            
If they have the same IDs, no problem, just make a 
SpatialPolygonsDataFrame with data=as(old, "data.frame").
Firstly, the input is a planar grid of values of a variable, so the 
queries on the two output grids need to accommodate the loss of resolution 
implied there. Try on something simple first. If you can get a wrapper 
around cartogram() to take a SpatialPolygonsDataFrame, make a grid from it 
for the chosen variable (including NA handling), then do cartogram, 
followed by interpolation for Polygons object by Polygons object (remember 
objects may be multiple Polygon objects, and may have holes), you may be 
able to get there. Constructing the output objects from computed 
coordinates looks like the least of your challenges.

Good luck!

Roger