Stamen Tile Provider migrates to Stadia. Needs update

Created on 4 October 2023, about 1 year ago
Updated 5 October 2023, about 1 year ago

Problem/Motivation

From maps stamen com:
"we're redirecting all traffic from our legacy tiles.stamen.com services and through URLs associated with our Fastly CDN account to Stadia's servers. This is to prevent any unnecessary service disruptions during the transition ...
After October 2023, the redirects could stop working and those still pointing to stamen.com or fastly.com URLs will see a blank map."

Proposed resolution

Change tile source to stadia server:
toner https://tiles.stadiamaps.com/tiles/stamen_toner/{z}/{x}/{y}{r}.png
toner-lite https://tiles.stadiamaps.com/tiles/stamen_toner_lite/{z}/{x}/{y}{r}.png
terrain https://tiles.stadiamaps.com/tiles/stamen_terrain/{z}/{x}/{y}{r}.png
watercolor https://tiles.stadiamaps.com/tiles/stamen_watercolor/{z}/{x}/{y}.jpg

Change URLs

- L.tileLayer('https://stamen-tiles-{s}.a.ssl.fastly.net/toner-lite/{z}/{x}/{y}{r}.png', {
+ L.tileLayer('https://tiles.stadiamaps.com/tiles/stamen_toner_lite/{z}/{x}/{y}{r}.png', {
maxZoom: 19,
- attribution: 'Map tiles by Stamen Design, Data by © OpenStreetMap under ODbL',
+ attribution: '© Stadia Maps © Stamen Design © OpenMapTiles © OpenStreetMap contributors',
}).addTo(map);

Remaining tasks

Update LeafletTileLayerProviders.php

Add:

$form['Stamen']['apikey'] = [
'#type' => 'textfield',
'#title' => $this->t('API key'),
'#default_value' => isset($settings['Stamen']) ? $settings['Stamen']['apikey'] : '',
'#description' => $this->t('Get your @key here @provider.', [
'@key' => $this->t('API Key'),
'@url' => 'https://stadiamaps.com/pricing/',
'@provider' => 'Stamen',
]),
];

📌 Task
Status

Active

Version

3.12

Component

Leaflet API

Created by

🇫🇷France tt12

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @tt12
  • 🇫🇷France tt12

    My workaround:
    Make changes in
    ...\modules\contrib\geolocation\modules\geolocation_leaflet\geolocation_leaflet.libraries.yml

    # TileLayer support.
    leaflet-providers:
      js:
        'js/leaflet-providers.min.js': {}
      dependencies:
        - geolocation_leaflet/leaflet
    

    Download, update and put leaflet-providers.min.js to ...\modules\contrib\geolocation\modules\geolocation_leaflet\js\
    https://cdnjs.cloudflare.com/ajax/libs/leaflet-providers/1.12.0/leaflet-...

    leaflet-providers.min.js:

            Stamen: {
    -            url: "https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}{r}.{ext}",
    +            url: "https://tiles.stadiamaps.com/tiles/{variant}/{z}/{x}/{y}{r}.{ext}",
                options: {
                    attribution: 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> &mdash; Map data {attribution.OpenStreetMap}',
                    subdomains: "abcd",
                    minZoom: 0,
                    maxZoom: 20,
    -                 variant: "toner",
    +                variant: "stamen_toner",
                    ext: "png"
                },
                variants: {
    -                Toner: "toner",
    +                Toner: "stamen_toner",
    -                TonerBackground: "toner-background",
    +               TonerBackground: "stamen_toner-background",
    -                TonerHybrid: "toner-hybrid",
    +               TonerHybrid: "stamen_toner-hybrid",
    -                TonerLines: "toner-lines",
    +                TonerLines: "stamen_toner-lines",
    -                TonerLabels: "toner-labels",
    +                TonerLabels: "stamen_toner-labels",
    -                TonerLite: "toner-lite",
    +                TonerLite: "stamen_toner-lite",
    
                    Watercolor: {
    -                    url: "https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}.{ext}",
    +                   url: "https://tiles.stadiamaps.com/tiles/{variant}/{z}/{x}/{y}.{ext}",
                        options: {
    -                        variant: "watercolor",
    +                      variant: "stamen_watercolor",
                            ext: "jpg",
                            minZoom: 1,
                            maxZoom: 16
                        }
                    },
                    Terrain: {
                        options: {
    -                        variant: "terrain",
    +                        variant: "stamen_terrain",
                            minZoom: 0,
                            maxZoom: 18
                        }
                    },
                    TerrainBackground: {
                        options: {
    -                        variant: "terrain-background",
    +                        variant: "stamen_terrain-background",
                            minZoom: 0,
                            maxZoom: 18
                        }
                    },
                    TerrainLabels: {
                        options: {
    -                        variant: "terrain-labels",
    +                        variant: "stamen_terrain-labels",
                            minZoom: 0,
                            maxZoom: 18
                        }
                    },
                    TopOSMRelief: {
                        url: "https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}.{ext}",
                        options: {
                            variant: "toposm-color-relief",
                            ext: "jpg",
                            bounds: [
                                [22, -132],
                                [51, -56]
                            ]
                        }
                    },
                    TopOSMFeatures: {
                        options: {
                            variant: "toposm-features",
                            bounds: [
                                [22, -132],
                                [51, -56]
                            ],
                            opacity: .9
                        }
                    }
                }
            },
    

    Update LeafletTileLayerProviders.php in ...\modules\contrib\geolocation\modules\geolocation_leaflet\src\ as described above

Production build 0.71.5 2024