☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Is it possible to show the scale in an OSM tile plot using bokeh?

Community Supportbokeh
sebhan21
sebhan21

I am using the OSM tile provider in bokeh to plot a basemap, here is a reference. I am wondering if there is a way to show the scale of the map in meters or kilometers depending on the zoom level.

Just to clarify, the axis labels can remain in WGS84-pseudo-mercator but I want to have a scale or some sort of ruler to give a better sense of the distances in the plot.

Here is an example image from the OSM website where I have marked the scale in the bottom left corner.

⌁   Link to post
Bryan
Bryan

A scale annotation seems like s useful thing, but no-one has ever asked for it / done it. A GitHub Issue would be appropriate to suggest it as a new feature. Otherwise you can draw one manually using the axis extents and standard glyphs and annotations (segment, text or Label, etc)

⌁   Link to post
gmerritt123
gmerritt123

AHEM :innocent: :joy:

⌁   Link to post
gmerritt123
gmerritt123

I think I did at one point, with this logic. Sorry I can’t find where I implemented it… the joys of changing employers…

  1. I created a datasource for a single line renderer whose coordinates were based on the figure extents (this would be the scale bar)
  2. It would update on zoom (via a CustomJS callback set to js_on_change for every zoom tool on the figure) so the line would always appear in the bottom left (with an offset) and the length of it would always be about 1/3rd of the x extents, rounded to a nice number.
  3. There’d be a label annotation similarly placed (just below the scale bar) that would display the current length of the scale.

Where it broke down was that it basically only worked on maps/figures where the x_scale/y_scales were the same. Having something like an “orientation” option that would make a scale bar showing a y scale bar if “vertical” and x if “horizontal” would be super slick :slight_smile:

⌁   Link to post
Bryan
Bryan

@gmerritt123 “asked for it” means “asked for it in an issue on GitHub” because that’s the only centralized place that has even a hope of being tracked over any length of time. If a request is not on GitHub, it does not exist for all practical purposes.

⌁   Link to post

End of archived discussion · Replies are disabled