[GRASS-user] finding bounding box of polygons

Jose Gomez-Dans jgomezdans at gmail.com
Thu Sep 27 17:58:42 EDT 2007


Hi,

On 9/27/07, Jerry Nelson <gnelson at uiuc.edu> wrote:
> I'd like to construct a list of the bounding box coordinates for all the
> polygons in a vector file. I could find nothing in the manual that seemed to
> do that. Any tips appreciated.

Not a GRASS-centric response :), but if it is just a box you're after,
you can probably use ogrinfo for this, as it gives you the Extent of
your file. As an example, using it with the world.shp Shapefile
results in:
$ ogrinfo -so python/world.shp world
INFO: Open of `python/world.shp'
      using driver `ESRI Shapefile' successful.

Layer name: world
Geometry: Polygon
Feature Count: 244
Extent: (-180.000000, -89.900000) - (180.000000, 83.674733)
Layer SRS WKT:
(unknown)
NAME: String (40.0)
CAPITAL: String (64.0)
APPROX: Real (15.0)
AREA: Real (20.15)
SOURCETHM: String (16.0)

Hope that helps




More information about the grass-user mailing list