[GRASS-user] how to measure distances in a constrained space
Moritz Lennert
mlennert at club.worldonline.be
Wed Nov 12 15:53:17 EST 2008
> Moritz Lennert escribió:
>> Hello,
>>
>> 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.
On 12/11/08 19:46, 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.
Thank you ! It is actually a bit overkill for me as I don't need the
distance from every city in set 1 to every city in set 2, but only the
distance for every city in set 1 to the closest city in set 2. As I have
over 1000 cities in one and 556 cities in the other set, it is a bit
heavy for your script.
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_column
And 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...
Moritz
More information about the grass-user
mailing list