BBoxTileSource not rendering WMS imagery

I’m trying to add a BBoxTileSource in Bokeh where the imagery is exposed via WMS, so I’m testing against the USGS Topo data. Here is my app:

#! /usr/bin/env python

···

import sys
import logging
from bokeh.plotting import figure
from bokeh.layouts import row
from bokeh.models import ColumnDataSource, Range1d, BBoxTileSource
from bokeh.models.renderers import TileRenderer
from bokeh.io import curdoc

logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)

USGS TOPO

url = (‘https://basemap.nationalmap.gov/arcgis/services/
‘USGSTopo/MapServer/WMSServer?service=WMS’
‘request=GetMap&version=1.3.0&BGCOLOR=0xFFFFFF&&format=image/bmp’
‘crs={crs}&layers={layer}&width={width}&height={height}’)

USGS Test

crs = ‘EPSG:3857’
xmin = -8904681
ymin = 3863947
xmax = -8894269
ymax = 3870320

layer = ‘0’
width = 900
height = 600

url_set = url.format(crs=crs, width=width, height=height, layer=layer) +
‘&bbox={XMIN},{YMIN},{XMAX},{YMAX}’

x_range = Range1d(start=xmin, end=xmax, bounds=None)
y_range = Range1d(start=ymin, end=ymax, bounds=None)

fig = figure(tools=‘wheel_zoom,pan’,
x_range=x_range,
lod_threshold=None,
plot_width=width,
plot_height=height,
background_fill_color=‘white’,
y_range=y_range,)
# x_axis_type=“mercator”,
# y_axis_type=“mercator”)

tile_source = BBoxTileSource(url=url_set)
fig.add_tile(tile_source)

Some Testing glyphs

source = ColumnDataSource(
data=dict(lat=[ymin, ymin, ymax, ymax ],
lon=[xmin, xmax, xmin, xmax ])
)

fig.circle(x=“lon”, y=“lat”, size=15, fill_color=“blue”, fill_alpha=0.8,
source=source)

layout = row(fig)
curdoc().add_root(layout)
curdoc().title = “WMS Viewer”

``

When I view the app the points are displayed, but the tiles are not, and I get no errors anywhere. Any idea what I’m doing wrong here?

System Specs:

  • Ubuntu 16.04
  • python 3.6
  • Bokeh 0.12.15
    Installed via conda:
    conda create -n wms-env bokeh python=3.6 -c conda-forge

``

Looks like there was a typo in my url formatting, it should be:
url = ('[https://basemap.nationalmap.gov/arcgis/services/](https://basemap.nationalmap.gov/arcgis/services/)' 'USGSTopo/MapServer/WMSServer?service=WMS' 'request=GetMap&version=1.3.0&BGCOLOR=0xFFFFFF&&format=image/png&' 'crs={crs}&layers={layer}&width={width}&height={height}')

``

When I use that I get the following console error in firefox when I try to pan/zoom:

···

On Tuesday, April 17, 2018 at 1:52:10 PM UTC-7, Ryan McCarthy wrote:

I’m trying to add a BBoxTileSource in Bokeh where the imagery is exposed via WMS, so I’m testing against the USGS Topo data. Here is my app:

#! /usr/bin/env python

import sys
import logging
from bokeh.plotting import figure
from bokeh.layouts import row
from bokeh.models import ColumnDataSource, Range1d, BBoxTileSource
from bokeh.models.renderers import TileRenderer
from bokeh.io import curdoc

logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)

USGS TOPO

url = (‘https://basemap.nationalmap.gov/arcgis/services/
‘USGSTopo/MapServer/WMSServer?service=WMS’
‘request=GetMap&version=1.3.0&BGCOLOR=0xFFFFFF&&format=image/bmp’
‘crs={crs}&layers={layer}&width={width}&height={height}’)

USGS Test

crs = ‘EPSG:3857’
xmin = -8904681
ymin = 3863947
xmax = -8894269
ymax = 3870320

layer = ‘0’
width = 900
height = 600

url_set = url.format(crs=crs, width=width, height=height, layer=layer) +
‘&bbox={XMIN},{YMIN},{XMAX},{YMAX}’

x_range = Range1d(start=xmin, end=xmax, bounds=None)
y_range = Range1d(start=ymin, end=ymax, bounds=None)

fig = figure(tools=‘wheel_zoom,pan’,
x_range=x_range,
lod_threshold=None,
plot_width=width,
plot_height=height,
background_fill_color=‘white’,
y_range=y_range,)
# x_axis_type=“mercator”,
# y_axis_type=“mercator”)

tile_source = BBoxTileSource(url=url_set)
fig.add_tile(tile_source)

Some Testing glyphs

