Seems to be an off-by-one error in mapbox staticimage
Closed this issue · 4 comments
What you've tried already
MapBox supports static image export with image dimensions up to 1280x1280†. But when --size 1280 1280
is passed, an error message is printed that complains the size is out of range.
† modulo Retina rendering
Expected outcome
I expect this:
mapbox staticmap --lon -73.973615 --lat 40.765809 --size 1280 1280 --zoom 10 'mapbox.satellite' out.png
To save an image of size 1280x1280 to out.png.
Actual outcome
Instead, I see this error:
Error: Invalid value: Image height and width must be between 1 and 1280
The same command line works as expected when using --size 1279 1279
, which saves a 1279x1279 PNG to out.png
Other information
mapbox --version
is 0.7.0- Operating System : Mac OS X
- Python version number : whatever is used by the Homebrew wrapper (2.7.13, I think, not sure how to check for sure)
- How did you install the mapbox cli? Homebrew, pip, other? :
brew install mapbox/cli/mapbox
/usr/local/Cellar/mapbox/0.7.0 (2,392 files, 42.6MB) *
Built from source on 2017-05-25 at 19:11:34
From: https://github.com/mapbox/homebrew-cli/blob/master/Formula/mapbox.rb
Found it, I think: https://github.com/mapbox/mapbox-sdk-py/blob/a7963453f3f00cc43e96ea44ad2a5ca907146995/mapbox/services/static.py#L30
Ought to be 1 <= val <= 1280
, I believe.
@tomjakubowski good catch! Would you be willing to create a PR for that change so you get proper github credit? Otherwise, I can make the change myself. Either way, let's get it in the next release. Thanks.
@perrygeo I came across this issue and didn't see an open PR and so I have sent a PR for the same.
Marking this one fixed. The fix will be in version 0.14 of the mapbox package.