[GRASS-user] Count points in a network between two locations
Moritz Lennert
mlennert at club.worldonline.be
Mon Feb 4 20:22:47 PST 2013
On 04/02/13 18:54, Moritz Lennert wrote:
> On 04/02/13 17:17, Markus Metz wrote:
>> On Mon, Feb 4, 2013 at 5:01 PM, Markus Metz
>> <markus.metz.giswork at gmail.com> wrote:
>>> On Mon, Feb 4, 2013 at 4:41 PM, Moritz Lennert
>>> <mlennert at club.worldonline.be> wrote:
>>>> On 04/02/13 16:07, Markus Metz wrote:
>>>>>
>>>>> On Mon, Feb 4, 2013 at 3:41 PM, Moritz Lennert
>>>>
>>>>
>>>>>> Now I get a segfault. gdb full backtrace and DEBUG=3 log attached.
>>>>>> Do you
>>>>>> need something else ?
>>>>>
>>>>>
>>>>> Should be fixed in r54897.
>>>>>
>>>>
>>>> The module runs now and very fast, but weirdly enough I cannot
>>>> display the
>>>> category values in the resulting map. Using wxgui, I get
>>>>
>>>> The command 'd.vect map=allpairs at user1 type=point,line,area,face
>>>> display=shape,cat' has failed
>>>>
>>>> The same for
>>>>
>>>> d.vect map=allpairs at user1 layer=1 type=line display=shape,cat
>>>>
>>>> Trying to run this on the command line:
>>>>
>>>> d.mon cairo
>>>> d.vect map=allpairs at user1 layer=1 type=line display=shape,cat
>>>>
>>>>
>>>> Gives me a seg fault at
>>>>
>>>> Debug=3:
>>>> D3/3: cat lab: field = 1, cat = 1121
>>>> D3/3: Vect_read_next_line(): next_line = 53
>>>> D3/3: V2_read_next_line_nat()
>>>> D3/3: Vect__Read_line_nat: offset = 95566
>>>> D3/3: type = 2, do_cats = 1 dead = 0
>>>> D3/3: n_cats = 96
>>>> D3/3: n_points = 41
>>>> Erreur de segmentation
>>>>
>>>>
>>>> gdb:
>>>> Program received signal SIGSEGV, Segmentation fault.
>>>> dig_alloc_points (points=0x313231, num=42) at struct_alloc.c:338
>>>> 338 alloced = points->alloc_points;
>>>
>>> The segfault is caused by d.vect because the maximum text length is
>>> 100 characters only !!! I'm going to fix it.
>>
>> Fixed in r54906.
>
> Great, thanks !
>
>>
>>>
>>>> Looking at the map I do get out of the operation (attached) I would
>>>> think
>>>> that the list of cats for a given segment might just be too long...
>>>> I guess
>>>> my idea was maybe not so wise and your original implementation was
>>>> actually
>>>> better.
>>
>> It displays now correct, but "correct" means long read lines with
>> category numbers. Actually, the display would look the same with
>> duplicate lines.
>
> I think duplicated lines display cats one above the other, not in a line
> like this. I agree that displaying them as such is not terribly useful,
> except for checking specific results.
>
> Now I tested a possible response to Johannes' initial question:
>
> v.distance from=allpairs from_layer=1 from_type=line to=allpairs
> to_layer=2 to_type=point upload=cat,dist col=to_cat,dist -a dmax=0.0001
> table=dists
>
> gives me a table with distance from all nodes that lie on the different
> paths.
Forget this, I guess I was trying to do too many things at the same time
yesterday to check correctly. Actually the v.distance call does not work
for this purpose since v.distance only uses the very first cat value of
each segment, and so the distance matrix only gives me the those paths
that have the lowest cat value, not all paths, without any warning. So,
not only do you not get all paths, but for those paths you do get, the
number of nodes might not be correct since only those segments of a
given path where the path cat of that path is the first in the long list
of path cats will be taken into account.
If you turn the v.distance call around to calculate distances from nodes
to paths, i;e.:
v.distance from=allpairs from_layer=2 from_type=point to=allpairs
to_layer=1 to_type=line upload=cat col=to_cat -a dmax=0.0001 table=dists --o
you get the warning
ATTENTION : More cats found in to_layer
Actually in the code of v.distance, there is a TODO at that point
related to this issue:
"/* TODO: all cats of given field ? */"
So, either we have to enhance v.distance to take into account all cat
values in a given layer, or for this particular issue, the old version
of v.net.allpairs is actually easier to use. Maybe a flag to
v.net.allpairs could allow to not remove duplicates ?
Moritz
More information about the grass-user
mailing list