Skip to content

URL Parameters

Adjust the parameters in the URL of the map viewer to have full control over what is shown on the map. Use the URL to reproduce what you see right now on the map viewer anywhere.

Introduction

The query string in the map viewer URL reflects what is currently displayed on the map. The query string is the part of the URL after the question mark and is composed of key-value pairs like in this example:

txt
https://map.geo.admin.ch/#/map?
   lang=en&
   center=2660000,1190000&
   z=1&
   topic=ech&
   layers=ch.swisstopo.swisstlm3d-wanderwege&
   bgLayer=ch.swisstopo.pixelkarte-farbe

These key-value pairs are the "URL parameters" we present in the following.

TIP

The map viewer comes in two flavors:

  • https://map.geo.admin.ch/#/map: The full-featured web map application that you see it on map.geo.admin.ch.

  • https://map.geo.admin.ch/#/embed: A simplified version with less menus suitable for embedding the map viewer on your webpage. See the tutorial about HTML iframes for details.

Parameter Overview

A list of all URL parameters available at map.geo.admin.ch.

ParameterDescriptionValuesExample
langLanguage of the applicationde, fr, it, rm, enhttps://map.geo.admin.ch/#/map?lang=rm
zZoom level0, 1, ..., 13https://map.geo.admin.ch/#/map?z=12
centerCoordinates of center of the map view in LV95. The first value is the longitude-equivalent/easting, the second value is the latitude-equivalent/northing. The two are separated by a comma.• Easting: between 2,450,000 and 2,900,000
• Northing: between 1,050,000 and 1,350,000
https://map.geo.admin.ch/#/map?center=2700000,1140000
topicTopic selected in the menu. Topics are groups of related datasets.blw, are, bafu, swisstopo, kgs, funksender, nga, ivs, sachplan, geol, luftbilder, wildruhezonen, vu, inspire, echhttps://map.geo.admin.ch/#/map?topic=vu
bgLayerBackground layerch.swisstopo.pixelkarte-farbe, ch.swisstopo.pixelkarte-grau, voidLayerhttps://map.geo.admin.ch/#/map?bgLayer=ch.swisstopo.pixelkarte-grau
layersThe layers in use. Each layer can be configured, see layer parameters for details.See layer parametershttps://map.geo.admin.ch/#/map?layers=WMS
timeSliderSets the year of the time slider. Format: YYYY, e.g. 1981. Can be used with all "timeEnabled" levels. Special case WMS: An empty value (``timeSlider=`) means that the data for all years is displayed.0000, 0001, ...., 9999https://map.geo.admin.ch/#/map?layers=ch.swisstopo.lubis-luftbilder_farbe&timeSlider=1981
crosshairDescribes the type, easting and northing of a crosshair that is drawn on the map.• Type: cross, circle, bowl, point, marker
• Easting/northing: see center
(1) https://map.geo.admin.ch/#/map?center=2538700,1165890&z=6&crosshair=circle
(2) https://map.geo.admin.ch/#/map?crosshair=cross,2600981,1197448
swisssearchA query sent to the service behind the search bar. The map viewer shows the search result as if you typed it into the search bar manually.
ℹ️ To center the map automatically on the first search result, use &swisssearch_autoselect=true, see also the iframe documentation
Any text(1) https://map.geo.admin.ch/#/map?swisssearch=berges 37 payerne
(2) https://map.geo.admin.ch/#/map?swisssearch=7.04983,46.42928
compareRatioThe relative position of the swipe elements when comparison mode is enabledFloating point value between 0 and 1https://map.geo.admin.ch/#/map?compareRatio=0.5&bgLayer=ch.swisstopo.pixelkarte-farbe&layers=ch.swisstopo.geologie-generalkarte-ggk200
featureInfoHow to display the tooltip. More details in the corresponding section.default, bottomPanel, tooltip, nonehttps://map.geo.admin.ch/#/map?layers=ch.bav.haltestellen-oev@features=8500010&lang=fr&featureInfo=bottomPanel
geolocationWhether to enable geolocation.true, falsehttps://map.geo.admin.ch/#/map?lang=fr&geolocation=true
noSimpleZoomWhether the CTRL/CMD button must be pressed to zoom. This only takes effect in the embed mode.true, falsehttps://map.geo.admin.ch/#/embed?&noSimpleZoom=true

Layer Parameters

Layer parameters in query parameter layers describe which layers are chosen and how those layers are configured.

For example, a layer configuration in the map viewer that looks like this

Layer configuration

is represented by a layers query parameter like this:

txt
layers=ch.swisstopo.zeitreihen@year=2018,t,0.6
       ╰──────────┬──────────╯╰───┬────╯╰┬╯╰┬╯
             identifier       timestamp  │  ╰ opacity  
                                     visibility

where

  • identifier: The "technical name" of the layer, for example ch.swisstopo.zeitreihen. You can find this identifier either in the URL when choosing the layer in the map viewer or through geocat. A full list of available layers can be listed by the /collections endpoint of the STAC API.
  • timestamp: Designates the version in time of the layer. Currently you can only select a version by year using the @year= prefix.
  • visibility: t (or empty) for "true" if the layer is displayed on the map, f for "false" if the layer is listed in the menu but not displayed on the map
  • opacity: The transparency of the layer. The value ranges from 0.0 (transparent) to 1.0 (opaque).

The layer parameters are separated by comma (,). You can have multiple layers by separating them with a semicolon (;).

As an illustration:

Layer parameters

Feature Selection

Center the map on a selected feature by using a special layer parameter: @features.

For example, a map like this:

is represented by a URL like

https://map.geo.admin.ch/#/embed?layers=ch.astra.unfaelle-personenschaeden_fahrraeder@features=769AE49DEC6D0106E0530A839427D480

Multiple features are separated by a colon (:) like in this example

with URL

https://map.geo.admin.ch/#/embed?layers=ch.astra.unfaelle-personenschaeden_fahrraeder@features=203F7E8B2D110152E0630AB38B028D9D:769AE49DEC6D0106E0530A839427D480:98CDD8F6D5493E0BE05329B9D80AAB05

Tooltip

The query parameter featureInfo lets you choose from different options how to display a tooltip. A tooltip is a text box with metadata that pops up when you select a feature in the map viewer.

The available options are: