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?
Markus
On 9/25/06, Markus Neteler <neteler@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.
Radim
Markus
_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev
Radim Blazek wrote:
On 9/25/06, Markus Neteler <neteler@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
Hello Moritz
On Mon, 25 Sep 2006, Moritz Lennert wrote:
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.
My understanding is that a point is represented as a line containing only one node. So the number of lines is equivalent to the number of points. I have very limited experience with this but in any maps I came across while testing recent changes to v.surf.idw to remove it's dependency on topology, this is how points where represented.
Paul
Paul Kelly wrote:
Hello Moritz
On Mon, 25 Sep 2006, Moritz Lennert wrote:
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.
My understanding is that a point is represented as a line containing only one node. So the number of lines is equivalent to the number of points. I have very limited experience with this but in any maps I came across while testing recent changes to v.surf.idw to remove it's dependency on topology, this is how points where represented.
Thanks Paul, that explains it, and probably also Markus' issue, no ?
A related question: I use Vect_cidx_find_next() which returns an 'id' value which corresponds to:
id = ci->cat[cat_index][2]
ci being a Cat_index structure in which cat is defined as:
int (*cat)[3]; /* array of cats (cat,type, lines/area) */
is the 'lines/areas' equivalent to the line number used in the above Vect_read_line() call. It seems to be (at least it seems to work when I use it), but I just want to make sure.
Moritz
On Mon, Sep 25, 2006 at 11:45:36AM +0200, Radim Blazek wrote:
On 9/25/06, Markus Neteler <neteler@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.
While a bug in Python API is likely, I wonder about the
difference between
map->plus.n_llines and
map->plus.n_lines
May I ask you to explain it (or point me to the docs?)?
Related: I assume that v.info should be changed to use
Vect_get_num_lines() etc instead of Vect_get_num_primitives()?
thanks
Markus
On 9/25/06, Markus Neteler <neteler@itc.it> wrote:
On Mon, Sep 25, 2006 at 11:45:36AM +0200, Radim Blazek wrote:
> On 9/25/06, Markus Neteler <neteler@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.
While a bug in Python API is likely, I wonder about the
difference between
map->plus.n_llines and
map->plus.n_lines
n_lines are all primitives (elements) in coor file, i.e. without
areas and n_llines are only primitives of type GV_LINE.
May I ask you to explain it (or point me to the docs?)?
Related: I assume that v.info should be changed to use
Vect_get_num_lines() etc instead of Vect_get_num_primitives()?
It depends what you want to print, IMO it is correct.
Radim
thanks
Markus
_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev