2015-10-06 19:26 GMT+03:00 Moritz Lennert <mlenn...@club.worldonline.be>: >> I just wonder how to implement within Python script. > > > Get areas of all polygons (or lenghts of lines) with v.to.db and then divide > the features into those with areas above pixel size and those with areas > below. Treat each set differently (i.e. the former as before, the latter by > using v.what.rast - with the -p flag - to get the pixel value). As the > updating of the table is done feature by feature anyhow, all you lose in > terms of performance is the additional step of calculating areas/lengths of > features. >
First of all - v.rast.stats is not affected by the size of polygon but by its shape/location. It uses v.to.rast thus data will be provided if raster cell centre falls into vector polygon (no matter how small it could be). Thus theoretically it is possible to construct a large polygon that still gets NULL value. Thus the discussion should be - should statistics be collected also for cells that only partially lie within the polygon. Raster cell is the smallest unit and it is homogeneous thus interpretation "collect data on all cells even if polygon just touches it" might seem to be a valid idea. Proposed solution with v.what.rast is not a solution as it will sample raster map at the location of centroid thus in case of polygon covering more than one cell, a value of one of cells will be provided. Personally I tend to favour current behaviour. It could be a bit better documented as current documentation states: "The vector map will be rasterized according to the raster map resolution." It is correct but an extra explanation would be helpful like: "Stats are provided only for polygons covering raster cell centres (or whole raster cell area)." Just my 0.02c, Māris. _______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev