[GRASS-user] How to assign costs to nodes using v.net.distance

Hello all,

After I’ve got my v.net.distance up and running I have to adjust my analysis method to the software’s capabilities. Basically, I have a 3 layered network: myroads_net2 which contain layers as follow:

Layer 1: Arch (roads)
Layer 2: Points (Landfills - destinations)
Layer 3: Points (Settlements - source)

As one might understood I’m trying to calculate the lowest cost route between each settlement (layer 3) to each landfill (layer 2). Roads’ costs are constant, which now set to 1 (currency per distance unit - I guess that it is meter). I would like to include a cost for landfill (gate fee) which will be measured with the same currency. MY attempt to use ncolumn (cost for nodes) didn’t go well. I have opened a new column (double precision) in layer 2 and named it gatefee. I have assigned 0 to all cats, except cat=3 which I have assigned with 60. My expectation was that at least some of the settlements that were allocated to cat=3 on layer 2 will be allocated to another one. However after running v.net.distance again with ncolumn=gatefee I have found out that more settlements were allocated to cat=3 of layer 2.

Did I misused that option? I can’t find any guide to how to use it in the manual or tutorials and will appreciate an explanation or a reference to such guide or tutorial.

Best,

Dor

On Thu, Mar 28, 2013 at 2:52 PM, דור פרידמן <dof1985@gmail.com> wrote:

Hello all,

After I've got my v.net.distance up and running I have to adjust my analysis
method to the software's capabilities. Basically, I have a 3 layered
network: myroads_net2 which contain layers as follow:

Layer 1: Arch (roads)
Layer 2: Points (Landfills - destinations)
Layer 3: Points (Settlements - source)

As one might understood I'm trying to calculate the lowest cost route
between each settlement (layer 3) to each landfill (layer 2).

I think v.net.distance is the wrong module for this task because it
finds for each 'from' feature the nearest 'to' feature and not the
shortest path from each 'from' feature to each 'to' feature. Actually,
I don't think any of the v.net.* modules does exactly that. You could
file a ticket for enhancement to request such a module.

Roads' costs
are constant, which now set to 1 (currency per distance unit - I guess that
it is meter). I would like to include a cost for landfill (gate fee) which
will be measured with the same currency. MY attempt to use ncolumn (cost for
nodes) didn't go well. I have opened a new column (double precision) in
layer 2 and named it gatefee. I have assigned 0 to all cats, except cat=3
which I have assigned with 60. My expectation was that at least some of the
settlements that were allocated to cat=3 on layer 2 will be allocated to
another one. However after running v.net.distance again with ncolumn=gatefee
I have found out that more settlements were allocated to cat=3 of layer 2.

If I understand the code of v.net.distance correctly, node costs are ignored.

Markus M

Did I misused that option? I can't find any guide to how to use it in the
manual or tutorials and will appreciate an explanation or a reference to
such guide or tutorial.

Best,

Dor

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

On Fri, 29 Mar 2013 16:58:06 +0100, Markus Metz wrote:

On Thu, Mar 28, 2013 at 2:52 PM, דור פרידמן <dof1985@gmail.com> wrote:

Hello all,

After I've got my v.net.distance up and running I have to adjust my analysis
method to the software's capabilities. Basically, I have a 3 layered
network: myroads_net2 which contain layers as follow:

Layer 1: Arch (roads)
Layer 2: Points (Landfills - destinations)
Layer 3: Points (Settlements - source)

As one might understood I'm trying to calculate the lowest cost route
between each settlement (layer 3) to each landfill (layer 2).

I think v.net.distance is the wrong module for this task because it
finds for each 'from' feature the nearest 'to' feature and not the
shortest path from each 'from' feature to each 'to' feature. Actually,
I don't think any of the v.net.* modules does exactly that. You could
file a ticket for enhancement to request such a module.

You can use v.net.allpairs, but you would have to put all points into the same layer. (Actually if you use grass 6.4 arcs and points will have to be in the same layer. I would recommend using grass7 for these tasks).

