Hi, Thanks to the help of some nice people on this forum I got nik2img working. Still the images go far over the bounding box values. nik2img.py mapnik.xml mercator1.png --srs 900913 --bbox 4 51 6 54 -d 1500 1500 -v nik2img.py mapnik.xml mercator2.png --srs 900913 --bbox 4 51 6 54 -d 500 500 -v The images start at app 2 long and reach to appr 8 long. Bottom seems valid. Top to low. This makes navigation impossible. Is there a way to really fix these borders on bbox values? Thanks. asked 25 Feb '14, 22:42 wim de vries aseerel4c26 ♦ |
The question has been closed for the following reason "The question is answered, accepting own answer is not possible here. So... closing." by aseerel4c26 26 Feb '14, 23:12
The problem arises because the dimensions of your image are square, while the projected dimensions of the bounding box are not (the rectangle you are asking to draw is more than twice as high than it is wide). If you ask Mapnik (nik2img) to put a rectangle that is much higher than wide into a square output file, it will add stuff to the east and west that you haven't asked for. Actually nik2img should tell you the box it has decided to draw in For a bbox of "4 51 6 54", you have to specify the dimensions "1500 3698" (or "500 1233") to get an image that exactly contains your bounding box. See also the If you want an output file that has the same aspect ration as the bounding box in degrees (e.g. you enter a box that is 2 degrees wide and 2 degrees high and you want a square output file) then you have to choose answered 26 Feb '14, 07:18 Frederik Ramm ♦ Thanks for your answer. I do see an output line: Step: 11 // --> Map long/lat bbox: Box2d(2.53474181678,51.0,7.46525818322,54.0) I presume that is the notification of stretching it up. I am still puzzled about the image sizes you mention. In the past I have used (downloaded) OSM maps (scale ~1:500000), but there the img height depends on which latitude you are on, while all x values having the same nr of pix size. This made navigation possible using the OSM equations (http://wiki.openstreetmap.org/wiki/Mercator). So, I want to say to nik2img: let one longitude be 795 pix; make a map like above (--bbox 4 51 6 54) with width 2x795 pix and height .... calculate it for I don't know. Do you think this would be possible?
(26 Feb '14, 11:10)
wim de vries
|
The answer is --aspect-fix-mode=GROW_CANVAS answered 26 Feb '14, 12:19 wim de vries |