datasette-geojson-map icon indicating copy to clipboard operation
datasette-geojson-map copied to clipboard

Allow switching layers

Open eyeseast opened this issue 3 years ago • 0 comments

The current configuration setup assumes one tile layer:

datasette-geojson-map:
    tile_layer: https://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.{ext}
    tile_layer_options:
      attribution: >-
        Map tiles by <a href="http://stamen.com">Stamen Design</a>, 
        under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. 
        Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, 
        under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.
      subdomains: abcd
      minZoom: 1
      maxZoom: 16
      ext: jpg

What if I configured more than one layer, as an array. Then I could add a layer switch control.

datasette-geojson-map:
    tile_layers: 
        name: Stamen Terrain
        url: https://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.{ext}
        options:
          attribution: >-
            Map tiles by <a href="http://stamen.com">Stamen Design</a>, 
            under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. 
            Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, 
            under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.
          subdomains: abcd
          minZoom: 1
          maxZoom: 16
          ext: jpg

    name: OSM
    url: https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png
    options:
        attribution: &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors

eyeseast avatar Jan 23 '22 16:01 eyeseast