On 10/07/09 14:53, Markus Neteler wrote:
On Fri, Jul 10, 2009 at 9:37 AM, Moritz
Lennert<[email protected]> wrote:
Using r.cost with multiple starting points with my students, the question
came up whether it is possible to use the resulting cumulative cost surface
to assign each pixel the cat (or other info) of its closest starting point,
so something like r.grow.distance, but taking into account the cost, not
necessarily the distance.
Any ideas ?
(Un)related wish: while you are at it, could you also compare the results
of r.terracost in the Addons repository [1]? If as expected, I would suggest
to replace r.cost with the code of r.terracost in GRASS 7.
Using two different examples I use in current teaching (dataset nc_spm_06):
g.region rast=elev_state_500m
v.to.rast nc_state use=val val=500.0 out=cost
v.to.rast urbanarea use=val val=1 out=urbanarea
r.cost -k in=cost start_rast=urbanarea out=dist_urban
r.terracost in=cost start_rast=urbanarea out=dist_urban_terracost
r.mapcalc diff=dist_urban-dist_urban_terracost
results in
http://geog-pc40.ulb.ac.be/grass/misc/comparison_rcost_rterracost_1.png
with
dist_urban: maximum: 83450.8, mean: 11829.7
dist_urban_terracost: maximum: 85324.1, mean: 11932.2
g.region rast=landclass96
r.reclass landclass96 out=cost_landcover << EOF
1 = 200
2 = 20
3 = 5
4 = 50
5 = 30
6 = 1000
7 = 5
EOF
r.cost -k in=cost_landcover out=dist_rcost coordinate=629980,228527.25
echo "629980|228527.25" | v.in.ascii out=point
#would be nice if r.terracost also accepted a vector map or coordinates
as starting points
v.to.rast point use=val val=1 out=point
r.terracost in=cost_landcover out=dist_terracost start_rast=point
r.mapcalc diff2=dist_rcost-dist_terracost
results in
http://geog-pc40.ulb.ac.be/grass/misc/comparison_rcost_rterracost_2.png
with
dist_rcost: maximum: 30320, mean: 10641.8
dist_rterracost: maximum: 30755.4, mean: 10868
So, differences are non-negligeable, but no idea how to interpret them
at this stage, i.e. don't know which one is "correct".
Moritz
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user