I am trying to use bokeh to display a map in an equirectangular, WGS84 reference frame (epsg:4326). I’m using WMTSTileSource to point to the epsg:4326 tile server. It displays a portion of the map, but the projection and scale are wrong. I can’t find a way to declare any other crs/projection for the tiles so it assumes everything is web mercator (epsg:3857). I do know how to transform coordinates between projections using pyproj, but I don’t know how to change the basemap projection.
Is it possible to use any other projections for basemap tiles with bokeh?
Here is my code that illustrates the problem by overlaying the WGS84 map on top of the web mercator map.
from bokeh.plotting import figure, output_file, show
from bokeh.models import WMTSTileSource
from pyproj import Proj, transform
output_file('map.html',mode='inline')
# web mercator coordinates
low_left=transform(Proj(init='epsg:4326'), Proj(init='epsg:3857'), -179, -80)
top_right=transform(Proj(init='epsg:4326'), Proj(init='epsg:3857'), 179, 80)
x_range,y_range = ((low_left[0],top_right[0]), (low_left[1],top_right[1]))
p = figure(tools='pan, wheel_zoom', x_range=x_range, y_range=y_range, x_axis_type="mercator", y_axis_type="mercator")
url1 = 'http://a.basemaps.cartocdn.com/rastertiles/voyager/{Z}/{X}/{Y}.png'
url2 = 'https://services.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer/tile/{z}/{y}/{x}.png'
p.add_tile(WMTSTileSource(url=url1),alpha=1)
p.add_tile(WMTSTileSource(url=url2),alpha=.5)
show(p)
I also created an similar example in replit with flask.