#2413: pygrass: number_of wrong function associated
----------------------------+-----------------------------------------------
Reporter: artegion | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 6.4.5
Component: Python | Version: svn-releasebranch70
Keywords: pygrass vector | Platform: All
Cpu: Unspecified |
----------------------------+-----------------------------------------------
Changes (by zarch):
* keywords: => pygrass vector
Comment:
Replying to [comment:1 lucadelu]:
> Replying to [ticket:2413 artegion]:
> > In _NUMOF dictionary (pygrass/vector/__init__.py )'lines' key is
associated to libvect.Vect_get_num_line_points function instead of
libvect.Vect_get_num_lines
> >
>
> Fixed in r61862.
> If it is correct it should be backported.
Mmh, I'm still not convinced running the code below on NC:
{{{
from pprint import pprint
from grass.pygrass.vector import VectorTopo
from grass.pygrass.vector import _NUMOF
from grass.pygrass.modules.shortcuts import vector as v
def test_vect_features(vectname):
print(vectname)
with VectorTopo(vectname, mode='r') as vect:
for key in sorted(_NUMOF):
print(" %20s %6d" % (key, vect.number_of('points')))
print(' primitives:')
pprint(vect.num_primitives())
v.info(vectname)
print
test_vect_features('schools')
test_vect_features('streams')
}}}
_NUMOF is defined
(http://trac.osgeo.org/grass/browser/grass/trunk/lib/python/pygrass/vector/__init__.py#L24):
{{{
_NUMOF = {"areas": libvect.Vect_get_num_areas,
"dblinks": libvect.Vect_get_num_dblinks,
"faces": libvect.Vect_get_num_faces,
"holes": libvect.Vect_get_num_holes,
"islands": libvect.Vect_get_num_islands,
"kernels": libvect.Vect_get_num_kernels,
"lines": libvect.Vect_get_num_lines,
"points": libvect.Vect_get_num_line_points,
"nodes": libvect.Vect_get_num_nodes,
"updated_lines": libvect.Vect_get_num_updated_lines,
"updated_nodes": libvect.Vect_get_num_updated_nodes,
"volumes": libvect.Vect_get_num_volumes}
}}}
And this is what I got:
{{{
schools
areas 5
dblinks 5
faces 5
holes 5
islands 5
kernels 5
lines 5
nodes 5
points 5
updated_lines 5
updated_nodes 5
volumes 5
primitives:
{'area': 0,
'boundary': 0,
'centroid': 0,
'face': 0,
'kernel': 0,
'line': 0,
'point': 167,
'volume': 0}
+----------------------------------------------------------------------------+
| Name: schools
|
| Mapset: PERMANENT
|
| Location: nc_basic_spm_grass7
|
| Database: /home/pietro/docdat/gis
|
| Title: Wake County schools (points map)
|
| Map scale: 1:1
|
| Name of creator: helena
|
| Organization: NC OneMap
|
| Source date: Tue Nov 7 19:34:09 2006
|
| Timestamp (first layer): none
|
|----------------------------------------------------------------------------|
| Map format: native
|
|----------------------------------------------------------------------------|
| Type of map: vector (level: 2)
|
|
|
| Number of points: 167 Number of centroids: 0
|
| Number of lines: 0 Number of boundaries: 0
|
| Number of areas: 0 Number of islands: 0
|
|
|
| Map is 3D: No
|
| Number of dblinks: 1
|
|
|
| Projection: Lambert Conformal Conic
|
|
|
| N: 248159.84441077 S: 203559.01136227
|
| E: 671714.55110786 W: 619215.13388253
|
|
|
| Digitization threshold: 0
|
| Comment:
|
|
|
+----------------------------------------------------------------------------+
streams
areas 5
dblinks 5
faces 5
holes 5
islands 5
kernels 5
lines 5
nodes 5
points 5
updated_lines 5
updated_nodes 5
volumes 5
primitives:
{'area': 0,
'boundary': 0,
'centroid': 0,
'face': 0,
'kernel': 0,
'line': 8554,
'point': 0,
'volume': 0}
+----------------------------------------------------------------------------+
| Name: streams
|
| Mapset: PERMANENT
|
| Location: nc_basic_spm_grass7
|
| Database: /home/pietro/docdat/gis
|
| Title: South-West Wake streams (lines map)
|
| Map scale: 1:1
|
| Name of creator: helena
|
| Organization: NC OneMap
|
| Source date: Tue Nov 7 19:37:02 2006
|
| Timestamp (first layer): none
|
|----------------------------------------------------------------------------|
| Map format: native
|
|----------------------------------------------------------------------------|
| Type of map: vector (level: 2)
|
|
|
| Number of points: 0 Number of centroids: 0
|
| Number of lines: 8554 Number of boundaries: 0
|
| Number of areas: 0 Number of islands: 0
|
|
|
| Map is 3D: No
|
| Number of dblinks: 1
|
|
|
| Projection: Lambert Conformal Conic
|
|
|
| N: 228882.03322323 S: 214637.98658874
|
| E: 645264.23103886 W: 629851.88519177
|
|
|
| Digitization threshold: 0
|
| Comment:
|
|
|
+----------------------------------------------------------------------------+
}}}
So it is not clear to me what is not working, but I don't think that it is
correct...
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2413#comment:2>
GRASS GIS <http://grass.osgeo.org>