[GRASS-user] Finding Nearest Intersection (point) on Road Network

Moritz Lennert mlennert at club.worldonline.be
Sun Dec 28 09:46:10 EST 2008


On Wed, December 24, 2008 05:55, Ryan R. Rosario wrote:
>
> GRASS simply returns the same point back, since the closest node to A is
> A.

In grass6.4 you have the dmin option to avoid that.

> If I use patch first, then the from and to maps in v.distance must be the
> same, unless I am misunderstanding something.

That is correct.

>
> The vector map containing the intersections (the set of points B) contains
> both points (created using v.net nodes) and lines (the original road
> network). I can get the nearest point using v.distance, but this uses
> straight-line distance, not the distance along the road.
>
> Although v.distance offers the "to_along" option, there does not appear to
> be anywhere to specify which vector contains the road network.

IIUC, to_along works if your from_map is a point map and your to_map is a
line map.

> And it
> seems
> that v.net.path requires that both the start and end points must be known
> a
> priori, and I only have the start point. I am trying to find the end point
> (the nearest intersection). I am stuck, but I think I am missing something
> important here.

As a reminder, here's your original question:
"I have two vector maps consisting of points and a vector map containing a
road network. Given a point A, I want to find the nearest point B along the
road network, for each A."

There is a definite need for a v.net.distance, i.e. a v.distance on a
network. Maybe you could file a wish for that on trac.

Here's an algorithm I imagine could help you get closer to an answer
(untested):

- Use v.net.iso on your road network with one point A as starting point
setting "costs" to a sufficiently fine-grained resolution of distances.
- Run v.distance with from_map=B to_map=VNetIsoOutput upload=cat
- Find point in B with lowest cat (through SQL query on the attribute table)

Quite convulted, but might work, depending on the number of points and the
complexity of your road network. Note that currently the v.net.* modules
in GRASS do not work very well, and hardly at all once the network becomes
too big. Rewriting these modules to be more scalable and reliable would be
a nice Google Summer of Code project for next year.

Moritz



More information about the grass-user mailing list