Using WMTSTileSource with EPSG:4326 Projection

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


# 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 = '{Z}/{X}/{Y}.png'
url2 = '{z}/{y}/{x}.png'



I also created an similar example in replit with flask.

Have you tried Geoviews? Supposed to be able to use it in different projections: Projections — GeoViews 1.9.1+g33876c8-dirty documentation

I’d like to use it in 4326 as well, or even better, a Cartesian projection like a UTM. It would be nice to have the tiles work as a basemap but not have to be in Web Mercator. I’d be curious if you get 4326 to work with Geoviews and the tiles working too.

I looked at geoviews, but was hoping that bokeh could do the projections natively.
The concerns I have with geoviews are that the syntax doesn’t seem intuitive and the documentation isn’t as complete, so I wasn’t sure how to add a custom tile source and specify its projection.
On top of that, I haven’t even been able to install geoviews successfully, but those issues are more appropriate for a geoviews forum.
I’ll try to get it to work with geoviews, but if anyone knows a better way, let me know.