Created
May 16, 2013 17:59
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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