I have a raster map with trees in grass (1 and NULL value) for 6m resolution. I would like to aggregate this data in a grid with a resolution of 250m.
For that I have created a grid with
v.mkgrid and using
v.rast.stats I what count pixel for each grid cell.
It works perfectly in 50 min for a grid of 81323 cells.
To compare with MODIS data I have used R and create a grid with the exact extend and resolution of my MODIS value
grid <- raster(extent(one.ym)) res(grid) <- res(one.ym) proj4string(grid)<-proj4string(one.ym) gridpolygon <- rasterToPolygons(grid) writeOGR(obj = gridpolygon,dsn="/home/user/",layer="mygrid_modis.shp", driver = "ESRI Shapefile", overwrite_layer = T
Once my grid imported in GRASS-GIS I run
v.rast.stats but I spend 6h and it is still running.
What's the difference between shapefile grid and Grid from v.mkgrid? How can I improve my shapefile grid time?
By the way, I have created my grid in grass72 using
r.to.vect on my landsat raster. It doesn't make a difference in CPU time. In both case I have defined the region size and resolution on my raster.