[R-sig-Geo] extract polygon

Edzer Pebesma edzer.pebesma at uni-muenster.de
Fri Mar 29 17:07:27 CET 2013


Ross, what you want is subsetting, not extraction.

have you tried:

newSPDF <- columbus[30,]

Reading introductory material such as
http://cran.r-project.org/web/packages/sp/vignettes/intro_sp.pdf
is also a good way to learn the first steps.

Bests,


On 03/29/2013 04:32 PM, Ross Ahmed wrote:
> Lets say I have a several polygons stored in a SpatialPolygonsDataFrame
> object. Using Œcolumbus¹ in maptools as an example:
> 
> setwd(system.file("shapes", package="maptools"))
> columbus <- readShapeSpatial("columbus.shp²)
> 
> I want to extract a polygon 30 from Œcolumbus¹, and assign it to a new
> SpatialPolygonsDataFrame object. I¹ve triedŠ
> 
> newSPDF <- Polygons(list(columbus at polygons[[30]]), "29²)
> 
> Šbut this didn¹t work. How can I do this?
> 
> Thanks
> Ross
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> 
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list