In GRASS7, just put all points into nlayer=2 with different cat values (example have all the landfills be in the 10000s and all the settlements in the 20000s - you can use v.category for that). Then run v.net.allpairs and filter out only the results showing the distance between a landfill and a settlement.

Moritz

Hi Markus,

I was very surprised to read your comment about v.net.distance since the manual indicates the following:

“v.net.distance - Computes shortest distance via the network between the given sets of features.
Finds the shortest paths from each ‘from’ point to the nearest ‘to’ feature and various information about this relation are uploaded to the attribute table”

Is it possible that you had a mistake, or is it that the manual is incorrect?
Is the manual is correct? How can I assign costs to the destination nodes to receive the “lowest cost” (shortest) path from each origin node to the nearest (cheapest) target node?

Best,

Dor

2013/3/29 Markus Metz <markus.metz.giswork@gmail.com>

On Thu, Mar 28, 2013 at 2:52 PM, דור פרידמן <dof1985@gmail.com> wrote:

Hello all,

After I’ve got my v.net.distance up and running I have to adjust my analysis
method to the software’s capabilities. Basically, I have a 3 layered
network: myroads_net2 which contain layers as follow:

Layer 1: Arch (roads)
Layer 2: Points (Landfills - destinations)
Layer 3: Points (Settlements - source)

As one might understood I’m trying to calculate the lowest cost route
between each settlement (layer 3) to each landfill (layer 2).

I think v.net.distance is the wrong module for this task because it
finds for each ‘from’ feature the nearest ‘to’ feature and not the
shortest path from each ‘from’ feature to each ‘to’ feature. Actually,
I don’t think any of the v.net.* modules does exactly that. You could
file a ticket for enhancement to request such a module.

Roads’ costs
are constant, which now set to 1 (currency per distance unit - I guess that
it is meter). I would like to include a cost for landfill (gate fee) which
will be measured with the same currency. MY attempt to use ncolumn (cost for
nodes) didn’t go well. I have opened a new column (double precision) in
layer 2 and named it gatefee. I have assigned 0 to all cats, except cat=3
which I have assigned with 60. My expectation was that at least some of the
settlements that were allocated to cat=3 on layer 2 will be allocated to
another one. However after running v.net.distance again with ncolumn=gatefee
I have found out that more settlements were allocated to cat=3 of layer 2.

If I understand the code of v.net.distance correctly, node costs are ignored.

Markus M

Did I misused that option? I can’t find any guide to how to use it in the
manual or tutorials and will appreciate an explanation or a reference to
such guide or tutorial.

Best,

Dor


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

On Mon, Apr 1, 2013 at 10:23 AM, דור פרידמן <dof1985@gmail.com> wrote:

Hi Markus,

I was very surprised to read your comment about v.net.distance since the manual indicates the following:

“v.net.distance - Computes shortest distance via the network between the given sets of features.
Finds the shortest paths from each ‘from’ point to the nearest ‘to’ feature and various information about this relation are uploaded to the attribute table”

Is it possible that you had a mistake, or is it that the manual is incorrect?

I wrote:

I think v.net.distance is the wrong module for this task because it
finds for each ‘from’ feature the nearest ‘to’ feature and not the
shortest path from each ‘from’ feature to each ‘to’ feature.

From the manual:

…the table has three columns: cat, tcat and dist storing category of each from feature, category of the nearest to feature and the distance between them respectively.

No contradiction AFAICT.

How can I assign costs to the destination nodes
That does not make sense because destination nodes are usually not crossed. Assigning costs to nodes makes more sense for nodes between the start and the end node.

to receive the “lowest cost” (shortest) path from each origin node to the nearest (cheapest) target node?

The shortest path for each ‘from’ node to the nearest ‘to’ node is included in the output map. See also the example in the manual.

Markus M

Best,

Dor

2013/3/29 Markus Metz <markus.metz.giswork@gmail.com>

On Thu, Mar 28, 2013 at 2:52 PM, דור פרידמן <dof1985@gmail.com> wrote:

