[GRASS-dev] v.net.allpairs seems broken

Markus Metz markus.metz.giswork at gmail.com
Mon Oct 8 09:09:18 PDT 2012


On Mon, Oct 8, 2012 at 5:28 PM, Moritz Lennert
<mlennert at club.worldonline.be> wrote:
> On 07/10/12 09:12, Michael Barton wrote:
>>
>> v.net.allpairs only produces nodes. It calculates the cost of the
>> shortest paths between all nodes but does not create the paths. Is this
>> correct? Seems like it also ought to create the paths too.
>
>
> In 6.4.2 I get an alloc error:
>
> v.net.allpairs  street_schools out=allpaths cats=5000-50009
> ERREUR :G_calloc: unable to allocate 42020 * 4 bytes at main.c:173
>
> Don't have the time to look into this at the moment.
>
> In trunk I get it to work. There was an issue with many of the v.net modules
> that came out of GSoC: they did not distinguish between an arc and a node
> layer. Maybe that's the reason for the G_calloc issue.

I have fixed most of the new v.net.* modules trunk to support
different arc and node layers, i.e. to work with the output of v.net
which creates networks suitable for GRASS network analysis. I do not
know an easy way to create vectors in GRASS 6 to work with the new
network analysis modules.

>
> In trunk, the result is a vector map of nodes with an attribute table linked
> to these nodes which provides a distance matrix across the network for all
> pairs of nodes.
>
> I agree that this is suboptimal output. I think the following outputs would
> be interesting:
>
> - a table with the distance matrix, but this does not have to be linked to a
> map (cf v.distance table option)

+1
I would prefer output as a matrix to a file (or stdout) with a custom
field separator instead of an attribute table. I guess (at least I
would take that route) that post-processing of that output is done
outside GRASS.

There is a bug in the current implementation of v.net.allpairs: there
are multiple entries for the same category and layer in the output
attribute table. This is not supported by GRASS.

> - a map with all the paths
>
> I would guess that the code is in the v.net modules (notably v.net.path) to
> easily create a map of paths. MarkusM ?

Yes, that should be easy. I would suggest to change v.net.allpairs
such that the output contains all the paths. Each path gets its own
category, and the attribute table holds information about the start
node, end node, and cost to get from the start node to the end node.
Additionally, a matrix can be printed to file or stdout with the costs
of travelling from the start node to the end node. This matrix is not
symmetric because the cost of travelling from A to B is not
necessarily equal to the cost of travelling from B to A (one-way
streets for example).
>
> I guess it's time for an enhancement ticket.

I agree. Even though I regard the output of v.net.allpairs in GRASS 6
as nearly unusable, the memory allocation error should be fixed, which
would be a separate ticket.

Markus M


More information about the grass-dev mailing list