示例#1
0
svg = False

if svg:
    import cairo


style = MapCSS(1, 19)     #zoom levels
style.parse(open("styles/default.mapcss","r").read())


bbox = (27.115768874532,53.740327031764,28.028320754378,54.067187302158)

w,h = 630*4,364*4
z = 10

db = DataBackend()
#style = Styling()

res = RasterTile(w, h, z, db)
if svg:
    file = open("test.svg", "wb")
    res.surface = cairo.SVGSurface(file.name, w,h)
res.update_surface(bbox, z, style)


if not svg:
    res.surface.write_to_png("test.png")
else:
    res.surface.finish()
示例#2
0
#from style import Styling
from mapcss import MapCSS

from render import RasterTile

svg = False

if svg:
    import cairo

style = MapCSS(1, 19)  #zoom levels
style.parse(open("styles/default.mapcss", "r").read())

bbox = (27.115768874532, 53.740327031764, 28.028320754378, 54.067187302158)

w, h = 630 * 4, 364 * 4
z = 10

db = DataBackend()
#style = Styling()

res = RasterTile(w, h, z, db)
if svg:
    file = open("test.svg", "wb")
    res.surface = cairo.SVGSurface(file.name, w, h)
res.update_surface(bbox, z, style)

if not svg:
    res.surface.write_to_png("test.png")
else:
    res.surface.finish()