[GRASS-dev] Add a cost distance measure to GRASS GIS lib
glynn at gclements.plus.com
Thu Mar 1 12:14:41 EST 2012
Benjamin Ducke wrote:
> I have been pondering this for a while and would
> like to know if people on this list think the
> following would be a feasible/useful addition to
> GRASS (7):
> How about, in addition to the MASK raster, we'd
> also allow the user to specify a COST raster?
> This would allow all raster modules that currently
> use an euclidean distance measure (KDE, IDW, ...)
> to use a cost-based measure instead, without adding
> more options to the individual modules.
> In addition to the COST raster, we could modify the
> basic distance function in the GRASS GIS lib to
> automatically return a cost-based result if the
> COST raster is present. This way, there would have
> to be no or only minimal modifications to existing
This proposal makes no sense.
The mask raster is relatively cheap to implement, while a least-cost
path is one of the most expensive calculations available in GRASS.
Also, the mask raster affects every raster module which reads at least
one input map, while very few modules calculate distances.
Being able to calculate least-cost distances between arbitrary points
would require holding the entire cost raster in memory.
If you want least-cost distances from a fixed set of points to
arbitrary points, it's significantly more efficient to generate
distance rasters in advance (which requires knowing the starting
If you want multiple least-cost distances between arbitrary points,
you would probably want to cache some intermediate results in order to
allow an upper bound on the distance to be calculated cheaply. But you
probably can't afford the memory to cache every intermediate result,
and knowing which ones are worth caching is application-specific.
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev