[GRASS-user] Count points in a network between two locations

Markus Metz markus.metz.giswork at gmail.com
Mon Feb 4 08:01:12 PST 2013


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. Another bug in d.vect is
the use of

sprintf(text, "%s%d", text, cat),

for which the behaviour is undefined.

> 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.
>
>
>> Sprinting a bit fast,
>>
>
> Hey, that's what sprints are for, no ? I'd call this "agile" programming ;-)

Thanks ;-)

Markus M


More information about the grass-user mailing list