Enhance image resolution based on zoom level


I am trying to build a map from scratch using a map image.

I used the fig.add_layout_image function to add the base map, but the image I used is too big and the function plots all its pixels in one shot, which makes the plot lag a lot.

What I am aiming for is plotting the image with a different resolution based on how much the user zooms in the map.

Is there a way to do this?

My first thought was to have a callback function that returns the axes ranges after zooming and updates the plot with more pixels of the image. Although I haven’t found a method to return the axes ranges yet.

Any help would be appreciated a lot. :slightly_smiling_face:

Hi Abdullah, you can use the relayoutData of the dcc.Graph object to retrieve info about ho the user interacted with the graph. On a Cartesian graph it should contain X and y ranges.

1 Like