Skip to content

Add Swisstopo Integration #4761

Description

@grantfitzsimmons

🔴 At this time, this has not been identified as a blocker for GeoSpecify. This is a request for a future enhancement.

Is your feature request related to a problem? Please describe.
We've heard from numerous Swiss institutions that being able to integrate with Swisstopo would be an incredibly useful utility for them. Since we already have integrated Leaflet into Specify, it seems natural to extend this to have all the Swisstopo base maps and layers so that they can effectively visualize their data on the maps provided by the service.

I've created a new leaflet layers JSON file that contains many of these maps as a starting point. From the troubleshooting I've done and based on discussions with Max, it seems that we'll need to add support for the coordinate projection system these maps rely on. When importing this file directly into Specify, it repeatedly reports that there is a bad request because tile is out of bounds.

image

topolayers.json.zip

Swisstopo uses the coordinate projection system LV95 (EPSG:2056), which is captured in the layerOptions as

"crs": "L.CRS.EPSG2056"

Fortunately, there is already a plugin that adds support for this CRS: https://leaflet-tilelayer-swiss.karavia.ch/installation

image

It may be as simple as studying the implementation done in this repository and adding it here:
https://github.com/rkaravia/Leaflet.TileLayer.Swiss

I am happy to help create the default leaflet layers file after the CRS is supported.

For example, here's a snippet you can add in a new leaflet layer app resource for testing/evaluation:
leaflet-layers-swisstopo.json.zip

{
  "baseMaps": {
    "Street Map (OpenStreetMap)": {
      "endpoint": "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
      "serverType": "tileServer",
      "layerOptions": {
        "maxZoom": 23,
        "attribution": "Esri, HERE, Garmin, USGS, Intermap, INCREMENT P, NRCan, Esri Japan, METI, Esri China (Hong Kong), Esri Korea, Esri (Thailand), NGCC, (c) OpenStreetMap contributors, and the GIS User Community"
      },
      "styles": ["auto-dark-mode"]
    },
    "Street Map (ESRI)": {
      "endpoint": "https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}",
      "serverType": "tileServer",
      "layerOptions": {
        "maxZoom": 23,
        "attribution": "Esri, HERE, Garmin, USGS, Intermap, INCREMENT P, NRCan, Esri Japan, METI, Esri China (Hong Kong), Esri Korea, Esri (Thailand), NGCC, (c) OpenStreetMap contributors, and the GIS User Community"
      },
      "styles": ["auto-dark-mode"]
    },
    "Swisstopo": {
        "endpoint": "https://wmts0.geo.admin.ch/1.0.0/{layer}/default/{timestamp}/2056/{z}/{x}/{y}.{format}",
        "serverType": "tileServer",
        "layerOptions": {
            "minZoom": 17,
            "maxZoom": 27,
            "subdomains": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
            "attribution": "&copy; <a href='https://www.swisstopo.admin.ch/fr'>Swisstopo</a>",
            "format": "jpeg",
            "layer": "ch.swisstopo.pixelkarte-farbe",
            "timestamp": "current",
            "crs": "L.CRS.EPSG2056"
        },
        "styles": [
            "auto-dark-mode"
        ]
    }
  }
}

Reported By
Several Swiss Museums of Natural History (Bern, Basel, Lausanne)

Metadata

Metadata

Assignees

No one assigned

    Labels

    1 - RequestA request made by a member of the communitygeospecify

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions