Map questions

Hi, I have two somewhat related questions.

One: I just went through this thread/request add tile providers for OpenStreetMap and ESRI Imagery · Issue #9560 · bokeh/bokeh · GitHub , and am hoping to get confirmation that I will be able to use esri openstreets/satellite imagery as a tile provider in the upcoming 2.0 release. Is this a “done deal” or is there anything I can do to help get this going?

Two: Is there any built in function for plotting a scale bar and north arrow on figures, or an easy way to go about generating them? I have hacked up an ugly solution plotting a horizontal line from point A to point B on the map, but ideally it would change scale size based on zoom level - same would go with the north arrow’s location and size.

As always all advice/help greatly appreciated!

Being specific, with 2.0 you will be able to use the things that were merged in #9582, which are:

OSM='https://c.tile.openstreetmap.org/{Z}/{X}/{Y}.png',
WIKIMEDIA='https://maps.wikimedia.org/osm-intl/{Z}/{X}/{Y}@2x.png',
ESRI_IMAGERY='https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{Z}/{Y}/{X}.jpg'

Is there any built in function for plotting a scale bar and north arrow on figures, or an easy way to go about generating them

There’s nothing currently built in to the library. For things that automatically update as you describe a proper annotation with a BokehJS implementation is needed. Feel free to make an issue on GitHub to discuss for future development. In the more immediately term, you could potentially make a Custom Extension for it.

1 Like

Excellent thanks. If I find some time I will try to develop something for a scale bar/north arrow. First thing I can think I’d need is a JS callback to get the current figure extents - does this exist?

I’m not quite sure what you are asking for: HTML canvas pixel extents, or pixel extents for the inner plot “frame”, or the data range start/end. Or in what context you want them. If you are implementing a Custom Extension then there is no JS callback in general, there is just the JS code that actually implements the extension.

I’m thinking that if I can get the current x_range and y_range of the figure, I can inform how big to draw the scale bar and what units to use etc. That x_range and y_range changes dynamically with wheel zoom etc. Sorry, I hope that’s clearer.