Repository: bokeh/bokeh

Issue:
[feature] add Cartodb positron tile provider
See

https://carto.com/location-data-services/basemaps/

for an example.

PR upcoming



Discussion:

Resolving patch:
diff --git a/bokeh/tile_providers.py b/bokeh/tile_providers.py
--- a/bokeh/tile_providers.py
+++ b/bokeh/tile_providers.py
@@ -1,5 +1,7 @@
 ''' Pre-configured tile sources with urls and attribution for common 3rd-party tile services.
-    Additional Stamen tile service information available at: http://maps.stamen.com/
+    Additional information available at:
+        Stamen tile service - http://maps.stamen.com/
+        CartoDB tile service - https://carto.com/location-data-services/basemaps/
 '''
 from .models.tiles import WMTSTileSource
 
@@ -46,3 +48,23 @@
         '<a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.'
     )
 )
+
+#: Tile Source for CartoDB Tile Service
+CARTODBPOSITRON = WMTSTileSource(
+    url='http://tiles.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png',
+    attribution=(
+        '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
+        ' contributors,'
+        '&copy; <a href="https://cartodb.com/attributions">CartoDB</a>'
+    )
+)
+
+#: Tile Source for CartoDB Tile Service (tiles at 'retina' resolution)
+CARTODBPOSITRON_RETINA = WMTSTileSource(
+    url='http://tiles.basemaps.cartocdn.com/light_all/{z}/{x}/{y}@2x.png',
+    attribution=(
+        '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
+        ' contributors,'
+        '&copy; <a href="https://cartodb.com/attributions">CartoDB</a>'
+    )
+)
diff --git a/examples/plotting/file/airports_map.py b/examples/plotting/file/airports_map.py
--- a/examples/plotting/file/airports_map.py
+++ b/examples/plotting/file/airports_map.py
@@ -1,33 +1,40 @@
 from __future__ import print_function
 
+from bokeh.layouts import row
 from bokeh.models import (
     Range1d, WMTSTileSource, ColumnDataSource, HoverTool,
 )
 from bokeh.plotting import figure, show, output_file
 from bokeh.sampledata.airports import data as airports
+from bokeh.tile_providers import CARTODBPOSITRON
 
+points_source = ColumnDataSource(airports)
 title = "US Airports: Field Elevation > 1500m"
-output_file("airports_map.html", title=title)
 
-points_source = ColumnDataSource(airports)
+def plot(tile_source, filename):
+    output_file(filename, title=title)
 
-# create tile source
-tile_options = {}
-tile_options['url'] = 'http://otile2.mqcdn.com/tiles/1.0.0/sat/{Z}/{X}/{Y}.png'
-tile_source = WMTSTileSource(**tile_options)
+    # set to roughly extent of points
+    x_range = Range1d(start=airports['x'].min() - 10000, end=airports['x'].max() + 10000, bounds=None)
+    y_range = Range1d(start=airports['y'].min() - 10000, end=airports['y'].max() + 10000, bounds=None)
 
-# set to roughly extent of points
-x_range = Range1d(start=airports['x'].min() - 10000, end=airports['x'].max() + 10000, bounds=None)
-y_range = Range1d(start=airports['y'].min() - 10000, end=airports['y'].max() + 10000, bounds=None)
+    # create plot and add tools
+    p = figure(tools='wheel_zoom,pan', x_range=x_range, y_range=y_range, title=title)
+    p.axis.visible = False
+    hover_tool = HoverTool(tooltips=[("Name", "@name"), ("Elevation", "@elevation (m)")])
+    p.add_tools(hover_tool)
+    p.add_tile(tile_source)
 
-# create plot and add tools
-p = figure(tools='wheel_zoom,pan', x_range=x_range, y_range=y_range, title=title)
-p.axis.visible = False
-hover_tool = HoverTool(tooltips=[("Name", "@name"), ("Elevation", "@elevation (m)")])
-p.add_tools(hover_tool)
-p.add_tile(tile_source)
+    # create point glyphs
+    p.circle(x='x', y='y', size=9, fill_color="#60ACA1", line_color="#D2C4C1", line_width=1.5, source=points_source)
+    return p
+
+# create a tile source
+tile_options = {}
+tile_options['url'] = 'http://otile2.mqcdn.com/tiles/1.0.0/sat/{Z}/{X}/{Y}.png'
+mq_tile_source = WMTSTileSource(**tile_options)
 
-# create point glyphs
-p.circle(x='x', y='y', size=9, fill_color="#60ACA1", line_color="#D2C4C1", line_width=1.5, source=points_source)
+carto = plot(CARTODBPOSITRON, 'airports_map_cartodb.html')
+mq = plot(mq_tile_source, 'airports_map.html')
 
-show(p)
+show(row([carto, mq]))


Test patch: