Hi everyone,
Please excuse such a rudimentary question here but I am struggling
with a simple scaling issue.
I am using the following code. Its all good I render a beautiful map.
But I am not sure what I am doing
with the scale.
Say I set imgx at 4000 how do I know exactly what imgy should be.
for example If imgy = 20000 the map into a really stretched along the
y axis. But I want to just render
my chosen selection accurately.
Any basic help or links would be really appreciated.
Many thanks
Simon
#!/usr/bin/python
import mapnik
import sys, os
import cairo
if __name__ == "__main__":
try:
mapfile = os.environ['MAPNIK_MAP_FILE']
except KeyError:
mapfile = "osm.xml"
map_output = 'manchester4000exp.svg'
#---------------------------------------------------
# Change this to the bounding box you want
ll = (-2.25575, 53.4859, -2.22755, 53.46748)
#---------------------------------------------------
imgx = 4000
imgy = 6135
m = mapnik.Map(imgx,imgy)
mapnik.load_map(m,mapfile)
prj = mapnik.Projection("+proj=merc +a=6378137 +b=6378137
+lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgri...@null
+no_defs +over")
c0 = prj.forward(mapnik.Coord(ll[0],ll[1]))
c1 = prj.forward(mapnik.Coord(ll[2],ll[3]))
bbox = mapnik.Envelope(c0.x,c0.y,c1.x,c1.y)
m.zoom_to_box(bbox)
file = open(map_output, 'wb')
surface = cairo.SVGSurface(file.name, imgx, imgy)
mapnik.render(m, surface)
surface.finish()
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users