[GRASS-dev] Vect_get_num_lines() versus Vect_get_num_primitives()

Moritz Lennert mlennert at club.worldonline.be
Mon Sep 25 06:19:30 EDT 2006


Radim Blazek wrote:
> On 9/25/06, Markus Neteler <neteler at itc.it> wrote:
>> Hi,
>>
>> trying the new Python-Vector API, I found a discrepancy which
>> I would like to understand:
>>
>> On 'roads' in Spearfish, v.info reports
>>    Number of lines:        825
>> based on Vect_get_num_primitives(&Map, GV_LINE)
>>
>> If I use in the Python API the Vect_get_num_lines(map),
>> I get
>> Number of lines: 2876
>>
>> Difference:
>> - Vect_get_num_primitives uses map->plus.n_llines
>> - Vect_get_num_lines      uses map->plus.n_lines
>>
>> Which one is right? Probably Vect_get_num_lines() should
>> use n_lines as well and we need an extra function to
>> report segments?
> 
> It must be a bug in Python API, Vect_get_num_lines() must
> also give 825.

When working on a revision of d.vect.chart, I got the feeling that
Vect_get_num_lines was used as if it returned the number of _all_ the
features in the map, not only the lines (from lines 49+ of
display/d.vect.chart/plot.c):

nlines = Vect_get_num_lines ( Map );
	
/* loop through each vector feature */
for ( line = 1; line <= nlines; line++ ) {
     G_debug ( 3, "line = %d", line );
     ltype =  Vect_read_line (Map, Points, Cats, line);

As you can create charts with vector point, I don't know how this would
work, if Vect_get_num_lines returns only number of lines.


Moritz




More information about the grass-dev mailing list