Hello all,

After I’ve got my v.net.distance up and running I have to adjust my analysis
method to the software’s capabilities. Basically, I have a 3 layered
network: myroads_net2 which contain layers as follow:

Layer 1: Arch (roads)
Layer 2: Points (Landfills - destinations)
Layer 3: Points (Settlements - source)

As one might understood I’m trying to calculate the lowest cost route
between each settlement (layer 3) to each landfill (layer 2).

I think v.net.distance is the wrong module for this task because it
finds for each ‘from’ feature the nearest ‘to’ feature and not the
shortest path from each ‘from’ feature to each ‘to’ feature. Actually,
I don’t think any of the v.net.* modules does exactly that. You could
file a ticket for enhancement to request such a module.

Roads’ costs
are constant, which now set to 1 (currency per distance unit - I guess that
it is meter). I would like to include a cost for landfill (gate fee) which
will be measured with the same currency. MY attempt to use ncolumn (cost for
nodes) didn’t go well. I have opened a new column (double precision) in
layer 2 and named it gatefee. I have assigned 0 to all cats, except cat=3
which I have assigned with 60. My expectation was that at least some of the
settlements that were allocated to cat=3 on layer 2 will be allocated to
another one. However after running v.net.distance again with ncolumn=gatefee
I have found out that more settlements were allocated to cat=3 of layer 2.

If I understand the code of v.net.distance correctly, node costs are ignored.

Markus M

Did I misused that option? I can’t find any guide to how to use it in the
manual or tutorials and will appreciate an explanation or a reference to
such guide or tutorial.

Best,

Dor


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Thanks Markus.

It might be valuable to add an option to assign costs to the destination nodes, either for my purpose when there is an actual gate fee that influence the total cost (e.g. waste management, national parks and reserves) or when the “gate fee” or nodes cost represent other factors that influence an individual decisions, i.e. external costs that describe socio-environmental parameters, such as: level of crime, general maintenance, scenery, number of shops in a commercial center, hospitals reliability and quality etc.

I will appreciate if you could direct me to the place I can ask for an improvement of the v.net.distance tool.

Regarding to the current analysis, I have though of two solutions and would like to get your (and all others) idea about it:

  1. Follow Markus’s original suggestion to perform the analysis using v.net.allpairs - which will be easy to the empirical anlysis using excel, but more complex to create a map for the final shortest distance.
  2. Try to assign costs to the nodes that connect each arc (formed by v.net) to the original network. My fear is that instead of assign cost just to the path to the destination node, it will also include those who attempt to use the original network to arrive to another destination. I’m also not sure about how to locate the nodes I’m looking for.

Any advice?

Thanks

Dor

···

2013/4/1 Markus Metz <markus.metz.giswork@gmail.com>

On Mon, Apr 1, 2013 at 10:23 AM, דור פרידמן <dof1985@gmail.com> wrote:

Hi Markus,

I was very surprised to read your comment about v.net.distance since the manual indicates the following:

“v.net.distance - Computes shortest distance via the network between the given sets of features.
Finds the shortest paths from each ‘from’ point to the nearest ‘to’ feature and various information about this relation are uploaded to the attribute table”

Is it possible that you had a mistake, or is it that the manual is incorrect?

I wrote:

I think v.net.distance is the wrong module for this task because it
finds for each ‘from’ feature the nearest ‘to’ feature and not the
shortest path from each ‘from’ feature to each ‘to’ feature.

From the manual:

…the table has three columns: cat, tcat and dist storing category of each from feature, category of the nearest to feature and the distance between them respectively.

No contradiction AFAICT.

How can I assign costs to the destination nodes

That does not make sense because destination nodes are usually not crossed. Assigning costs to nodes makes more sense for nodes between the start and the end node.

to receive the “lowest cost” (shortest) path from each origin node to the nearest (cheapest) target node?

The shortest path for each ‘from’ node to the nearest ‘to’ node is included in the output map. See also the example in the manual.

