Which version of Mapnik are you using? Artem
On 21 July 2011 11:42, Reinhold Klatt <[email protected]> wrote: > Hi all, > I'm trying to render maps in a conic projection. The problem is, that i get > a blank image as result. > If I generate in mercator or latlon there is no problem. I get what I want. > But I can't generate anything in a conical projection. > I modified a script I found, to test different projections. Does anybody > know why it's not working? What's my mistake? Are there parameters that have > to be set? > > Thankyou in advance > > > #!/usr/bin/python > import mapnik > > mapfile = "style9_nodem.xml" > > projections = { > "latlon": "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs", #EPSG:4326 > "google": "+proj=merc +lon_0=0 +lat_ts=0 +x_0=0 +y_0=0 +a=6378137 > +b=6378137 +units=m +no_defs", # SR-ORG:95 > "mercator_world": "+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 > +datum=WGS84 +units=m +no_defs", # SR-ORG:16 > "lambert": "+proj=lcc +lat_1=49.83333333333334 +lat_2=51.16666666666666 > +lat_0=90 +lon_0=0 +x_0=150000 +y_0=5400000 +ellps=intl +pm=brussels > +units=m +no_defs", > "albert": "+proj=aea +lat_1=29.83333333333334 +lat_2=45.83333333333334 > +lat_0=37.5 +lon_0=-96 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m > +no_defs", > "pytest": "+proj=lcc +lat_1=45.89893890000052 +lat_2=47.69601440000037 > +lat_0=46.8 +lon_0=2.33722917 +x_0=600000 +y_0=200000 +a=6378249.145 > +b=6356514.96582849 +pm=2.337229167 +units=m +no_defs", > } > > ll = (8.487, 49.9857, 8.6237, 50.0622) > > imgx = 1000 > imgy = 1000 > > # Render an image for every projection > for projName, projDef in sorted(projections.items()): > > print "Projection: " + projName > > # Load the map data > m = mapnik.Map(imgx, imgy) > mapnik.load_map(m, mapfile) > > # Override projection defined in osm.xml > m.srs = projDef > > # Calculate projected boundaries > prj = mapnik.Projection(projDef) > c0 = prj.forward(mapnik.Coord(ll[0], ll[1])) > c1 = prj.forward(mapnik.Coord(ll[2], ll[3])) > > # Apply bounding box > bbox = mapnik.Envelope(c0.x, c0.y, c1.x, c1.y) > m.zoom_to_box(bbox) > > # Render image > im = mapnik.Image(imgx, imgy) > mapnik.render(m, im) > view = im.view(0, 0, imgx, imgy) > view.save("img/" + projName + ".png", "png256") > > > _______________________________________________ > Mapnik-users mailing list > [email protected] > https://lists.berlios.de/mailman/listinfo/mapnik-users > _______________________________________________ Mapnik-users mailing list [email protected] https://lists.berlios.de/mailman/listinfo/mapnik-users

