Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Created May 16, 2013 17:59
Show Gist options
  • Save springmeyer/5593688 to your computer and use it in GitHub Desktop.
Save springmeyer/5593688 to your computer and use it in GitHub Desktop.
Example demonstrating collecting a list of points into a mapnik.Box2d and then slightly expanding it
import mapnik
points = [[-122,48],[-120,45],[-90,43]]
bbox = None
for idx, point in enumerate(points):
if idx == 0:
bbox = mapnik.Box2d(point[0],point[1],point[0],point[1])
else:
bbox.expand_to_include(mapnik.Coord(point[0],point[1]))
print 'bbox inclusive of all points'
print bbox
bbox *= 1.1
print 'bbox inflated slightly, by 1.1 times'
print bbox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment