[R-sig-Geo] manipulate SpatialPolygons object

Roger Bivand Roger.Bivand at nhh.no
Sat Jan 8 20:04:01 CET 2011


On Sat, 8 Jan 2011, T.O. Richardson wrote:

> Hi list,
>
> I have a SpatialPolygons object, 'HR_polygons' which may be composed of 
> several disjoint polygons. Thus
> length(HR_polygons[[1]]@polygons) is often > 1.
> I sum the area across all the disjoint polygons to get the total area; 
> 'blob_area'.
>
> How should I accomplish the following?:
> - Enlarge or shrink the HR_polygons object (scaling all of the disjoint areas 
> by an identical factor) such that it's blob_area reaches a new value- either 
> larger (magnify) or smaller (shrink) than the original.
>
> In this way the shape of HR_polygons is preserved, but the coordinates 
> defining its edges will change completely. If the original HR_polygons 
> contains > 1 disjoint areas , a magnification could conceivably cause the 
> disjoint areas to overlap- that is fine.

Although it isn't clear what you want to do - geographers wouldn't do it 
because Bristol might end up in Bath - you could look at the elide() 
methods in maptools - ?elide, and see whether you can subset your input 
geometries into groups subject to the same transformations. The methods 
are mostly used for disguising locations for epidemiological applications.

Hope this helps,

Roger

>
>
> Thanks
> Tom
>
>
>
>
>
>
> -----------------------------------------------
> Dept. of Maths and Stats, UWE and Ant Lab, Bristol
>
> Room B79.
> SoBS, Woodland Rd. BS8 1UG.
> +44 (0)117 928 8443
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list