Re: [R-sig-Geo] extract polygon

2013-03-29 Thread Edzer Pebesma
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: > Le

[R-sig-Geo] extract polygon

2013-03-29 Thread Ross Ahmed
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 SpatialP

Re: [R-sig-Geo] Extract polygon values from large raster dataset

2012-06-19 Thread Robert J. Hijmans
Spencer, After some tinkering... you could reclass to get single class (land cover type) layer, then aggregate, then extract. For me, that takes about 4 hours per class. > rcl <- matrix(c(11,12,1, 21,100,0), byrow=T, ncol=3) > system.time(cls11_12 <- reclass(env, rcl, right=FALSE, filename='class

Re: [R-sig-Geo] Extract polygon values from large raster dataset

2012-06-19 Thread Robert J. Hijmans
Spencer, That is an interesting challenge. Your approaches are fine in principle, but you have a raster of 30 meter resolution for the conterminous US ( ~17 billion cells ) and, if I understand you well, you want to tabulate the values by polygon, using irregular polygons (relative to the raster)

Re: [R-sig-Geo] Extract polygon values from large raster dataset

2012-06-19 Thread Brad Nesom
WOW! I appreciate the insight. I constantly need rasterize. but have very little working knowledge of using it. I guess patience is the first ingredient. brad On Mon, Jun 18, 2012 at 6:07 PM, Spencer Scheidt wrote: > Hello, > > I am attempting to extract land cover values from the NLCD 2006 da

Re: [R-sig-Geo] Extract polygon values from large raster dataset

2012-06-18 Thread Mathieu Basille
You might also want to consider using PostGIS [1], which now handles rasters by default in the recent 2.0 version, and was precisely developed to handle large maps easily. Note that it uses GDAL for some raster functions, so that it might not be faster than GDAL itself... Mathieu. [1] http://

Re: [R-sig-Geo] Extract polygon values from large raster dataset

2012-06-18 Thread Matthew Landis
Spencer, it's been awhile since I tried to use rasterize(), but when I did, I found it very slow compared to alternative approaches, e.g. using ArcGIS. In the end, I discovered gdal_rasterize ( http://www.gdal.org/gdal_rasterize.html), which seems to be faster, although I've never compared th

[R-sig-Geo] Extract polygon values from large raster dataset

2012-06-18 Thread Spencer Scheidt
Hello, I am attempting to extract land cover values from the NLCD 2006 dataset (http://www.mrlc.gov/nlcd2006.php) using a grid that I have converted into a SpatialPolygons* object. However, the NLCD raster is approximately 16 GB in size (30 m resolution), and the grid that I would like to work wi