Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created November 23, 2010 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/711083 to your computer and use it in GitHub Desktop.
Save tmcw/711083 to your computer and use it in GitHub Desktop.
Get bounding boxes of a
from osgeo import ogr
x = ogr.Open('110_resaved.shp')
l = x.GetLayer(0)
for j in l:
env = j.GetGeometryRef().GetEnvelope()
print "%s,%f,%f,%f,%f" % (j.GetField(2), env[0], env[1], env[2], env[3])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment