Moritz Lennert wrote: > Yes. Do we have any existing module to calculate area by pixel ? An > area() function in r.mapcalc would be nice...
I notice that this has been added, but I'm not sure that it's adequate for this task. For anything other than lat-lon locations, G_area_of_cell_at_row() assumes that the area of a cell is constant over the region. That's true for equal-area projections, and not far off for small scales (where projection would be almost an affine transformation), but it could be quite far off at larger scales. Ideally, r.proj should provide the option to generate maps containing metadata for a projection: source coordinates, horizontal/vertical scale factors, area scale factor, rotation angle, skew angle. I.e. projected coordinates, horizontal/vertical first derivatives, and information derived from them (maybe also second derivatives, and derived quantaties such as curvature or radius of curvature, but that can be quite inaccurate for discrete samples). IOW, rather than inverse-projecting coordinates and performing a look-up in a source map, it would inverse-project coordinates and write the resulting coordinates (or differences). The main issue is an appropriate choice of delta. Too large a value means that you're calculating an average over a non-negligible distance, too small a value means that you lose accuracy due to subtracting numerically-close values. -- Glynn Clements <gl...@gclements.plus.com> _______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev