Skip to content

Instantly share code, notes, and snippets.

@YenTheFirst
Created February 23, 2013 01:46
Show Gist options
  • Save YenTheFirst/5017929 to your computer and use it in GitHub Desktop.
Save YenTheFirst/5017929 to your computer and use it in GitHub Desktop.
rendering test image in python. less network traffic to database than node-mapnik for some reason.
import mapnik
mmap = mapnik.Map(0, 0)
mapnik.load_map(mmap, path_to_xml)
mmap.width = 256
mmap.height = 256
mmap.zoom_to_box(mapnik.Box2d(-9079495.967826376,2817774.6107047386,-8766409.899970295, 3130860.6785608195 ))
img = mapnik.Image(256, 256)
mapnik.render(mmap, img)
img.save("test_output.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment