[GRASS-dev] bound_box in python

Markus Neteler neteler at osgeo.org
Mon Jun 1 05:59:12 EDT 2009


On Sun, May 31, 2009 at 3:53 PM, Markus Neteler <neteler at osgeo.org> wrote:
> 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)

It has been fixed in SVN of 6.4, 6.5 and 7. Now
access to vector boxes is possible.

Here a simple example:
see also swig/python/examples/vectoraccess.py

# vector box tests
box = grassvect.bound_box()
c_easting1  =  599505.0
c_northing = 4921010.0
c_easting2  =  4599505.0

grassvect.Vect_get_map_box(map, box)
print 'Position 1 in box? ', grassvect.Vect_point_in_box(c_easting1,
c_northing, 0, box)
print 'Position 2 in box? ', grassvect.Vect_point_in_box(c_easting2,
c_northing, 0, box)
print 'Vector line 2 in box? ', grassvect.Vect_get_line_box(map, 2, box)

Markus


More information about the grass-dev mailing list