source = ColumnDataSource(
data=dict(lat=[ymin, ymin, ymax, ymax ],
lon=[xmin, xmax, xmin, xmax ])
)

fig.circle(x=“lon”, y=“lat”, size=15, fill_color=“blue”, fill_alpha=0.8,
source=source)

layout = row(fig)
curdoc().add_root(layout)
curdoc().title = “WMS Viewer”

``

When I view the app the points are displayed, but the tiles are not, and I get no errors anywhere. Any idea what I’m doing wrong here?

System Specs:

  • Ubuntu 16.04
  • python 3.6
  • Bokeh 0.12.15
    Installed via conda:
    conda create -n wms-env bokeh python=3.6 -c conda-forge

``

Hi,

This is probably one of the more disused/dusty parts of Bokeh, so unfortunately that makes it susceptible to regressions (especially since the original author is no longer contributing). At this point I would suggest a GitHub bug report, with a *complete* reproduce to investigate.

Thanks,

Bryan

···

On Apr 17, 2018, at 14:30, [email protected] wrote:

Looks like there was a typo in my url formatting, it should be:
url = ('https://basemap.nationalmap.gov/arcgis/services/'
       'USGSTopo/MapServer/WMSServer?service=WMS'
       'request=GetMap&version=1.3.0&BGCOLOR=0xFFFFFF&&format=image/png&'
       'crs={crs}&layers={layer}&width={width}&height={height}')

When I use that I get the following console error in firefox when I try to pan/zoom:
<Auto Generated Inline Image 1.png>

On Tuesday, April 17, 2018 at 1:52:10 PM UTC-7, Ryan McCarthy wrote:
I'm trying to add a BBoxTileSource in Bokeh where the imagery is exposed via WMS, so I'm testing against the USGS Topo data. Here is my app:

#! /usr/bin/env python
#
#
import sys
import logging
from bokeh.plotting import figure
from bokeh.layouts import row
from bokeh.models import ColumnDataSource, Range1d, BBoxTileSource
from bokeh.models.renderers import TileRenderer
from bokeh.io import curdoc

logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)

# USGS TOPO
url = ('https://basemap.nationalmap.gov/arcgis/services/&#39;
       'USGSTopo/MapServer/WMSServer?service=WMS'
       'request=GetMap&version=1.3.0&BGCOLOR=0xFFFFFF&&format=image/bmp'
       'crs={crs}&layers={layer}&width={width}&height={height}')

# USGS Test
crs = 'EPSG:3857'
xmin = -8904681
ymin = 3863947
xmax = -8894269
ymax = 3870320

layer = '0'
width = 900
height = 600

url_set = url.format(crs=crs, width=width, height=height, layer=layer) + \
          '&bbox={XMIN},{YMIN},{XMAX},{YMAX}'

x_range = Range1d(start=xmin, end=xmax, bounds=None)
y_range = Range1d(start=ymin, end=ymax, bounds=None)

fig = figure(tools='wheel_zoom,pan',
              x_range=x_range,
              lod_threshold=None,
              plot_width=width,
              plot_height=height,
              background_fill_color='white',
              y_range=y_range,)
              # x_axis_type="mercator",
              # y_axis_type="mercator")

tile_source = BBoxTileSource(url=url_set)
fig.add_tile(tile_source)

# Some Testing glyphs
source = ColumnDataSource(
    data=dict(lat=[ymin, ymin, ymax, ymax ],
              lon=[xmin, xmax, xmin, xmax ])
)

fig.circle(x="lon", y="lat", size=15, fill_color="blue", fill_alpha=0.8,
           source=source)

layout = row(fig)
curdoc().add_root(layout)
curdoc().title = "WMS Viewer"

When I view the app the points are displayed, but the tiles are not, and I get no errors anywhere. Any idea what I'm doing wrong here?

System Specs:
  • Ubuntu 16.04
  • python 3.6
  • Bokeh 0.12.15
Installed via conda:
conda create -n wms-env bokeh python=3.6 -c conda-forge

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5aeef909-6dd1-4295-ae92-dd284942c8ae%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
<Auto Generated Inline Image 1.png>

Hi all
what is the status of Bokeh and WMS? I’ve got imagery in a Geoserver I would like to make available via a Bokeh app

Thanks

I created an issue on GitHub:

Mostly my URL was missing some key params and need a little modification for better performance. But after making those changes things worked for me. Looks like there was some discussion about long term efforts with WMS, but not sure on the state of that.

···

On Thursday, November 29, 2018 at 11:58:09 AM UTC-8, Robin Cole wrote:

Hi all
what is the status of Bokeh and WMS? I’ve got imagery in a Geoserver I would like to make available via a Bokeh app

Thanks