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

Hamish hamish_b at yahoo.com
Tue Jul 1 10:05:12 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()

Glynn:
> 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.


perhaps this is a nice task for the SWIG/python interface?
see  swig/python/examples/rasteraccess.py


Hamish



      



More information about the grass-user mailing list