MatthewDaws / TileMapBase

Use OpenStreetMap tiles as basemaps in python / matplotlib
MIT License
89 stars 20 forks source link

Zooming in #28

Open workKan opened 2 years ago

workKan commented 2 years ago

Greetings!

I am using your project to add basemap for matplotlib. Is there a solution with your project to handle zooming in?

Without enough "width" it is not precise enough, although with too much "width" the performance decreases greatly for example when showing the plot.

Thank you in advance!

pseyfert commented 1 year ago

Not sure it is of great help, but i was now trying this

https://github.com/pseyfert/fitfile-jugglers/commit/2f17db56dfc79eab13200909a018b46f2c528156

add a callback handler to my axes object, such that when i zoom in, I can query the new xlim and ylim, and redraw the map. (and then I also redraw everything that is plotted on top of the map, so you can probably ignore half of the lines of code)

It still feels slow, and I don't seem to be able to zoom out but maybe you can use it as a starting point.

(Since there is a lot of unrelated stuff in my commit, maybe also https://stackoverflow.com/a/31491515 helps for a more minimal example of adding a callback and handle zooming.