Plotting an image glyph on a map figure- Help


I’m trying to plot a floating point raster image (geotif) on a bokeh map figure. I’ve created a mercator map figure and an image glyph representing my raster data. However, the image displays incorrectly on the map after launching the bokeh server. Is there a way to define a projection for the image glyph? I’ve set the image property types of x and y as coordinates corresponding to the minimum lat and long (lower left corner) after converting the coordinate values to mercator coordinates. I’ve also set the dh and dw as the rows/columns of my image.

Thanks for any help

Bokeh only really supports Web Mercator presently. You might want to chime in on this GitHub issue regarding adding some conversion functions directly to the Bokeh API.

Otherwise, to say anything specific about your particular case, we would really need a complete, minimal example that could actually be run and investigated. It’s not possible to speculate on the description above alone.

You might also want to have a look at GeoViews which has a more high level API and can use both Bokeh and MPL.

Hi Bryan, I appreciate your help on this issue and others I’ve posted about. I’ve investigated geoviews and think it may provide a solution. However, how can I add a geoviews image or element to an existing bokeh figure/map?

I see that geoviews can use bokeh backend and generate a plot. However, I already have an existing figure/plot which I need to add a georeferenced mage with a CRS to.

I think geoviews will create a dataset or image appropriate transformed for the map projection. But I don’t know how to add this back to my original bokeh figure/plot.

Edit: if my map figure is set using mercator axes and i transform my tiff image to web mercator. I initially believed this may be enough to map the image correctly. I used this approach in my first post on this topic,. However, the georeferencing of the image was incorrect on the bokeh map.

I’m not trying to convert from one CRS to another. I just need a georeferenced tif to display correctly on a bokeh map. I can use web mercator universally.

I’ve changed the cellsize of the raster to 1 and columns/rows updated to reflect the cellsize, and now it appears correctly when plotted using the image glyph method

1 Like