#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
''' Pre-configured tile sources for common third party tile services.
Attributes:
CARTODBPOSITRON
Tile Source for CartoDB Tile Service
.. raw:: html
CARTODBPOSITRON_RETINA
Tile Source for CartoDB Tile Service (tiles at 'retina' resolution)
.. raw:: html
STAMEN_TERRAIN
Tile Source for Stamen Terrain Service
.. raw:: html
STAMEN_TERRAIN_RETINA
Tile Source for Stamen Terrain Service
.. raw:: html
STAMEN_TONER
Tile Source for Stamen Toner Service
.. raw:: html
STAMEN_TONER_BACKGROUND
Tile Source for Stamen Toner Background Service which does not include labels
.. raw:: html
STAMEN_TONER_LABELS
Tile Source for Stamen Toner Service which includes only labels
.. raw:: html
Additional information available at:
* Stamen tile service - http://maps.stamen.com/
* CartoDB tile service - https://carto.com/location-data-services/basemaps/
'''
#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
log = logging.getLogger(__name__)
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard library imports
import sys
import types
# External imports
# Bokeh imports
#-----------------------------------------------------------------------------
# Globals and constants
#-----------------------------------------------------------------------------
# __all__ defined at the bottom on the class module
#-----------------------------------------------------------------------------
# General API
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Dev API
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Private API
#-----------------------------------------------------------------------------
class _TileProvidersModule(types.ModuleType):
_CARTO_ATTRIBUTION = (
'© OpenStreetMap contributors,'
'© CartoDB'
)
_STAMEN_ATTRIBUTION = (
'Map tiles by Stamen Design, '
'under CC BY 3.0. '
'Data by OpenStreetMap, '
'under %s.'
)
@property
def CARTODBPOSITRON(self):
from bokeh.models.tiles import WMTSTileSource
return WMTSTileSource(
url='https://tiles.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png',
attribution=self._CARTO_ATTRIBUTION
)
@property
def CARTODBPOSITRON_RETINA(self):
from bokeh.models.tiles import WMTSTileSource
return WMTSTileSource(
url='https://tiles.basemaps.cartocdn.com/light_all/{z}/{x}/{y}@2x.png',
attribution=self._CARTO_ATTRIBUTION
)
@property
def STAMEN_TERRAIN(self):
from bokeh.models.tiles import WMTSTileSource
return WMTSTileSource(
url='http://tile.stamen.com/terrain/{Z}/{X}/{Y}.png',
attribution=self._STAMEN_ATTRIBUTION % 'CC BY SA'
)
@property
def STAMEN_TERRAIN_RETINA(self):
from bokeh.models.tiles import WMTSTileSource
return WMTSTileSource(
url='http://tile.stamen.com/terrain/{Z}/{X}/{Y}@2x.png',
attribution=self._STAMEN_ATTRIBUTION % 'CC BY SA'
)
@property
def STAMEN_TONER(self):
from bokeh.models.tiles import WMTSTileSource
return WMTSTileSource(
url='http://tile.stamen.com/toner/{Z}/{X}/{Y}.png',
attribution=self._STAMEN_ATTRIBUTION % 'ODbL'
)
@property
def STAMEN_TONER_BACKGROUND(self):
from bokeh.models.tiles import WMTSTileSource
return WMTSTileSource(
url='http://tile.stamen.com/toner-background/{Z}/{X}/{Y}.png',
attribution=self._STAMEN_ATTRIBUTION % 'ODbL'
)
@property
def STAMEN_TONER_LABELS(self):
from bokeh.models.tiles import WMTSTileSource
return WMTSTileSource(
url='http://tile.stamen.com/toner-labels/{Z}/{X}/{Y}.png',
attribution=self._STAMEN_ATTRIBUTION % 'ODbL'
)
#-----------------------------------------------------------------------------
# Code
#-----------------------------------------------------------------------------
_mod = _TileProvidersModule(str('bokeh.tile_providers'))
_mod.__doc__ = __doc__
_mod.__all__ = (
'CARTODBPOSITRON',
'CARTODBPOSITRON_RETINA',
'STAMEN_TERRAIN',
'STAMEN_TERRAIN_RETINA',
'STAMEN_TONER',
'STAMEN_TONER_BACKGROUND',
'STAMEN_TONER_LABELS',
)
sys.modules['bokeh.tile_providers'] = _mod
del _mod, sys, types