Lähettäjä: [EMAIL PROTECTED] puolesta: Artem Pavlenko

> On 30 Mar 2008, at 22:02, Rahkonen Jukka wrote:

>> Hi,
>>
>> I stopped my trials with rendering OSM maps to epsg:2393 projection  
>> with Mapnik and generate_image.py utility.
>> Instead, I have been trying to learn first how to make maps in  
>> default epsg:900913 projection.  Unfortunately, however closely I  
>> try to follow the instructions I am always getting maps which have  
>> different east-west extents than I am giving as parameters in the  
>> generate_image.py script.
>>
>> My environment:
>> - Python 2.5
>> - Mapnik Windows binaries from:
>> http://download.berlios.de/mapnik/mapnik_win32_py25-0.5.0.zip)
>> - Generate_image.py downloaded from:
>> http://svn.openstreetmap.org/applications/rendering/mapnik/ 
>> generate_image.py)
>> - OSM data downloaded from:
>> http://download.geofabrik.de/osm/europe/finland.osm.bz2
>> - OSM data uploaded to PostGIS with osm2pgsql.exe (WIndows binaries)
>> Upload done with options:
>> osm2pgsql -d postgis -p osm_g -m finland.osm.bz2
>> - osm.xml downloades from:
>> http://svn.openstreetmap.org/applications/rendering/mapnik/osm.xml
>>
>> In addition I have downloaded and installed symbol files, shoreline  
>> data and World boundaries as advised in:
>> http://svn.openstreetmap.org/applications/rendering/mapnik/install.txt
>>
>> All I have changed are PostGIS database connection parameters and  
>> paths to shapefiles.  The system works with all the layers and I  
>> can generate maps.  The problem is that the resulting maps do not  
>> have the same extents as I give in the generate_image.py file as  
>> input parameters.
>>
>> 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.
>>
>> Is there anybody out there who could verify if there really is some  
>> faulty coordinate transformation used for converting longitudes or  
>> am I just doing something wrong?
>>
>> -Jukka Rahkonen-


> 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.

> HTH
> Cheers
> Artem

Allright, I start to understand finally.  I was blind in my belief that
generate_image.py would respect both the bounding box and output image
size by scaling the pixel x- and y-dimensions.  Obviously I have 
been playing too long with only MapServer and WMS services. The difference 
was not so easy to see while I used width/height ratio of 0.5.  Only when
I used ratio of 1:1 and a map that I supposed to be 1 degree wide was 
actually more than 2 degrees I really started to think that there must
be something wrong. Perhaps I should have understood this by reading 
very carefully the documentation included in generate_image.py:
# Tweak the lat/lon bounding box (ll) and image dimensions
# to get an image of arbitrary size.

I am now somewhat satisfied.  I know how to generate images approximately 
from the place I want to and I can calibrate the map afterwards to suit 
the reality.  This is enough for making Mapnik maps which can be used with 
OziExplorer on PDA.  It is not very fluent work flow but I think that
with my talents I cannot do any better.  My goal is to be able to generate
accurately gereferenced maps in any projection to be used for moving map 
navigation and in GIS software.  I believe I will have a faster start 
with MapServer which I know better but I will come back to Mapnik some 
other day.  Thanks for the help so far.

-Jukka Rahkonen-


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

Reply via email to