diff --git a/contextily/_providers.py b/contextily/_providers.py index 1aee719d..df094f13 100644 --- a/contextily/_providers.py +++ b/contextily/_providers.py @@ -43,81 +43,81 @@ def __call__(self, **kwargs): Mapnik = TileProvider( url = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', max_zoom = 19, - attribution = '© OpenStreetMap contributors', + attribution = '(C) OpenStreetMap contributors', name = 'OpenStreetMap.Mapnik' ), DE = TileProvider( url = 'https://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png', max_zoom = 18, - attribution = '© OpenStreetMap contributors', + attribution = '(C) OpenStreetMap contributors', name = 'OpenStreetMap.DE' ), CH = TileProvider( url = 'https://tile.osm.ch/switzerland/{z}/{x}/{y}.png', max_zoom = 18, - attribution = '© OpenStreetMap contributors', + attribution = '(C) OpenStreetMap contributors', bounds = [[45, 5], [48, 11]], name = 'OpenStreetMap.CH' ), France = TileProvider( url = 'https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', max_zoom = 20, - attribution = '© Openstreetmap France | © OpenStreetMap contributors', + attribution = '(C) Openstreetmap France | (C) OpenStreetMap contributors', name = 'OpenStreetMap.France' ), HOT = TileProvider( url = 'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', max_zoom = 19, - attribution = '© OpenStreetMap contributors, Tiles style by Humanitarian OpenStreetMap Team hosted by OpenStreetMap France', + attribution = '(C) OpenStreetMap contributors, Tiles style by Humanitarian OpenStreetMap Team hosted by OpenStreetMap France', name = 'OpenStreetMap.HOT' ), BZH = TileProvider( url = 'https://tile.openstreetmap.bzh/br/{z}/{x}/{y}.png', max_zoom = 19, - attribution = '© OpenStreetMap contributors, Tiles courtesy of Breton OpenStreetMap Team', + attribution = '(C) OpenStreetMap contributors, Tiles courtesy of Breton OpenStreetMap Team', bounds = [[46.2, -5.5], [50, 0.7]], name = 'OpenStreetMap.BZH' ) ), OpenSeaMap = TileProvider( url = 'https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png', - attribution = 'Map data: © OpenSeaMap contributors', + attribution = 'Map data: (C) OpenSeaMap contributors', name = 'OpenSeaMap' ), OpenPtMap = TileProvider( url = 'http://openptmap.org/tiles/{z}/{x}/{y}.png', max_zoom = 17, - attribution = 'Map data: © OpenPtMap contributors', + attribution = 'Map data: (C) OpenPtMap contributors', name = 'OpenPtMap' ), OpenTopoMap = TileProvider( url = 'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', max_zoom = 17, - attribution = 'Map data: © OpenStreetMap contributors, SRTM | Map style: © OpenTopoMap (CC-BY-SA)', + attribution = 'Map data: (C) OpenStreetMap contributors, SRTM | Map style: (C) OpenTopoMap (CC-BY-SA)', name = 'OpenTopoMap' ), OpenRailwayMap = TileProvider( url = 'https://{s}.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png', max_zoom = 19, - attribution = 'Map data: © OpenStreetMap contributors | Map style: © OpenRailwayMap (CC-BY-SA)', + attribution = 'Map data: (C) OpenStreetMap contributors | Map style: (C) OpenRailwayMap (CC-BY-SA)', name = 'OpenRailwayMap' ), OpenFireMap = TileProvider( url = 'http://openfiremap.org/hytiles/{z}/{x}/{y}.png', max_zoom = 19, - attribution = 'Map data: © OpenStreetMap contributors | Map style: © OpenFireMap (CC-BY-SA)', + attribution = 'Map data: (C) OpenStreetMap contributors | Map style: (C) OpenFireMap (CC-BY-SA)', name = 'OpenFireMap' ), SafeCast = TileProvider( url = 'https://s3.amazonaws.com/te512.safecast.org/{z}/{x}/{y}.png', max_zoom = 16, - attribution = 'Map data: © OpenStreetMap contributors | Map style: © SafeCast (CC-BY-SA)', + attribution = 'Map data: (C) OpenStreetMap contributors | Map style: (C) SafeCast (CC-BY-SA)', name = 'SafeCast' ), Thunderforest = Bunch( OpenCycleMap = TileProvider( url = 'https://{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png?apikey={apikey}', - attribution = '© Thunderforest, © OpenStreetMap contributors', + attribution = '(C) Thunderforest, (C) OpenStreetMap contributors', variant = 'cycle', apikey = '', max_zoom = 22, @@ -125,7 +125,7 @@ def __call__(self, **kwargs): ), Transport = TileProvider( url = 'https://{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png?apikey={apikey}', - attribution = '© Thunderforest, © OpenStreetMap contributors', + attribution = '(C) Thunderforest, (C) OpenStreetMap contributors', variant = 'transport', apikey = '', max_zoom = 22, @@ -133,7 +133,7 @@ def __call__(self, **kwargs): ), TransportDark = TileProvider( url = 'https://{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png?apikey={apikey}', - attribution = '© Thunderforest, © OpenStreetMap contributors', + attribution = '(C) Thunderforest, (C) OpenStreetMap contributors', variant = 'transport-dark', apikey = '', max_zoom = 22, @@ -141,7 +141,7 @@ def __call__(self, **kwargs): ), SpinalMap = TileProvider( url = 'https://{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png?apikey={apikey}', - attribution = '© Thunderforest, © OpenStreetMap contributors', + attribution = '(C) Thunderforest, (C) OpenStreetMap contributors', variant = 'spinal-map', apikey = '', max_zoom = 22, @@ -149,7 +149,7 @@ def __call__(self, **kwargs): ), Landscape = TileProvider( url = 'https://{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png?apikey={apikey}', - attribution = '© Thunderforest, © OpenStreetMap contributors', + attribution = '(C) Thunderforest, (C) OpenStreetMap contributors', variant = 'landscape', apikey = '', max_zoom = 22, @@ -157,7 +157,7 @@ def __call__(self, **kwargs): ), Outdoors = TileProvider( url = 'https://{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png?apikey={apikey}', - attribution = '© Thunderforest, © OpenStreetMap contributors', + attribution = '(C) Thunderforest, (C) OpenStreetMap contributors', variant = 'outdoors', apikey = '', max_zoom = 22, @@ -165,7 +165,7 @@ def __call__(self, **kwargs): ), Pioneer = TileProvider( url = 'https://{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png?apikey={apikey}', - attribution = '© Thunderforest, © OpenStreetMap contributors', + attribution = '(C) Thunderforest, (C) OpenStreetMap contributors', variant = 'pioneer', apikey = '', max_zoom = 22, @@ -173,7 +173,7 @@ def __call__(self, **kwargs): ), MobileAtlas = TileProvider( url = 'https://{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png?apikey={apikey}', - attribution = '© Thunderforest, © OpenStreetMap contributors', + attribution = '(C) Thunderforest, (C) OpenStreetMap contributors', variant = 'mobile-atlas', apikey = '', max_zoom = 22, @@ -181,7 +181,7 @@ def __call__(self, **kwargs): ), Neighbourhood = TileProvider( url = 'https://{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png?apikey={apikey}', - attribution = '© Thunderforest, © OpenStreetMap contributors', + attribution = '(C) Thunderforest, (C) OpenStreetMap contributors', variant = 'neighbourhood', apikey = '', max_zoom = 22, @@ -193,28 +193,28 @@ def __call__(self, **kwargs): url = 'https://maps.heigit.org/openmapsurfer/tiles/{variant}/webmercator/{z}/{x}/{y}.png', max_zoom = 19, variant = 'roads', - attribution = 'Imagery from GIScience Research Group @ University of Heidelberg | Map data © OpenStreetMap contributors', + attribution = 'Imagery from GIScience Research Group @ University of Heidelberg | Map data (C) OpenStreetMap contributors', name = 'OpenMapSurfer.Roads' ), Hybrid = TileProvider( url = 'https://maps.heigit.org/openmapsurfer/tiles/{variant}/webmercator/{z}/{x}/{y}.png', max_zoom = 19, variant = 'hybrid', - attribution = 'Imagery from GIScience Research Group @ University of Heidelberg | Map data © OpenStreetMap contributors', + attribution = 'Imagery from GIScience Research Group @ University of Heidelberg | Map data (C) OpenStreetMap contributors', name = 'OpenMapSurfer.Hybrid' ), AdminBounds = TileProvider( url = 'https://maps.heigit.org/openmapsurfer/tiles/{variant}/webmercator/{z}/{x}/{y}.png', max_zoom = 18, variant = 'adminb', - attribution = 'Imagery from GIScience Research Group @ University of Heidelberg | Map data © OpenStreetMap contributors', + attribution = 'Imagery from GIScience Research Group @ University of Heidelberg | Map data (C) OpenStreetMap contributors', name = 'OpenMapSurfer.AdminBounds' ), ContourLines = TileProvider( url = 'https://maps.heigit.org/openmapsurfer/tiles/{variant}/webmercator/{z}/{x}/{y}.png', max_zoom = 18, variant = 'asterc', - attribution = 'Imagery from GIScience Research Group @ University of Heidelberg | Map data ASTER GDEM', + attribution = 'Imagery from GIScience Research Group @ University of Heidelberg | Map data ASTER GDEM', min_zoom = 13, name = 'OpenMapSurfer.ContourLines' ), @@ -222,14 +222,14 @@ def __call__(self, **kwargs): url = 'https://maps.heigit.org/openmapsurfer/tiles/{variant}/webmercator/{z}/{x}/{y}.png', max_zoom = 18, variant = 'asterh', - attribution = 'Imagery from GIScience Research Group @ University of Heidelberg | Map data ASTER GDEM, SRTM', + attribution = 'Imagery from GIScience Research Group @ University of Heidelberg | Map data ASTER GDEM, SRTM', name = 'OpenMapSurfer.Hillshade' ), ElementsAtRisk = TileProvider( url = 'https://maps.heigit.org/openmapsurfer/tiles/{variant}/webmercator/{z}/{x}/{y}.png', max_zoom = 19, variant = 'elements_at_risk', - attribution = 'Imagery from GIScience Research Group @ University of Heidelberg | Map data © OpenStreetMap contributors', + attribution = 'Imagery from GIScience Research Group @ University of Heidelberg | Map data (C) OpenStreetMap contributors', name = 'OpenMapSurfer.ElementsAtRisk' ) ), @@ -238,27 +238,27 @@ def __call__(self, **kwargs): url = 'https://{s}.tile.openstreetmap.se/hydda/{variant}/{z}/{x}/{y}.png', max_zoom = 18, variant = 'full', - attribution = 'Tiles courtesy of OpenStreetMap Sweden — Map data © OpenStreetMap contributors', + attribution = 'Tiles courtesy of OpenStreetMap Sweden -- Map data (C) OpenStreetMap contributors', name = 'Hydda.Full' ), Base = TileProvider( url = 'https://{s}.tile.openstreetmap.se/hydda/{variant}/{z}/{x}/{y}.png', max_zoom = 18, variant = 'base', - attribution = 'Tiles courtesy of OpenStreetMap Sweden — Map data © OpenStreetMap contributors', + attribution = 'Tiles courtesy of OpenStreetMap Sweden -- Map data (C) OpenStreetMap contributors', name = 'Hydda.Base' ), RoadsAndLabels = TileProvider( url = 'https://{s}.tile.openstreetmap.se/hydda/{variant}/{z}/{x}/{y}.png', max_zoom = 18, variant = 'roads_and_labels', - attribution = 'Tiles courtesy of OpenStreetMap Sweden — Map data © OpenStreetMap contributors', + attribution = 'Tiles courtesy of OpenStreetMap Sweden -- Map data (C) OpenStreetMap contributors', name = 'Hydda.RoadsAndLabels' ) ), MapBox = TileProvider( url = 'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}{r}.png?access_token={accessToken}', - attribution = '© Mapbox © OpenStreetMap contributors Improve this map', + attribution = '(C) Mapbox (C) OpenStreetMap contributors Improve this map', subdomains = 'abcd', id = 'mapbox.streets', accessToken = '', @@ -267,7 +267,7 @@ def __call__(self, **kwargs): Stamen = Bunch( Toner = TileProvider( url = 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}{r}.{ext}', - attribution = 'Map tiles by Stamen Design, CC BY 3.0 — Map data © OpenStreetMap contributors', + attribution = 'Map tiles by Stamen Design, CC BY 3.0 -- Map data (C) OpenStreetMap contributors', subdomains = 'abcd', min_zoom = 0, max_zoom = 20, @@ -277,7 +277,7 @@ def __call__(self, **kwargs): ), TonerBackground = TileProvider( url = 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}{r}.{ext}', - attribution = 'Map tiles by Stamen Design, CC BY 3.0 — Map data © OpenStreetMap contributors', + attribution = 'Map tiles by Stamen Design, CC BY 3.0 -- Map data (C) OpenStreetMap contributors', subdomains = 'abcd', min_zoom = 0, max_zoom = 20, @@ -287,7 +287,7 @@ def __call__(self, **kwargs): ), TonerHybrid = TileProvider( url = 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}{r}.{ext}', - attribution = 'Map tiles by Stamen Design, CC BY 3.0 — Map data © OpenStreetMap contributors', + attribution = 'Map tiles by Stamen Design, CC BY 3.0 -- Map data (C) OpenStreetMap contributors', subdomains = 'abcd', min_zoom = 0, max_zoom = 20, @@ -297,7 +297,7 @@ def __call__(self, **kwargs): ), TonerLines = TileProvider( url = 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}{r}.{ext}', - attribution = 'Map tiles by Stamen Design, CC BY 3.0 — Map data © OpenStreetMap contributors', + attribution = 'Map tiles by Stamen Design, CC BY 3.0 -- Map data (C) OpenStreetMap contributors', subdomains = 'abcd', min_zoom = 0, max_zoom = 20, @@ -307,7 +307,7 @@ def __call__(self, **kwargs): ), TonerLabels = TileProvider( url = 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}{r}.{ext}', - attribution = 'Map tiles by Stamen Design, CC BY 3.0 — Map data © OpenStreetMap contributors', + attribution = 'Map tiles by Stamen Design, CC BY 3.0 -- Map data (C) OpenStreetMap contributors', subdomains = 'abcd', min_zoom = 0, max_zoom = 20, @@ -317,7 +317,7 @@ def __call__(self, **kwargs): ), TonerLite = TileProvider( url = 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}{r}.{ext}', - attribution = 'Map tiles by Stamen Design, CC BY 3.0 — Map data © OpenStreetMap contributors', + attribution = 'Map tiles by Stamen Design, CC BY 3.0 -- Map data (C) OpenStreetMap contributors', subdomains = 'abcd', min_zoom = 0, max_zoom = 20, @@ -327,7 +327,7 @@ def __call__(self, **kwargs): ), Watercolor = TileProvider( url = 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}.{ext}', - attribution = 'Map tiles by Stamen Design, CC BY 3.0 — Map data © OpenStreetMap contributors', + attribution = 'Map tiles by Stamen Design, CC BY 3.0 -- Map data (C) OpenStreetMap contributors', subdomains = 'abcd', min_zoom = 1, max_zoom = 16, @@ -337,7 +337,7 @@ def __call__(self, **kwargs): ), Terrain = TileProvider( url = 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}{r}.{ext}', - attribution = 'Map tiles by Stamen Design, CC BY 3.0 — Map data © OpenStreetMap contributors', + attribution = 'Map tiles by Stamen Design, CC BY 3.0 -- Map data (C) OpenStreetMap contributors', subdomains = 'abcd', min_zoom = 0, max_zoom = 18, @@ -347,7 +347,7 @@ def __call__(self, **kwargs): ), TerrainBackground = TileProvider( url = 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}{r}.{ext}', - attribution = 'Map tiles by Stamen Design, CC BY 3.0 — Map data © OpenStreetMap contributors', + attribution = 'Map tiles by Stamen Design, CC BY 3.0 -- Map data (C) OpenStreetMap contributors', subdomains = 'abcd', min_zoom = 0, max_zoom = 18, @@ -357,7 +357,7 @@ def __call__(self, **kwargs): ), TopOSMRelief = TileProvider( url = 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}.{ext}', - attribution = 'Map tiles by Stamen Design, CC BY 3.0 — Map data © OpenStreetMap contributors', + attribution = 'Map tiles by Stamen Design, CC BY 3.0 -- Map data (C) OpenStreetMap contributors', subdomains = 'abcd', min_zoom = 0, max_zoom = 20, @@ -368,7 +368,7 @@ def __call__(self, **kwargs): ), TopOSMFeatures = TileProvider( url = 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}{r}.{ext}', - attribution = 'Map tiles by Stamen Design, CC BY 3.0 — Map data © OpenStreetMap contributors', + attribution = 'Map tiles by Stamen Design, CC BY 3.0 -- Map data (C) OpenStreetMap contributors', subdomains = 'abcd', min_zoom = 0, max_zoom = 20, @@ -383,13 +383,13 @@ def __call__(self, **kwargs): WorldStreetMap = TileProvider( url = 'https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}', variant = 'World_Street_Map', - attribution = 'Tiles © Esri — Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012', + attribution = 'Tiles (C) Esri -- Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012', name = 'Esri.WorldStreetMap' ), DeLorme = TileProvider( url = 'https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}', variant = 'Specialty/DeLorme_World_Base_Map', - attribution = 'Tiles © Esri — Copyright: ©2012 DeLorme', + attribution = 'Tiles (C) Esri -- Copyright: (C)2012 DeLorme', min_zoom = 1, max_zoom = 11, name = 'Esri.DeLorme' @@ -397,54 +397,54 @@ def __call__(self, **kwargs): WorldTopoMap = TileProvider( url = 'https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}', variant = 'World_Topo_Map', - attribution = 'Tiles © Esri — Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community', + attribution = 'Tiles (C) Esri -- Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community', name = 'Esri.WorldTopoMap' ), WorldImagery = TileProvider( url = 'https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}', variant = 'World_Imagery', - attribution = 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community', + attribution = 'Tiles (C) Esri -- Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community', name = 'Esri.WorldImagery' ), WorldTerrain = TileProvider( url = 'https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}', variant = 'World_Terrain_Base', - attribution = 'Tiles © Esri — Source: USGS, Esri, TANA, DeLorme, and NPS', + attribution = 'Tiles (C) Esri -- Source: USGS, Esri, TANA, DeLorme, and NPS', max_zoom = 13, name = 'Esri.WorldTerrain' ), WorldShadedRelief = TileProvider( url = 'https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}', variant = 'World_Shaded_Relief', - attribution = 'Tiles © Esri — Source: Esri', + attribution = 'Tiles (C) Esri -- Source: Esri', max_zoom = 13, name = 'Esri.WorldShadedRelief' ), WorldPhysical = TileProvider( url = 'https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}', variant = 'World_Physical_Map', - attribution = 'Tiles © Esri — Source: US National Park Service', + attribution = 'Tiles (C) Esri -- Source: US National Park Service', max_zoom = 8, name = 'Esri.WorldPhysical' ), OceanBasemap = TileProvider( url = 'https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}', variant = 'Ocean_Basemap', - attribution = 'Tiles © Esri — Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri', + attribution = 'Tiles (C) Esri -- Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri', max_zoom = 13, name = 'Esri.OceanBasemap' ), NatGeoWorldMap = TileProvider( url = 'https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}', variant = 'NatGeo_World_Map', - attribution = 'Tiles © Esri — National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC', + attribution = 'Tiles (C) Esri -- National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC', max_zoom = 16, name = 'Esri.NatGeoWorldMap' ), WorldGrayCanvas = TileProvider( url = 'https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}', variant = 'Canvas/World_Light_Gray_Base', - attribution = 'Tiles © Esri — Esri, DeLorme, NAVTEQ', + attribution = 'Tiles (C) Esri -- Esri, DeLorme, NAVTEQ', max_zoom = 16, name = 'Esri.WorldGrayCanvas' ) @@ -453,7 +453,7 @@ def __call__(self, **kwargs): Clouds = TileProvider( url = 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png?appid={apiKey}', max_zoom = 19, - attribution = 'Map data © OpenWeatherMap', + attribution = 'Map data (C) OpenWeatherMap', apiKey = '', opacity = 0.5, variant = 'clouds', @@ -462,7 +462,7 @@ def __call__(self, **kwargs): CloudsClassic = TileProvider( url = 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png?appid={apiKey}', max_zoom = 19, - attribution = 'Map data © OpenWeatherMap', + attribution = 'Map data (C) OpenWeatherMap', apiKey = '', opacity = 0.5, variant = 'clouds_cls', @@ -471,7 +471,7 @@ def __call__(self, **kwargs): Precipitation = TileProvider( url = 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png?appid={apiKey}', max_zoom = 19, - attribution = 'Map data © OpenWeatherMap', + attribution = 'Map data (C) OpenWeatherMap', apiKey = '', opacity = 0.5, variant = 'precipitation', @@ -480,7 +480,7 @@ def __call__(self, **kwargs): PrecipitationClassic = TileProvider( url = 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png?appid={apiKey}', max_zoom = 19, - attribution = 'Map data © OpenWeatherMap', + attribution = 'Map data (C) OpenWeatherMap', apiKey = '', opacity = 0.5, variant = 'precipitation_cls', @@ -489,7 +489,7 @@ def __call__(self, **kwargs): Rain = TileProvider( url = 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png?appid={apiKey}', max_zoom = 19, - attribution = 'Map data © OpenWeatherMap', + attribution = 'Map data (C) OpenWeatherMap', apiKey = '', opacity = 0.5, variant = 'rain', @@ -498,7 +498,7 @@ def __call__(self, **kwargs): RainClassic = TileProvider( url = 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png?appid={apiKey}', max_zoom = 19, - attribution = 'Map data © OpenWeatherMap', + attribution = 'Map data (C) OpenWeatherMap', apiKey = '', opacity = 0.5, variant = 'rain_cls', @@ -507,7 +507,7 @@ def __call__(self, **kwargs): Pressure = TileProvider( url = 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png?appid={apiKey}', max_zoom = 19, - attribution = 'Map data © OpenWeatherMap', + attribution = 'Map data (C) OpenWeatherMap', apiKey = '', opacity = 0.5, variant = 'pressure', @@ -516,7 +516,7 @@ def __call__(self, **kwargs): PressureContour = TileProvider( url = 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png?appid={apiKey}', max_zoom = 19, - attribution = 'Map data © OpenWeatherMap', + attribution = 'Map data (C) OpenWeatherMap', apiKey = '', opacity = 0.5, variant = 'pressure_cntr', @@ -525,7 +525,7 @@ def __call__(self, **kwargs): Wind = TileProvider( url = 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png?appid={apiKey}', max_zoom = 19, - attribution = 'Map data © OpenWeatherMap', + attribution = 'Map data (C) OpenWeatherMap', apiKey = '', opacity = 0.5, variant = 'wind', @@ -534,7 +534,7 @@ def __call__(self, **kwargs): Temperature = TileProvider( url = 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png?appid={apiKey}', max_zoom = 19, - attribution = 'Map data © OpenWeatherMap', + attribution = 'Map data (C) OpenWeatherMap', apiKey = '', opacity = 0.5, variant = 'temp', @@ -543,7 +543,7 @@ def __call__(self, **kwargs): Snow = TileProvider( url = 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png?appid={apiKey}', max_zoom = 19, - attribution = 'Map data © OpenWeatherMap', + attribution = 'Map data (C) OpenWeatherMap', apiKey = '', opacity = 0.5, variant = 'snow', @@ -553,7 +553,7 @@ def __call__(self, **kwargs): HERE = Bunch( normalDay = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -569,7 +569,7 @@ def __call__(self, **kwargs): ), normalDayCustom = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -585,7 +585,7 @@ def __call__(self, **kwargs): ), normalDayGrey = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -601,7 +601,7 @@ def __call__(self, **kwargs): ), normalDayMobile = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -617,7 +617,7 @@ def __call__(self, **kwargs): ), normalDayGreyMobile = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -633,7 +633,7 @@ def __call__(self, **kwargs): ), normalDayTransit = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -649,7 +649,7 @@ def __call__(self, **kwargs): ), normalDayTransitMobile = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -665,7 +665,7 @@ def __call__(self, **kwargs): ), normalNight = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -681,7 +681,7 @@ def __call__(self, **kwargs): ), normalNightMobile = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -697,7 +697,7 @@ def __call__(self, **kwargs): ), normalNightGrey = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -713,7 +713,7 @@ def __call__(self, **kwargs): ), normalNightGreyMobile = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -729,7 +729,7 @@ def __call__(self, **kwargs): ), normalNightTransit = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -745,7 +745,7 @@ def __call__(self, **kwargs): ), normalNightTransitMobile = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -761,7 +761,7 @@ def __call__(self, **kwargs): ), reducedDay = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -777,7 +777,7 @@ def __call__(self, **kwargs): ), reducedNight = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -793,7 +793,7 @@ def __call__(self, **kwargs): ), basicMap = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -809,7 +809,7 @@ def __call__(self, **kwargs): ), mapLabels = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -825,7 +825,7 @@ def __call__(self, **kwargs): ), trafficFlow = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -841,7 +841,7 @@ def __call__(self, **kwargs): ), carnavDayGrey = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -857,7 +857,7 @@ def __call__(self, **kwargs): ), hybridDay = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -873,7 +873,7 @@ def __call__(self, **kwargs): ), hybridDayMobile = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -889,7 +889,7 @@ def __call__(self, **kwargs): ), hybridDayTransit = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -905,7 +905,7 @@ def __call__(self, **kwargs): ), hybridDayGrey = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -921,7 +921,7 @@ def __call__(self, **kwargs): ), pedestrianDay = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -937,7 +937,7 @@ def __call__(self, **kwargs): ), pedestrianNight = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -953,7 +953,7 @@ def __call__(self, **kwargs): ), satelliteDay = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -969,7 +969,7 @@ def __call__(self, **kwargs): ), terrainDay = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -985,7 +985,7 @@ def __call__(self, **kwargs): ), terrainDayMobile = TileProvider( url = 'https://{s}.{base}.maps.api.here.com/maptile/2.1/{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?app_id={app_id}&app_code={app_code}&lg={language}', - attribution = 'Map © 1987-2019 HERE', + attribution = 'Map (C) 1987-2019 HERE', subdomains = '1234', mapID = 'newest', app_id = '', @@ -1006,18 +1006,18 @@ def __call__(self, **kwargs): max_zoom = 16, subdomains = '1234', bounds = [[47.204642, 15.996093], [49.830896, 22.576904]], - attribution = '© OpenStreetMap contributors, vizualization CC-By-SA 2.0 Freemap.sk', + attribution = '(C) OpenStreetMap contributors, vizualization CC-By-SA 2.0 Freemap.sk', name = 'FreeMapSK' ), MtbMap = TileProvider( url = 'http://tile.mtbmap.cz/mtbmap_tiles/{z}/{x}/{y}.png', - attribution = '© OpenStreetMap contributors & USGS', + attribution = '(C) OpenStreetMap contributors & USGS', name = 'MtbMap' ), CartoDB = Bunch( Positron = TileProvider( url = 'https://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}{r}.png', - attribution = '© OpenStreetMap contributors © CARTO', + attribution = '(C) OpenStreetMap contributors (C) CARTO', subdomains = 'abcd', max_zoom = 19, variant = 'light_all', @@ -1025,7 +1025,7 @@ def __call__(self, **kwargs): ), PositronNoLabels = TileProvider( url = 'https://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}{r}.png', - attribution = '© OpenStreetMap contributors © CARTO', + attribution = '(C) OpenStreetMap contributors (C) CARTO', subdomains = 'abcd', max_zoom = 19, variant = 'light_nolabels', @@ -1033,7 +1033,7 @@ def __call__(self, **kwargs): ), PositronOnlyLabels = TileProvider( url = 'https://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}{r}.png', - attribution = '© OpenStreetMap contributors © CARTO', + attribution = '(C) OpenStreetMap contributors (C) CARTO', subdomains = 'abcd', max_zoom = 19, variant = 'light_only_labels', @@ -1041,7 +1041,7 @@ def __call__(self, **kwargs): ), DarkMatter = TileProvider( url = 'https://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}{r}.png', - attribution = '© OpenStreetMap contributors © CARTO', + attribution = '(C) OpenStreetMap contributors (C) CARTO', subdomains = 'abcd', max_zoom = 19, variant = 'dark_all', @@ -1049,7 +1049,7 @@ def __call__(self, **kwargs): ), DarkMatterNoLabels = TileProvider( url = 'https://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}{r}.png', - attribution = '© OpenStreetMap contributors © CARTO', + attribution = '(C) OpenStreetMap contributors (C) CARTO', subdomains = 'abcd', max_zoom = 19, variant = 'dark_nolabels', @@ -1057,7 +1057,7 @@ def __call__(self, **kwargs): ), DarkMatterOnlyLabels = TileProvider( url = 'https://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}{r}.png', - attribution = '© OpenStreetMap contributors © CARTO', + attribution = '(C) OpenStreetMap contributors (C) CARTO', subdomains = 'abcd', max_zoom = 19, variant = 'dark_only_labels', @@ -1065,7 +1065,7 @@ def __call__(self, **kwargs): ), Voyager = TileProvider( url = 'https://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}{r}.png', - attribution = '© OpenStreetMap contributors © CARTO', + attribution = '(C) OpenStreetMap contributors (C) CARTO', subdomains = 'abcd', max_zoom = 19, variant = 'rastertiles/voyager', @@ -1073,7 +1073,7 @@ def __call__(self, **kwargs): ), VoyagerNoLabels = TileProvider( url = 'https://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}{r}.png', - attribution = '© OpenStreetMap contributors © CARTO', + attribution = '(C) OpenStreetMap contributors (C) CARTO', subdomains = 'abcd', max_zoom = 19, variant = 'rastertiles/voyager_nolabels', @@ -1081,7 +1081,7 @@ def __call__(self, **kwargs): ), VoyagerOnlyLabels = TileProvider( url = 'https://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}{r}.png', - attribution = '© OpenStreetMap contributors © CARTO', + attribution = '(C) OpenStreetMap contributors (C) CARTO', subdomains = 'abcd', max_zoom = 19, variant = 'rastertiles/voyager_only_labels', @@ -1089,7 +1089,7 @@ def __call__(self, **kwargs): ), VoyagerLabelsUnder = TileProvider( url = 'https://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}{r}.png', - attribution = '© OpenStreetMap contributors © CARTO', + attribution = '(C) OpenStreetMap contributors (C) CARTO', subdomains = 'abcd', max_zoom = 19, variant = 'rastertiles/voyager_labels_under', @@ -1100,14 +1100,14 @@ def __call__(self, **kwargs): HikeBike = TileProvider( url = 'https://tiles.wmflabs.org/{variant}/{z}/{x}/{y}.png', max_zoom = 19, - attribution = '© OpenStreetMap contributors', + attribution = '(C) OpenStreetMap contributors', variant = 'hikebike', name = 'HikeBike.HikeBike' ), HillShading = TileProvider( url = 'https://tiles.wmflabs.org/{variant}/{z}/{x}/{y}.png', max_zoom = 15, - attribution = '© OpenStreetMap contributors', + attribution = '(C) OpenStreetMap contributors', variant = 'hillshading', name = 'HikeBike.HillShading' ) @@ -1116,7 +1116,7 @@ def __call__(self, **kwargs): basemap = TileProvider( url = 'https://maps{s}.wien.gv.at/basemap/{variant}/normal/google3857/{z}/{y}/{x}.{format}', max_zoom = 20, - attribution = 'Datenquelle: basemap.at', + attribution = 'Datenquelle: basemap.at', subdomains = ['', '1', '2', '3', '4'], format = 'png', bounds = [[46.35877, 8.782379], [49.037872, 17.189532]], @@ -1126,7 +1126,7 @@ def __call__(self, **kwargs): grau = TileProvider( url = 'https://maps{s}.wien.gv.at/basemap/{variant}/normal/google3857/{z}/{y}/{x}.{format}', max_zoom = 19, - attribution = 'Datenquelle: basemap.at', + attribution = 'Datenquelle: basemap.at', subdomains = ['', '1', '2', '3', '4'], format = 'png', bounds = [[46.35877, 8.782379], [49.037872, 17.189532]], @@ -1136,7 +1136,7 @@ def __call__(self, **kwargs): overlay = TileProvider( url = 'https://maps{s}.wien.gv.at/basemap/{variant}/normal/google3857/{z}/{y}/{x}.{format}', max_zoom = 19, - attribution = 'Datenquelle: basemap.at', + attribution = 'Datenquelle: basemap.at', subdomains = ['', '1', '2', '3', '4'], format = 'png', bounds = [[46.35877, 8.782379], [49.037872, 17.189532]], @@ -1146,7 +1146,7 @@ def __call__(self, **kwargs): highdpi = TileProvider( url = 'https://maps{s}.wien.gv.at/basemap/{variant}/normal/google3857/{z}/{y}/{x}.{format}', max_zoom = 19, - attribution = 'Datenquelle: basemap.at', + attribution = 'Datenquelle: basemap.at', subdomains = ['', '1', '2', '3', '4'], format = 'jpeg', bounds = [[46.35877, 8.782379], [49.037872, 17.189532]], @@ -1156,7 +1156,7 @@ def __call__(self, **kwargs): orthofoto = TileProvider( url = 'https://maps{s}.wien.gv.at/basemap/{variant}/normal/google3857/{z}/{y}/{x}.{format}', max_zoom = 20, - attribution = 'Datenquelle: basemap.at', + attribution = 'Datenquelle: basemap.at', subdomains = ['', '1', '2', '3', '4'], format = 'jpeg', bounds = [[46.35877, 8.782379], [49.037872, 17.189532]], @@ -1170,7 +1170,7 @@ def __call__(self, **kwargs): min_zoom = 6, max_zoom = 19, bounds = [[50.5, 3.25], [54, 7.6]], - attribution = 'Kaartgegevens © Kadaster', + attribution = 'Kaartgegevens (C) Kadaster', variant = 'brtachtergrondkaart', name = 'nlmaps.standaard' ), @@ -1179,7 +1179,7 @@ def __call__(self, **kwargs): min_zoom = 6, max_zoom = 19, bounds = [[50.5, 3.25], [54, 7.6]], - attribution = 'Kaartgegevens © Kadaster', + attribution = 'Kaartgegevens (C) Kadaster', variant = 'brtachtergrondkaartpastel', name = 'nlmaps.pastel' ), @@ -1188,7 +1188,7 @@ def __call__(self, **kwargs): min_zoom = 6, max_zoom = 19, bounds = [[50.5, 3.25], [54, 7.6]], - attribution = 'Kaartgegevens © Kadaster', + attribution = 'Kaartgegevens (C) Kadaster', variant = 'brtachtergrondkaartgrijs', name = 'nlmaps.grijs' ), @@ -1197,14 +1197,14 @@ def __call__(self, **kwargs): min_zoom = 6, max_zoom = 19, bounds = [[50.5, 3.25], [54, 7.6]], - attribution = 'Kaartgegevens © Kadaster', + attribution = 'Kaartgegevens (C) Kadaster', name = 'nlmaps.luchtfoto' ) ), NASAGIBS = Bunch( ModisTerraTrueColorCR = TileProvider( url = 'https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}', - attribution = 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.', + attribution = 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.', bounds = [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]], min_zoom = 1, max_zoom = 9, @@ -1216,7 +1216,7 @@ def __call__(self, **kwargs): ), ModisTerraBands367CR = TileProvider( url = 'https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}', - attribution = 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.', + attribution = 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.', bounds = [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]], min_zoom = 1, max_zoom = 9, @@ -1228,7 +1228,7 @@ def __call__(self, **kwargs): ), ViirsEarthAtNight2012 = TileProvider( url = 'https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}', - attribution = 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.', + attribution = 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.', bounds = [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]], min_zoom = 1, max_zoom = 8, @@ -1240,7 +1240,7 @@ def __call__(self, **kwargs): ), ModisTerraLSTDay = TileProvider( url = 'https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}', - attribution = 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.', + attribution = 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.', bounds = [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]], min_zoom = 1, max_zoom = 7, @@ -1253,7 +1253,7 @@ def __call__(self, **kwargs): ), ModisTerraSnowCover = TileProvider( url = 'https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}', - attribution = 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.', + attribution = 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.', bounds = [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]], min_zoom = 1, max_zoom = 8, @@ -1266,7 +1266,7 @@ def __call__(self, **kwargs): ), ModisTerraAOD = TileProvider( url = 'https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}', - attribution = 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.', + attribution = 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.', bounds = [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]], min_zoom = 1, max_zoom = 6, @@ -1279,7 +1279,7 @@ def __call__(self, **kwargs): ), ModisTerraChlorophyll = TileProvider( url = 'https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}', - attribution = 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.', + attribution = 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.', bounds = [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]], min_zoom = 1, max_zoom = 7, @@ -1293,7 +1293,7 @@ def __call__(self, **kwargs): ), NLS = TileProvider( url = 'https://nls-{s}.tileserver.com/nls/{z}/{x}/{y}.jpg', - attribution = 'National Library of Scotland Historic Maps', + attribution = 'National Library of Scotland Historic Maps', bounds = [[49.6, -12], [61.7, 3]], min_zoom = 1, max_zoom = 18, @@ -1303,7 +1303,7 @@ def __call__(self, **kwargs): JusticeMap = Bunch( income = TileProvider( url = 'http://www.justicemap.org/tile/{size}/{variant}/{z}/{x}/{y}.png', - attribution = 'Justice Map', + attribution = 'Justice Map', size = 'county', bounds = [[14, -180], [72, -56]], variant = 'income', @@ -1311,7 +1311,7 @@ def __call__(self, **kwargs): ), americanIndian = TileProvider( url = 'http://www.justicemap.org/tile/{size}/{variant}/{z}/{x}/{y}.png', - attribution = 'Justice Map', + attribution = 'Justice Map', size = 'county', bounds = [[14, -180], [72, -56]], variant = 'indian', @@ -1319,7 +1319,7 @@ def __call__(self, **kwargs): ), asian = TileProvider( url = 'http://www.justicemap.org/tile/{size}/{variant}/{z}/{x}/{y}.png', - attribution = 'Justice Map', + attribution = 'Justice Map', size = 'county', bounds = [[14, -180], [72, -56]], variant = 'asian', @@ -1327,7 +1327,7 @@ def __call__(self, **kwargs): ), black = TileProvider( url = 'http://www.justicemap.org/tile/{size}/{variant}/{z}/{x}/{y}.png', - attribution = 'Justice Map', + attribution = 'Justice Map', size = 'county', bounds = [[14, -180], [72, -56]], variant = 'black', @@ -1335,7 +1335,7 @@ def __call__(self, **kwargs): ), hispanic = TileProvider( url = 'http://www.justicemap.org/tile/{size}/{variant}/{z}/{x}/{y}.png', - attribution = 'Justice Map', + attribution = 'Justice Map', size = 'county', bounds = [[14, -180], [72, -56]], variant = 'hispanic', @@ -1343,7 +1343,7 @@ def __call__(self, **kwargs): ), multi = TileProvider( url = 'http://www.justicemap.org/tile/{size}/{variant}/{z}/{x}/{y}.png', - attribution = 'Justice Map', + attribution = 'Justice Map', size = 'county', bounds = [[14, -180], [72, -56]], variant = 'multi', @@ -1351,7 +1351,7 @@ def __call__(self, **kwargs): ), nonWhite = TileProvider( url = 'http://www.justicemap.org/tile/{size}/{variant}/{z}/{x}/{y}.png', - attribution = 'Justice Map', + attribution = 'Justice Map', size = 'county', bounds = [[14, -180], [72, -56]], variant = 'nonwhite', @@ -1359,7 +1359,7 @@ def __call__(self, **kwargs): ), white = TileProvider( url = 'http://www.justicemap.org/tile/{size}/{variant}/{z}/{x}/{y}.png', - attribution = 'Justice Map', + attribution = 'Justice Map', size = 'county', bounds = [[14, -180], [72, -56]], variant = 'white', @@ -1367,7 +1367,7 @@ def __call__(self, **kwargs): ), plurality = TileProvider( url = 'http://www.justicemap.org/tile/{size}/{variant}/{z}/{x}/{y}.png', - attribution = 'Justice Map', + attribution = 'Justice Map', size = 'county', bounds = [[14, -180], [72, -56]], variant = 'plural', @@ -1376,7 +1376,7 @@ def __call__(self, **kwargs): ), Wikimedia = TileProvider( url = 'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}{r}.png', - attribution = 'Wikimedia', + attribution = 'Wikimedia', min_zoom = 1, max_zoom = 19, name = 'Wikimedia' @@ -1384,7 +1384,7 @@ def __call__(self, **kwargs): GeoportailFrance = Bunch( parcels = TileProvider( url = 'https://wxs.ign.fr/{apikey}/geoportail/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE={style}&TILEMATRIXSET=PM&FORMAT={format}&LAYER={variant}&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', - attribution = 'Geoportail France', + attribution = 'Geoportail France', bounds = [[-75, -180], [81, 180]], min_zoom = 2, max_zoom = 20, @@ -1396,7 +1396,7 @@ def __call__(self, **kwargs): ), ignMaps = TileProvider( url = 'https://wxs.ign.fr/{apikey}/geoportail/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE={style}&TILEMATRIXSET=PM&FORMAT={format}&LAYER={variant}&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', - attribution = 'Geoportail France', + attribution = 'Geoportail France', bounds = [[-75, -180], [81, 180]], min_zoom = 2, max_zoom = 18, @@ -1408,7 +1408,7 @@ def __call__(self, **kwargs): ), maps = TileProvider( url = 'https://wxs.ign.fr/{apikey}/geoportail/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE={style}&TILEMATRIXSET=PM&FORMAT={format}&LAYER={variant}&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', - attribution = 'Geoportail France', + attribution = 'Geoportail France', bounds = [[-75, -180], [81, 180]], min_zoom = 2, max_zoom = 18, @@ -1420,7 +1420,7 @@ def __call__(self, **kwargs): ), orthos = TileProvider( url = 'https://wxs.ign.fr/{apikey}/geoportail/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE={style}&TILEMATRIXSET=PM&FORMAT={format}&LAYER={variant}&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', - attribution = 'Geoportail France', + attribution = 'Geoportail France', bounds = [[-75, -180], [81, 180]], min_zoom = 2, max_zoom = 19, @@ -1438,7 +1438,7 @@ def __call__(self, **kwargs): min_zoom = 11, max_zoom = 18, bounds = [[1.56073, 104.11475], [1.16, 103.502]], - attribution = ' New OneMap | Map data © contributors, Singapore Land Authority', + attribution = '![](https://docs.onemap.sg/maps/images/oneMap64-01.png) New OneMap | Map data (C) contributors, Singapore Land Authority', name = 'OneMapSG.Default' ), Night = TileProvider( @@ -1447,7 +1447,7 @@ def __call__(self, **kwargs): min_zoom = 11, max_zoom = 18, bounds = [[1.56073, 104.11475], [1.16, 103.502]], - attribution = ' New OneMap | Map data © contributors, Singapore Land Authority', + attribution = '![](https://docs.onemap.sg/maps/images/oneMap64-01.png) New OneMap | Map data (C) contributors, Singapore Land Authority', name = 'OneMapSG.Night' ), Original = TileProvider( @@ -1456,7 +1456,7 @@ def __call__(self, **kwargs): min_zoom = 11, max_zoom = 18, bounds = [[1.56073, 104.11475], [1.16, 103.502]], - attribution = ' New OneMap | Map data © contributors, Singapore Land Authority', + attribution = '![](https://docs.onemap.sg/maps/images/oneMap64-01.png) New OneMap | Map data (C) contributors, Singapore Land Authority', name = 'OneMapSG.Original' ), Grey = TileProvider( @@ -1465,7 +1465,7 @@ def __call__(self, **kwargs): min_zoom = 11, max_zoom = 18, bounds = [[1.56073, 104.11475], [1.16, 103.502]], - attribution = ' New OneMap | Map data © contributors, Singapore Land Authority', + attribution = '![](https://docs.onemap.sg/maps/images/oneMap64-01.png) New OneMap | Map data (C) contributors, Singapore Land Authority', name = 'OneMapSG.Grey' ), LandLot = TileProvider( @@ -1474,7 +1474,7 @@ def __call__(self, **kwargs): min_zoom = 11, max_zoom = 18, bounds = [[1.56073, 104.11475], [1.16, 103.502]], - attribution = ' New OneMap | Map data © contributors, Singapore Land Authority', + attribution = '![](https://docs.onemap.sg/maps/images/oneMap64-01.png) New OneMap | Map data (C) contributors, Singapore Land Authority', name = 'OneMapSG.LandLot' ) ) diff --git a/contextily/place.py b/contextily/place.py index c6df4462..820d6f5c 100644 --- a/contextily/place.py +++ b/contextily/place.py @@ -4,7 +4,8 @@ import matplotlib.pyplot as plt from warnings import warn from .tile import howmany, bounds2raster, bounds2img, _sm2ll, _calculate_zoom -from .plotting import ATTRIBUTION, INTERPOLATION, ZOOM, add_attribution +from .plotting import INTERPOLATION, ZOOM, add_attribution +from . import providers class Place(object): @@ -54,6 +55,8 @@ class Place(object): def __init__(self, search, zoom=None, path=None, zoom_adjust=None, url=None): self.path = path + if url is None: + url = providers.Stamen.Terrain self.url = url self.zoom_adjust = zoom_adjust @@ -112,9 +115,7 @@ def _get_map(self): self.bbox_map = bbox return im, bbox - def plot( - self, ax=None, zoom=ZOOM, interpolation=INTERPOLATION, attribution=ATTRIBUTION - ): + def plot(self, ax=None, zoom=ZOOM, interpolation=INTERPOLATION, attribution=None): """ Plot a `Place` object ... @@ -135,8 +136,12 @@ def plot( algorithm to be passed to `imshow`. See `matplotlib.pyplot.imshow` for further details. attribution : str - [Optional. Defaults to standard `ATTRIBUTION`] Text to be added at the - bottom of the axis. + [Optional. Defaults to attribution specified by the url] + Text to be added at the bottom of the axis. This + defaults to the attribution of the provider specified + in `url` if available. Specify False to not + automatically add an attribution, or a string to pass + a custom attribution. Returns ------- @@ -162,6 +167,8 @@ def plot( axisoff = True ax.imshow(im, extent=bbox, interpolation=interpolation) ax.set(xlabel="X", ylabel="Y") + if isinstance(self.url, dict) and attribution is None: + attribution = self.url.get("attribution") if attribution: add_attribution(ax, attribution) if title is not None: @@ -178,13 +185,7 @@ def __repr__(self): def plot_map( - place, - bbox=None, - title=None, - ax=None, - axis_off=True, - latlon=True, - attribution=ATTRIBUTION, + place, bbox=None, title=None, ax=None, axis_off=True, latlon=True, attribution=None ): """Plot a map of the given place. diff --git a/contextily/plotting.py b/contextily/plotting.py index da3ce03d..e44cbeca 100644 --- a/contextily/plotting.py +++ b/contextily/plotting.py @@ -2,6 +2,7 @@ import numpy as np from . import tile_providers as sources +from . import providers from .tile import _calculate_zoom, bounds2img, _sm2ll, warp_tiles, _warper from rasterio.enums import Resampling from rasterio.warp import transform_bounds @@ -9,9 +10,6 @@ INTERPOLATION = "bilinear" ZOOM = "auto" -ATTRIBUTION = ( - "Map tiles by Stamen Design, under CC BY 3.0. " "Data by OpenStreetMap, under ODbL." -) ATTRIBUTION_SIZE = 8 @@ -20,12 +18,12 @@ def add_basemap( zoom=ZOOM, url=None, interpolation=INTERPOLATION, - attribution=ATTRIBUTION, + attribution=None, attribution_size=ATTRIBUTION_SIZE, reset_extent=True, crs=None, resampling=Resampling.bilinear, - **extra_imshow_args + **extra_imshow_args, ): """ Add a (web/local) basemap to `ax` @@ -50,8 +48,12 @@ def add_basemap( algorithm to be passed to `imshow`. See `matplotlib.pyplot.imshow` for further details. attribution : str - [Optional. Defaults to standard `ATTRIBUTION`] Text to be added at the - bottom of the axis. + [Optional. Defaults to attribution specified by the url] + Text to be added at the bottom of the axis. This + defaults to the attribution of the provider specified + in `url` if available. Specify False to not + automatically add an attribution, or a string to pass + a custom attribution. attribution_size : int [Optional. Defaults to `ATTRIBUTION_SIZE`]. Font size to render attribution text with. @@ -146,6 +148,11 @@ def add_basemap( if reset_extent: ax.axis((xmin, xmax, ymin, ymax)) + # Add attribution text + if url is None: + url = providers.Stamen.Terrain + if isinstance(url, dict) and attribution is None: + attribution = url.get("attribution") if attribution: add_attribution(ax, attribution, font_size=attribution_size) @@ -157,39 +164,40 @@ def _reproj_bb(left, right, bottom, top, s_crs, t_crs): return n_l, n_r, n_b, n_t -def add_attribution(ax, att=ATTRIBUTION, font_size=ATTRIBUTION_SIZE): +def add_attribution(ax, text, font_size=ATTRIBUTION_SIZE, **kwargs): """ - Utility to add attribution text - ... + Utility to add attribution text. Arguments --------- ax : AxesSubplot Matplotlib axis with `x_lim` and `y_lim` set in Web Mercator (EPSG=3857) - att : str - [Optional. Defaults to standard `ATTRIBUTION`] Text to be added at the - bottom of the axis. + text : str + Text to be added at the bottom of the axis. font_size : int - [Optional. Defaults to `ATTRIBUTION_SIZE`] Font size in which to render the attribution text. + [Optional. Defaults to 8] Font size in which to render + the attribution text. + **kwargs : Additional keywords to pass to the matplotlib `text` + method. Returns ------- - ax : AxesSubplot - Matplotlib axis with `x_lim` and `y_lim` set in Web - Mercator (EPSG=3857) and attribution text added + matplotlib.text.Text + Matplotlib Text object added to the plot. """ - txt = ax.text( + text_artist = ax.text( 0.005, 0.005, - att, + text, transform=ax.transAxes, size=font_size, path_effects=[patheffects.withStroke(linewidth=2, foreground="w")], wrap=True, + **kwargs, ) # hack to have the text wrapped in the ax extent, for some explanation see # https://stackoverflow.com/questions/48079364/wrapping-text-not-working-in-matplotlib wrap_width = ax.get_window_extent().width * 0.99 - txt._get_wrap_line_width = lambda: wrap_width - return ax + text_artist._get_wrap_line_width = lambda: wrap_width + return text_artist diff --git a/scripts/parse_leaflet_providers.py b/scripts/parse_leaflet_providers.py index 7f3fe861..61ec924d 100644 --- a/scripts/parse_leaflet_providers.py +++ b/scripts/parse_leaflet_providers.py @@ -15,6 +15,7 @@ import selenium.webdriver import git +import html2text GIT_URL = "https://github.com/leaflet-extras/leaflet-providers.git" @@ -96,6 +97,7 @@ def pythonize_data(data): Clean-up the javascript based dictionary: - rename mixedCase keys - substitute the attribution placeholders + - convert html attribution to plain text """ rename_keys = {"maxZoom": "max_zoom", "minZoom": "min_zoom"} @@ -105,15 +107,20 @@ def pythonize_data(data): new_data = [] for key, value in items: - if (key == "attribution") and ("{attribution." in value): - for placeholder, attr in attributions.items(): - if placeholder in value: - value = value.replace(placeholder, attr) - if "{attribution." not in value: - # replaced last attribution - break - else: - raise ValueError("Attribution not known: {}".format(value)) + if key == "attribution": + if "{attribution." in value: + for placeholder, attr in attributions.items(): + if placeholder in value: + value = value.replace(placeholder, attr) + if "{attribution." not in value: + # replaced last attribution + break + else: + raise ValueError("Attribution not known: {}".format(value)) + # convert html text to plain text + converter = html2text.HTML2Text(bodywidth=1000) + converter.ignore_links = True + value = converter.handle(value).strip() elif key in rename_keys: key = rename_keys[key] elif key == "url" and any(k in value for k in rename_keys): diff --git a/tests/test_ctx.py b/tests/test_ctx.py index f98e3990..a549b40c 100644 --- a/tests/test_ctx.py +++ b/tests/test_ctx.py @@ -313,6 +313,52 @@ def test_add_basemap(): assert_array_almost_equal(ax.images[0].get_array().mean(), 179.79593258881636) +def test_basemap_attribution(): + extent = (-11945319, -10336026, 2910477, 4438236) + + def get_attr(ax): + return [ + c + for c in ax.get_children() + if isinstance(c, matplotlib.text.Text) and c.get_text() + ] + + # default provider and attribution + fig, ax = matplotlib.pyplot.subplots() + ax.axis(extent) + ctx.add_basemap(ax) + txt, = get_attr(ax) + assert txt.get_text() == ctx.providers.Stamen.Terrain["attribution"] + + # override attribution + fig, ax = matplotlib.pyplot.subplots() + ax.axis(extent) + ctx.add_basemap(ax, attribution="custom text") + txt, = get_attr(ax) + assert txt.get_text() == "custom text" + + # disable attribution + fig, ax = matplotlib.pyplot.subplots() + ax.axis(extent) + ctx.add_basemap(ax, attribution=False) + assert len(get_attr(ax)) == 0 + + # specified provider + fig, ax = matplotlib.pyplot.subplots() + ax.axis(extent) + ctx.add_basemap(ax, url=ctx.providers.OpenStreetMap.Mapnik) + txt, = get_attr(ax) + assert txt.get_text() == ctx.providers.OpenStreetMap.Mapnik["attribution"] + + def test_attribution(): - f, ax = matplotlib.pyplot.subplots(1) - ax = ctx.add_attribution(ax, "Test") + fig, ax = matplotlib.pyplot.subplots(1) + txt = ctx.add_attribution(ax, "Test") + assert isinstance(txt, matplotlib.text.Text) + assert txt.get_text() == "Test" + + # test passthrough font size and kwargs + fig, ax = matplotlib.pyplot.subplots(1) + txt = ctx.add_attribution(ax, "Test", font_size=15, fontfamily="monospace") + assert txt.get_size() == 15 + assert txt.get_fontfamily() == ["monospace"]