[GRASS-user] raster area calculations in lat/long

Glynn Clements glynn at gclements.plus.com
Mon Jun 30 14:51:52 EDT 2008

Jerry Griffith wrote:

> Ok, since GRASS does account for differing cell size in lat/long raster 
> files, what I am after is mapcalc is to do something like:
> croparea = [cellsize] * corn_map (my corn_map has a floating point 
> value, ex. 0.29 that gives the fraction of the cell that is in corn 
> cultivation)
> I have tried simply typing in for [cellsize] the functions listed below, 
> but that doesn't work or my syntax is wrong.
> G_begin_cell_area_calculations()
>  G_area_of_cell_at_row()

These are C functions; they don't exist in r.mapcalc.

> and I haven't found in r.stats or related commands that allows an 
> intermediate multiplication step. I have tried using r.proj (and with 
> -n) to reproject to an equal area projection, but my crop maps are 
> global coverages and the other Locations in lambert equal area are for 
> the US, so the result is my global crop maps get clipped to the US.

If you can't use a global equal-area projection, you could just use
the underlying equations within r.mapcalc. Depending upon the required
accuracy, multiplying by cos(y()) might be sufficient. Otherwise, see
lib/gis/area_ellipse.c for the equations used.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-user mailing list