Hi Dane, Thanks for your help. I missunderstood something. I thought that mapnik 0.7.1 was able to handle the conic projections. I have to setup a separate system to run my project with mapnik2. I will report about my expirinces;)
Reinhold On 21.07.2011 23:22 Uhr, "Dane Springmeyer" <[email protected]> wrote: > Reinhold, > > I just ran through your test script and confirmed that I get nice output for > all the projections listed with Mapnik2 (trunk) > > However, the script needs to use mapnik.ProjTransform to handle forwarding the > bbox that is used, otherwise a bogus bbox can be sent to mapnik (and of course > that would lead to a blank map). > > I tested with an osm stylesheet referencing data imported into postgres in > spherical mercator projection. > > Fixed up script is here: https://gist.github.com/1098240 > > Dane > > On Jul 21, 2011, at 1:10 PM, Dane Springmeyer wrote: > >> Reinhold, >> >> Artem and I just connected on this via skype. We have some fixes for this >> issue in Mapnik2 (current trunk) and are *not* planning on backporting them >> to 0.7.x. >> >> Are you able to upgrade to the development version of Mapnik? >> >> Dane >> >> On Jul 21, 2011, at 7:52 AM, Reinhold Klatt wrote: >> >>> >>> ------ Forwarded Message >>> From: Reinhold Klatt <[email protected]> >>> Date: Thu, 21 Jul 2011 14:41:22 +0200 >>> To: Artem Pavlenko <[email protected]> >>> Conversation: [Mapnik-users] Mapnik and conic projectionsP >>> Subject: Re: [Mapnik-users] Mapnik and conic projectionsP >>> >>> Hi Artem, >>> >>> I'm using the version 0.7.1 from mapnik.org >>> >>> Reinhold >>> >>> >>> On 21.07.2011 14:23 Uhr, "Artem Pavlenko" <[email protected]> wrote: >>> >>>> 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 >>>>> >>>> >>> >>> ------ End of Forwarded Message >>> >>> >>> _______________________________________________ >>> 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

