------------------------------
Message: 3
Date: Wed, 12 Nov 2008 19:14:11 -0800 (PST)
From: Hamish <hamish_b@yahoo.com>
Subject: Re: [GRASS-user] how to measure distances in a constrained
space
To: Facundo Mu?oz <famuvie@alumni.uv.es>, Moritz Lennert
<mlennert@club.worldonline.be>
Cc: grass-user@lists.osgeo.org
Message-ID: <209101.3681.qm@web110013.mail.gq1.yahoo.com>
Content-Type: text/plain; charset=iso-8859-1Moritz Lennert wrote:
I would like to measure distances between points
in a constrained space, such as distances between cities,
but only taking into account distances by land, and so
excluding any water bodies. Concretely, this means finding
those cities in a first set of cities which are at least
150km from the nearest city in the a second set of cities.
Facundo Muñoz wrote:
I've implemented exactly the same idea as yours in this script:
http://www.geeitema.org/doc/guenmap//docs/v.costdist.mat.zip
...with the particularity that it stores the computed distances in the
attribute table of the second set of cities, which was needed for my
application.
You can try it, and see if it works for you.
I actually now get a correct result with the following
steps (my original cost map was wrong, that's why my
results where weird):- create a cost map where all land parts are equal to the
resolution and all water masses are null
- run r.cost with start_points=set2 (actually no need for
null_cost) tio create the distance map
- run v.what.rast vector=set1 raster=distance column=dist_columnAnd results seem perfectly correct.
Now just for curiosity, any possible solution in vector
space ? I thought about v.net.visibility, but it would need
to be altered to allow a visibility graph from vector1 to
vector2, instead of only within vector1. Then I guess one
could use something like v.net.iso or loop through
v.net.path...
just some extra notes:
- r.cost in GRASS 6.4 should be 60x faster than in older versions
- have a look at the new r.grow.distance in GRASS 7, even faster
- FWIW when I've done this I've made the cost map 1,NULL and multiplied
the cost distance by map res. knights move is essential.
- See the v.surf.icw script in wiki addons. it is like IDW interpolation
but replaces euclidean distance with true (cost) distance and goes
around corners/coastlines.
- Somewhere I had a script for generating distance matrix tables for
distance between sites taking obstacles into account using r.cost.
I'd have to hunt for a backup copy.It would definitely be interesting to hear if you figure something out
with v.net.visibility. you are looking for as-the-bird-flies distance,
not road distance, right?see ongoing geodesic distance thread on the PROJ4 list for more on the
dangers of measuring long distances on a grid map projection.Hamish
As one burned by measuring distance on grid projections, a minor
observation ...
Keep in mind "fit for purpose". If I'm asking "how many people live
within 1km of a railway station?", other errors (such as assumptions of
the distribution of people within an area) will probably be bigger than
the measurement of 1km. For these "rough" measurements, I keep a
database table of degrees per km at tenth-degree increments. That way,
the attribute table of point data can include a roughly-accurate number
for buffering based on latitude. Rough, but re-usable!
RC