Markus M

Best,

Dor

2013/3/29 Markus Metz <markus.metz.giswork@gmail.com>

On Thu, Mar 28, 2013 at 2:52 PM, דור פרידמן <dof1985@gmail.com> wrote:

Hello all,

After I’ve got my v.net.distance up and running I have to adjust my analysis
method to the software’s capabilities. Basically, I have a 3 layered
network: myroads_net2 which contain layers as follow:

Layer 1: Arch (roads)
Layer 2: Points (Landfills - destinations)
Layer 3: Points (Settlements - source)

As one might understood I’m trying to calculate the lowest cost route
between each settlement (layer 3) to each landfill (layer 2).

I think v.net.distance is the wrong module for this task because it
finds for each ‘from’ feature the nearest ‘to’ feature and not the
shortest path from each ‘from’ feature to each ‘to’ feature. Actually,
I don’t think any of the v.net.* modules does exactly that. You could
file a ticket for enhancement to request such a module.

Roads’ costs
are constant, which now set to 1 (currency per distance unit - I guess that
it is meter). I would like to include a cost for landfill (gate fee) which
will be measured with the same currency. MY attempt to use ncolumn (cost for
nodes) didn’t go well. I have opened a new column (double precision) in
layer 2 and named it gatefee. I have assigned 0 to all cats, except cat=3
which I have assigned with 60. My expectation was that at least some of the
settlements that were allocated to cat=3 on layer 2 will be allocated to
another one. However after running v.net.distance again with ncolumn=gatefee
I have found out that more settlements were allocated to cat=3 of layer 2.

If I understand the code of v.net.distance correctly, node costs are ignored.

Markus M

Did I misused that option? I can’t find any guide to how to use it in the
manual or tutorials and will appreciate an explanation or a reference to
such guide or tutorial.

Best,

Dor


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

On 01/04/13 18:20, דור פרידמן wrote:

Thanks Markus.

It might be valuable to add an option to assign costs to the destination
nodes, either for my purpose when there is an actual gate fee that
influence the total cost (e.g. waste management, national parks and
reserves) or when the "gate fee" or nodes cost represent other factors
that influence an individual decisions, i.e. external costs that
describe socio-environmental parameters, such as: level of crime,
general maintenance, scenery, number of shops in a commercial center,
hospitals reliability and quality etc.

I will appreciate if you could direct me to the place I can ask for an
improvement of the v.net.distance tool.

Regarding to the current analysis, I have though of two solutions and
would like to get your (and all others) idea about it:

1. Follow Markus's original suggestion to perform the analysis using
    v.net.allpairs - which will be easy to the empirical anlysis using
    excel, but more complex to create a map for the final shortest distance.

v.net.allpairs produces a vector map of all shortest paths. You just have to extract those you need.

Moritz

On Mon, Apr 1, 2013 at 6:20 PM, דור פרידמן <dof1985@gmail.com> wrote:

Thanks Markus.

I will appreciate if you could direct me to the place I can ask for an
improvement of the v.net.distance tool.

https://trac.osgeo.org/grass/

Regarding to the current analysis, I have though of two solutions and would
like to get your (and all others) idea about it:

Follow Markus's original suggestion to perform the analysis using
v.net.allpairs

That was Moritz.

Try to assign costs to the nodes that connect each arc (formed by v.net) to
the original network. My fear is that instead of assign cost just to the
path to the destination node, it will also include those who attempt to use
the original network to arrive to another destination. I'm also not sure
about how to locate the nodes I'm looking for.

In this case, don't assign costs to nodes. The attribute table of the
output of v.net.distance includes the category of the nearest 'to'
node. You can then add a new column to the table and add node costs to
the reported distance for each 'to' node separately.

Node costs are only considered when a node is crossed, not when a node
is reached: pass through the gate vs. arrive at the gate. I understand
that you would like to give different preferences to destination nodes
which is a different problem and would require an additional option to
the module.

