Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result image wrong resolution #58

Open
Opostol opened this issue Oct 31, 2018 · 2 comments
Open

Result image wrong resolution #58

Opostol opened this issue Oct 31, 2018 · 2 comments

Comments

@Opostol
Copy link

Opostol commented Oct 31, 2018

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?
@sethoscope
Copy link
Owner

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.

Opostol added a commit to Opostol/heatmap that referenced this issue Nov 2, 2018
fix on this:
sethoscope#58

We ignore margin requirement and increase it to fit exact image dimension if it required(i suppose margin can only be increased, but not sure). Also fix not works it we not split common padding variable on padding.x and padding.y
@Opostol
Copy link
Author

Opostol commented Nov 2, 2018

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

hugovk pushed a commit to hugovk/heatmap that referenced this issue Sep 27, 2019
fix on this:
sethoscope#58

We ignore margin requirement and increase it to fit exact image dimension if it required(i suppose margin can only be increased, but not sure). Also fix not works it we not split common padding variable on padding.x and padding.y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants