heatmap icon indicating copy to clipboard operation
heatmap copied to clipboard

Result image wrong resolution

Open Opostol opened this issue 7 years ago • 2 comments

heatmap.py -o photos.png --width 1000 --osm -B 0.8 --osm_base http://b.tile.stamen.com/toner photo-points

When you call this the result resolution is 915 x 357.

  1. How can i get the exact resolution? 1000 x 380(approximately) with dynamic padding(only map around without data).
  2. if both --width and --height set how can i get exactly that resolution with dynamic padding?

Opostol avatar Oct 31 '18 14:10 Opostol

It would be smart for it to grab extra tiles and pad out to the requested resolution as you describe. As you observed, it doesn't do that. A clumsy but effective workaround is to run it once, see what you get, and then run it again using --margin XXX where XXX is how much margin you need on every side. Then it will do the right thing.

For example, when I run that command on photo-points, I get an image that's 896 x 338. (I don't know why that would be different from what you got.) It's 104 pixels too narrow, so I ran it again with --margin 52 and got an image 1000 x 442, with extra map around the edges just like it should have.

So that's how to get the right thing with the current code. I agree it should do that automatically in one pass. I'll follow up here if I make that improvement.

sethoscope avatar Oct 31 '18 15:10 sethoscope

Actually even your workaround not works properly. Because changed margin on second use can affect chosen zoom level. And if it occured on second iteration we will not get requested dimension again.

I think i did proper fix in https://github.com/Opostol/heatmap. It works properly on cases that i tried to test. And also (as i understand) it can only increase requested margin if it set(but not decrease).

Opostol avatar Nov 02 '18 12:11 Opostol