First of all, v.net.distance needs to be updated to consider node
costs in general, and also to consider backward travelling costs for
arcs. This applies also to some other of the new v.net.* modules.

Markus M

Any advice?

Thanks

Dor

2013/4/1 Markus Metz <markus.metz.giswork@gmail.com>

On Mon, Apr 1, 2013 at 10:23 AM, דור פרידמן <dof1985@gmail.com> wrote:
>
> Hi Markus,
>
> I was very surprised to read your comment about v.net.distance since the
> manual indicates the following:
>>
>> "v.net.distance - Computes shortest distance via the network between
>> the given sets of features.
>> Finds the shortest paths from each 'from' point to the nearest 'to'
>> feature and various information about this relation are uploaded to the
>> attribute table"
>
>
> Is it possible that you had a mistake, or is it that the manual is
> incorrect?

I wrote:

I think v.net.distance is the wrong module for this task because it
finds for each 'from' feature the nearest 'to' feature and not the
shortest path from each 'from' feature to each 'to' feature.

From the manual:

...the table has three columns: cat, tcat and dist storing category of
each from feature, category of the nearest to feature and the distance
between them respectively.

No contradiction AFAICT.

> How can I assign costs to the destination nodes
That does not make sense because destination nodes are usually not
crossed. Assigning costs to nodes makes more sense for nodes between the
start and the end node.

> to receive the "lowest cost" (shortest) path from each origin node to
> the nearest (cheapest) target node?

The shortest path for each 'from' node to the nearest 'to' node is
included in the output map. See also the example in the manual.

Markus M

>
>
> Best,
>
> Dor

>
>
> 2013/3/29 Markus Metz <markus.metz.giswork@gmail.com>
>>
>> On Thu, Mar 28, 2013 at 2:52 PM, דור פרידמן <dof1985@gmail.com> wrote:
>> > Hello all,
>> >
>> > After I've got my v.net.distance up and running I have to adjust my
>> > analysis
>> > method to the software's capabilities. Basically, I have a 3 layered
>> > network: myroads_net2 which contain layers as follow:
>> >
>> > Layer 1: Arch (roads)
>> > Layer 2: Points (Landfills - destinations)
>> > Layer 3: Points (Settlements - source)
>> >
>> > As one might understood I'm trying to calculate the lowest cost route
>> > between each settlement (layer 3) to each landfill (layer 2).
>>
>> I think v.net.distance is the wrong module for this task because it
>> finds for each 'from' feature the nearest 'to' feature and not the
>> shortest path from each 'from' feature to each 'to' feature. Actually,
>> I don't think any of the v.net.* modules does exactly that. You could
>> file a ticket for enhancement to request such a module.
>>
>> > Roads' costs
>> > are constant, which now set to 1 (currency per distance unit - I
>> > guess that
>> > it is meter). I would like to include a cost for landfill (gate fee)
>> > which
>> > will be measured with the same currency. MY attempt to use ncolumn
>> > (cost for
>> > nodes) didn't go well. I have opened a new column (double precision)
>> > in
>> > layer 2 and named it gatefee. I have assigned 0 to all cats, except
>> > cat=3
>> > which I have assigned with 60. My expectation was that at least some
>> > of the
>> > settlements that were allocated to cat=3 on layer 2 will be allocated
>> > to
>> > another one. However after running v.net.distance again with
>> > ncolumn=gatefee
>> > I have found out that more settlements were allocated to cat=3 of
>> > layer 2.
>>
>> If I understand the code of v.net.distance correctly, node costs are
>> ignored.
>>
>> Markus M
>>
>> >
>> > Did I misused that option? I can't find any guide to how to use it in
>> > the
>> > manual or tutorials and will appreciate an explanation or a reference
>> > to
>> > such guide or tutorial.
>> >
>> > Best,
>> >
>> > Dor
>> >
>> > _______________________________________________
>> > grass-user mailing list
>> > grass-user@lists.osgeo.org
>> > http://lists.osgeo.org/mailman/listinfo/grass-user
>> >
>
>