Map tile and x values limits


I have a bokeh figure which use x_axis_type=“mercator” and y_axis_type=“mercator”.
When I don’t use tile I obtain this map

As you can see the figure is encapsulated by the xmin,ymin, xmax and ymax values of my map.
Now, and with the same map, if I add a tile, esri for instance, I get this:

As you can see some value seems to be added to xmin and xmax.
Why this happen and is there a solution to remove it ? :face_with_monocle:
By advance thank you.
PS:By the way Bokeh gives very beautiful map :muscle:


I don’t know if this is related. I use “None” as the tile provider and the map works fine without any distortion.


In case you want to borrow some code:

thanks for the code. I didn’t know Pandas-Bokeh.
My problem is a boundary problem. I use total_bounds from my geopandas
to access the x and y limits of my map and use x_range in my bokeh figure.
But Bokeh figure seems to add an offset to this limit when tile is used …

It is a bit hard to speculate without a minimal reproducible example. The perspective I can add is that in the apps where I use an ESRI tile provider with bokeh I do the following to set up tile-with-overlay-plot graphics

  1. do not explicitly set x_range or y_range, i.e. use the default behavior here
  2. set match_aspect=True (in order to preserve the aspect ratio for my case where I am dynamically overlaying vehicle flight paths on the map)

With that in mind, is it the case that the extra buffer to the left/right of the map area of interest is due to wanting to preserve the correct aspect ratio? If you change the width/height parameters of your plot do these buffers follow suit?


Thanks for your reply.
You are right, Bokeh is trying to keep the aspect ratio and this take into account the plot_width, plot_height, x_range, y_range and the total_bounds calculation from geopandas should be in the loop somehow … I will try to find where this is implemented.
By the way plot_width=plot_height seems to give a better rendered.
thanks for you tips :pray: