[GRASS-dev] [GRASS GIS] #3010: PyGRASS fails to write vector map with attributes
GRASS GIS
trac at osgeo.org
Wed May 4 20:19:26 PDT 2016
#3010: PyGRASS fails to write vector map with attributes
----------------------+-------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: defect | Status: new
Priority: major | Milestone: 7.1.0
Component: PyGRASS | Version: svn-trunk
Keywords: vector | CPU: Unspecified
Platform: All |
----------------------+-------------------------
Example taken from a workshop material:
{{{
from grass.pygrass.vector import VectorTopo
from grass.pygrass.vector.geometry import Point
point1 = Point(635818.8, 221342.4)
point2 = Point(633627.7, 227050.2)
cols = [(u'cat', 'INTEGER PRIMARY KEY'),
(u'name', 'TEXT')]
with VectorTopo('my_points', mode='w', tab_cols=cols, overwrite=True) as
my_points:
# save the point and the attribute
my_points.write(point1, ('pub', ))
my_points.write(point2, ('restaurant', ))
# save the changes to the database
my_points.table.conn.commit()
}}}
gives:
{{{
WARNING: Vector map <my_points> already exists and will be overwritten
WARNING: Coor file of vector map <my_points at PERMANENT> is larger than it
should be (18 bytes excess)
Building topology for vector map <my_points at PERMANENT>...
Registering primitives...
0 primitives registered
0 vertices registered
Building areas...
100%
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
Number of nodes: 0
Number of primitives: 0
Number of points: 0
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
File "/home/anna/dev/grass/trunk1/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/errors.py", line 15, in wrapper
return method(self, *args, **kargs)
File "/home/anna/dev/grass/trunk1/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/vector/__init__.py", line 197, in write
cats.set(cat, self.layer)
File "/home/anna/dev/grass/trunk1/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/vector/basic.py", line 452, in set
libvect.Vect_cat_set(self.c_cats, layer, cat)
ctypes.ArgumentError: argument 3: <type 'exceptions.TypeError'>: wrong
type
}}}
Works in 7.0.4.
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3010>
GRASS GIS <https://grass.osgeo.org>
More information about the grass-dev
mailing list