[GRASS-dev] access to grass (trunk 7.0.svn ) vector map from python

Fernando Pacheco fernando.pacheco at ingesur.com.uy
Tue Jun 15 13:10:14 EDT 2010


Woks!. Thank you. Fernando.

Ing. Fernando Pacheco M.S.L.

Ingesur srl
Dirección: Requena 1062 ap.302, Montevideo, Uruguay.
Teléfonos: (+598 2) 408 90 48, (+598 9) 962 79 32
Web: http://ingesur.com.uy/


On Tue, Jun 15, 2010 at 1:56 PM, Glynn Clements <glynn at gclements.plus.com>wrote:

>
> Fernando Pacheco wrote:
>
> > I'm trying to access a grass vector map with python (2.6). I'm using the
> svn
> > version (revision 42 565) but keep getting "Segmentation fault" when
> trying
> > to open the file with Vect_open_old (map, input, mpaset). The code I'm
> using
> > can be found here: http://osgeo.pastebin.com/VLGunxyq
> > Can you please tell me I'm doing wrong (the same code works well with
> python
> > libraries generated with SWIG)?.
>
> There are two problems, one in your code, one in the ctypes wrappers.
>
> First, Vect_open_old needs a pointer to a a Map_info structure, not
> the structure itself, so you need to use byref(), e.g.:
>
>        from ctypes import *
>
>        ...
>
>        vector.Vect_open_old(byref(map), input, mapset)
>
> Second, if LFS is enabled, any files which use the vector structures
> are compiled with -D_FILE_OFFSET_BITS=64. This wasn't being passed to
> the preprocessor when the ctypes wrappers were generated, resulting in
> incorrect wrappers being generated for various structures, including
> the Map_info structure. This should be fixed by r42566.
>
> --
> Glynn Clements <glynn at gclements.plus.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20100615/61bbc3ca/attachment.html


More information about the grass-dev mailing list