r-sig-geo  

[R-sig-Geo] which cost less computer effort? PolygonValues(), polygonsToRaster(), or zonal()?

Jorge Fernando Saraiva de Menezes
Wed, 01 Sep 2010 15:04:17 -0700

Dear list,

I have a raster, with a grid resolution of 250m2 and values of 0,1 or NA,
and a shapefile with about 5000 polygons of areas varying from 221m2 to
323,629,571,955m2, which means that a polygon might have 1 billion cells
(fortunaly, these are very few)

I would like to obtain for each polygon the percentage of 0, 1 and NAs cells
per island... I thought the following could work:

polygonValues method

poly_map=readShapePoly("shapefile path")
raster_map=raster("raster path")
objective=polygonValues(poly_map,srtm)

zonal method

poly_map=readShapePoly("shapefile path")
raster_map=raster("raster path")
rasterofpoly=polygonsToRaster(poly_map)
objective=zonal(raster_map,rasterofpoly,stat="sum",na.rm=T)

polygonstoRaster method

poly_map=readShapePoly("shapefile path")
raster_map=raster("raster path")
objective=polygonsToRaster(poly_map,raster_map, mask=T,filename="path to new
raster")


but all of those take a long time to work... and i don't know a quick way of
testing it's efficiency, so I would like to know if anyone knows which of
those would perform the calculation faster in this situation, and if any of
these methods are viable (i.e. would not take months or years)

I have acess to a workstation with 4 processors (1 GHz each , i thnk) and
8Gb of memory (not sure about this configuration), using ubuntu

Thanks in advance,
Jorge Menezes

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo