Zverik / Nik4

Mapnik to image export
Do What The F*ck You Want To Public License
123 stars 23 forks source link

DPI and zoom levels #39

Open Phyks opened 5 years ago

Phyks commented 5 years ago

Hi,

I don't get how zoom level is computed. I would have expected

python ./nik4.py --dpi 600 -a 4 --fit route --add-layers route ../cyclosm-cartocss-style/mapnik.xml a4.png --vars gpxroute=/tmp/route.gpx

and

python ./nik4.py --dpi 300 -a 2 --fit route --add-layers route ../cyclosm-cartocss-style/mapnik.xml a2.png --vars gpxroute=/tmp/route.gpx

and

python ./nik4.py --factor 2 --dpi 600 -a 4 --fit route --add-layers route ../cyclosm-cartocss-style/mapnik.xml a4.png --vars gpxroute=/tmp/route.gpx

to give the same output as an A2 paper is twice an A4 paper in each dimension.

Changing factor and DPIs gives the same result (that is a wider image but showing the same thing, at the same zoom level, as a --dpi 300 -a 4 image). Switching to A2 paper size however gets a different result, with a different zoom level in use. However, all of the generated images (A4 or A2 with the above commands) do have the same number of pixels.

Why does dpi does not have any effect on the zoom level in use?

Thanks!