komoot / staticmap

A small, python-based library for creating map images with lines, markers and polygons.
https://www.komoot.com
Other
290 stars 65 forks source link

Added support for explicit-boundary blank maps #8

Open maxvonhippel opened 7 years ago

maxvonhippel commented 7 years ago

You can now create blank maps by setting an explicit extent. To be clear, I have only added explicit extent support for blank maps. Non-blank ones are more difficult (and frankly not a feature I currently need), but if someone else wants to give it a go I'm sure it would be a good feature to have.

Here is an example, which I tested and which works:

_map = StaticMap(500, 500, url_template='http://a.tile.osm.org/{z}/{x}/{y}.png')
_map.set_extent(83.676659, 28.220671, 83.804604, 28.409901)
_img = _map.render(zoom=5)
_img.save("boxtest.png")
maxvonhippel commented 7 years ago

(addresses issue 3 and 4)

christophlingg commented 7 years ago

Thanks @maxvonhippel for this request, I haven't seen it earlier that's why I respond that late.

I can understand your use case and I am sure others will need this feature too. however I think there is an easier approach to accomplish it, with the features already implemented in this library.

Only a tiny change is needed see https://github.com/komoot/staticmap/pull/10

Do you think this would work out for you too?