Hi Dane,

thank you very much for your response to my question! And indeed the patch
submitted by Frederik Ramm (btw: great guy, his book about openstreetmap is
brilliant!) solved the issue. It is now possible to render the data using
the UTM projection!

Thanks a lot, you saved my day :-)



Dane Springmeyer wrote:
> 
> My first guess would be that Mapnik is unable to reproject the osm data
> into UTM because the osm layers extents are not valid for UTM.
> 
> If this is the case, then this is partly a bug in Mapnik and party a
> condition of trying to project global data into a local projection. See
> the thread linked off of http://trac.mapnik.org/ticket/549 for more
> details.
> 
> Short of trying to apply that patch you could try setting the 'extent'
> parameter for all your osm layers in the osm stylesheet to:
> 
>  '11.03,49.42,11.13,49.48'
> 
> Let me know if that helps. If not let me know what osm extract you used
> and I can try to test locally.
> 
> Dane
> 
> 
> On Jun 2, 2010, at 1:24 AM, kfr wrote:
> 
>> 
>> Hello everybody!
>> 
>> I'm trying to render some maps of the same area using different
>> projections
>> in order to compare the rendered images with each other. I.e. i defined
>> an
>> area and rendered the data from that area using e.g. UTM zone XY
>> projection,
>> google projection, and so on... In order to get the job easily done i
>> wrote
>> this little python script:
>> 
>> (Note: my system is Ubuntu 10.04 as explained here 
>> http://weait.com/content/build-your-own-openstreetmap-server
>> http://weait.com/content/build-your-own-openstreetmap-server , the
>> projection definitions come from  http://www.spatialreference.org/
>> http://www.spatialreference.org/ )
>> 
>> 
>> #!/usr/bin/python
>> import mapnik
>> 
>> mapfile = "osm.xml"
>> 
>> projections = {
>>    "latlon": "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs", #
>> EPSG:4326
>>    "utm_32n": "+proj=utm +zone=32 +ellps=WGS84 +datum=WGS84 +units=m
>> +no_defs", # EPSG:32632,
>>    "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
>> }
>> 
>> ll = (11.03, 49.42, 11.13, 49.48)
>> 
>> 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(projName + ".png", "png256")
>> 
>> 
>> But here comes my problem: the UTM projection (called 'utm_32n' in the
>> script) doesn't render the image i expected! Instead i only get a
>> ocean-blue
>> image. All the other projections work fine! This is quite annoying and
>> frustrating, as the UTM projection is the most important one for my
>> project.
>> 
>> I googled through the whole internet and counldn't find any clue why the
>> UTM
>> projection won't work while all the others do...
>> 
>> So if anyone can give me a hint i would be very thankful!! Perhaps i
>> misunderstood som facts, have missed something, etc....
>> 
>> I uploaded the resulting images for all four projections:
>> 
>> longlat projection:
>> http://old.nabble.com/file/p28751475/latlon.png 
>> 
>> google projection:
>> http://old.nabble.com/file/p28751475/google.png 
>> 
>> mercator projection:
>> http://old.nabble.com/file/p28751475/mercatorworld.png 
>> 
>> utm projection:
>> http://old.nabble.com/file/p28751475/utm32n.png 
>> 
>> Greetings from Germany...
>> -- 
>> View this message in context:
>> http://old.nabble.com/Problems-with-some-Mapnik-projections-tp28751475p28751475.html
>> Sent from the Mapnik - Users mailing list archive at Nabble.com.
>> 
>> _______________________________________________
>> 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
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Problems-with-some-Mapnik-projections-tp28751475p28777331.html
Sent from the Mapnik - Users mailing list archive at Nabble.com.

_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to