Hi,

+1 for having an option of generating world files automaticly.  However, I am 
not sure if your approach would give correct world files in all cases.  I have 
undestood that Mapnik does not respect the bounding box or envelope that is 
given to it if the dimensions of bbox does not suit the output image size. 
Frederik Ramm is working on the same problem when building the Mapnik WMS 
server.  

I think there is also a minory error in your code in this:
 upper_left_y_center = extent.maxy+(scale/2)

In northern hemisphere I believe it should be upper_left_y_center = 
extent.maxy-(scale/2). But the main problem at the moment is that Mapnik may 
change your envelope without giving any information of the geographical extents 
it is really using for rendering the output map.  It is possible to control the 
extents accurately by precalculating the requested geographical extents and 
output image size to suit each other but it is a bit complicated for my mind 
and I consider it as error prone.

I suppose that developers will correct me if I am giving wrong information.

-Jukka Rahkonen-


Excerpt from Mapnik users mailing list from March 30, 2008:

> For example, if I give these ll extents in generate_image.py:
>   ll = (24.0,60.0,25.0,61.0)
>
> the resulting map actually covers this area:
> ll (23.4841,60.0,25.5117,61.0)

> I have taken the latter coordinates from Information Freeway  
> coordinate display and verified them with GPS.
>
> I have repeated this test by different ll values dozens of times  
> and the result is always the same.  Latitude values in the  
> resulting maps are the same I asked for, but not the longitude values.

Artem Pavlenko answered:

You get slightly different extent because mapnik internally adjusts  
extent to fit map into provided image dimensions.
In your case 1x1 degree square bounding box in geographical  
coordinate system translates into 'rectangular' shaped bounding box  
in Mercator with width/height ratio about 0.49318281553588506. It is  
slightly less then 0.5 and I suspect your Map object has width/ 
height=0.5

There are few ways to address this. For example, you can ensure that  
bounding box matches aspect ratio of the Map object (width, height).  
Or initialize Map object with dimensions necessary to fit your  
bounding box.

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

Reply via email to