[GRASS-dev] bound_box in python

Markus Neteler neteler at osgeo.org
Sun May 31 09:53:20 EDT 2009


On Sun, May 31, 2009 at 12:45 PM, Danho Fursy Rodelec Neuba
<danho_f at yahoo.fr> wrote:
> Can you tell me howto use bound_box in python. I am new in grass
> developping and i use python. I need to use Vect_get_map_box and
> bound_box* type is requiered.

In theory it should be

import os, sys
from grass.lib import grass
from grass.lib import vector as grassvect
...
grassvect.Vect_get_map_box(map, box)

but I (also) failed to define

box = grassvect.bound_box()

I have added that locally to
swig/python/examples/vectoraccess.py

but I get
Traceback (most recent call last):
  File "examples/vectoraccess.py", line 45, in <module>
    print 'Map box:', grassvect.Vect_get_map_box(map, box)
TypeError: in method 'Vect_get_map_box', argument 2 of type 'BOUND_BOX *'

Using instead BOUND_BOX, it also fails:
Traceback (most recent call last):
  File "examples/vectoraccess.py", line 32, in <module>
    box = grassvect.BOUND_BOX()
AttributeError: 'module' object has no attribute 'BOUND_BOX'

?

@developers:
Looking at the GRASS includes, I see
include/vect/dig_structs.h:#define BOUND_BOX struct bound_box

Is there a strategic advantage to define 'struct bound_box' like this while
for example 'struct Map_info' isn't defined as MAP_INFO in the Vector
libs?

Markus


More information about the grass-dev mailing list