output_headers("image/jpeg", "map.jpg", len(jpeg))
sys.stdout.write(jpeg)
elif form.getvalue("format") == "svg":
- file = tempfile.NamedTemporaryFile()
+ file = tempfile.NamedTemporaryFile(prefix = "export")
surface = cairo.SVGSurface(file.name, map.width, map.height)
mapnik.render(map, surface)
surface.finish()
output_headers("image/svg+xml", "map.svg", file_size(file))
output_file(file)
elif form.getvalue("format") == "pdf":
- file = tempfile.NamedTemporaryFile()
+ file = tempfile.NamedTemporaryFile(prefix = "export")
surface = cairo.PDFSurface(file.name, map.width, map.height)
mapnik.render(map, surface)
surface.finish()
output_headers("application/pdf", "map.pdf", file_size(file))
output_file(file)
elif form.getvalue("format") == "ps":
- file = tempfile.NamedTemporaryFile()
+ file = tempfile.NamedTemporaryFile(prefix = "export")
surface = cairo.PSSurface(file.name, map.width, map.height)
mapnik.render(map, surface)
surface.finish()