[R-sig-Geo] Rotating with maptools::ellide()

Roger Bivand Roger.Bivand at nhh.no
Sat Dec 15 23:06:39 CET 2012


On Sat, 15 Dec 2012, Agustin Lobo wrote:

> Given an SpPolDF, if I rotate the first polygon  with
> delme <- elide(testAlfacs20120626footp[1,], rotate=-90)
>
> I get the result shifted. I get the rotation I was expecting by indicating the
> coordinates of the center:
> delme <- elide(testAlfacs20120626footp[1,],
> rotate=-90,center=coordinates(testAlfacs20120626footp[1,]))
>
> How could I rotate all polygons, each one around its own centroid?
> I've tried
>> delme <- elide(testAlfacs20120626footp, rotate=-90,center=coordinates(testAlfacs20120626footp))
> Error in .local(obj, ...) : center must be numeric of length two

Plrease provide a motivation - elide methods are not intended to elide 
parts of data sets. Please also provide the code for copy and paste, 
withou having to discard the leading prompts. If you need a different 
function, why not write one as a loop over elide - although then there 
will be absolutely no chance that your output geometries will be planar, 
so things like plotting just will not work as expected where entities 
overlap.

Roger

>
> Thanks,
>
> Agus
>
> Data: http://dl.dropbox.com/u/3180464/testAlfacs20120626footp.rda
>
>> sessionInfo()
> R version 2.15.2 (2012-10-26)
> Platform: i686-pc-linux-gnu (32-bit)
>
> locale:
> [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
> LC_TIME=en_US.UTF-8
> [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8
> LC_MESSAGES=en_US.UTF-8
> [7] LC_PAPER=C                 LC_NAME=C
> LC_ADDRESS=C
> [10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8
> LC_IDENTIFICATION=C
>
> attached base packages:
> [1] grid      stats     graphics  grDevices utils     datasets
> methods   base
>
> other attached packages:
> [1] maptools_0.8-20 lattice_0.19-30 foreign_0.8-51  zoo_1.7-7
> chron_2.3-39    raster_2.0-25
> [7] rgdal_0.7-22    sp_1.0-2
>
> loaded via a namespace (and not attached):
> [1] tools_2.15.2
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
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