[GRASS-dev] Re: ctypes problem with Vect_open_old
Martin Landa
landa.martin at gmail.com
Tue Jan 4 02:02:45 EST 2011
Hi,
2010/12/30 Maris Nartiss <maris.gis at gmail.com>:
> I was beating my head on same problem till I realized - with ctypes
> You just write Your C application in Python. It's still C. When You
> start to threat it like C, it works just fine ;)
right, just facing to the strange problem, any idea?
Sample script
"""
from grass.lib.vector import *
map_obj = Map_info()
map = pointer(map_obj)
Vect_open_update(map, "a", "")
print Vect_level(map)
p = line_pnts()
Vect_append_point(byref(p), 1, 1, 0)
Vect_write_line(map, GV_POINT, byref(p), None)
Vect_build(map)
Vect_close(map)
"""
$ g.gisenv set=DEBUG=1
D1/3: Vect__open_old(): name = a mapset = layer= (null) update = 1
D1/3: Vect_open_old(): vector opened on level 1
D1/3: Vect_read_dblinks(): map = a, mapset = landa
D3/3: Searching for FID column in OGR DB
D1/3: dbln file: /home/martin/grassdata/nc_spm_08/landa/vector/a/dbln
D1/3: Dblinks read
D1/3: Vect_Rewind(): name = a
1
D3/3: Vect_write_line(): name = (null), format = 170241076, level = 0
ERROR: Unable to write feature, vector map is not opened
The map is opened correctly, Vect_level() works. Anyway
Vect_write_line() fails, seems to be that Map_info is corrupted. No
clue at this moment.
Martin
--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa
More information about the grass-dev
mailing list