Skip to main content Link Menu Expand (external link) Document Search Copy Copied


Leaflet.TileLayer.Swiss is a Leaflet plugin for displaying national maps of Switzerland using map tiles from Swisstopo. This plugin is not affiliated with or endorsed by Swisstopo.

Quick start

The following code explains all steps required to get started with Leaflet.TileLayer.Swiss. It corresponds to the example at the top of the page. In order to run it locally, copy the 2 files below into a folder on your computer, then open quick-start.html in your browser.


<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Quick start</title>

  <!-- Include Leaflet CSS -->
  <link rel="stylesheet" href=""
        crossorigin integrity="sha384-o/2yZuJZWGJ4s/adjxVW71R+EO/LyCwdQfP5UWSgX/w87iiTXuvDZaejd3TsN7mf">

    /* Set full width and height for the map */
    html, body, #mapid { height: 100%; margin: 0; }

  <!-- Element where the map will be attached -->
  <div id="mapid"></div>

  <!-- Include Leaflet and Leaflet.TileLayer.Swiss JavaScript -->
  <script src=""
          crossorigin integrity="sha384-okbbMvvx/qfQkmiQKfd5VifbKZ/W8p1qIsWvE1ROPUfHWsDcC8/BnHohF7vPg2T6">
  <script src=""
          crossorigin integrity="sha384-M4p8VfZ8RG6qNiPYA3vOCApQXAlLtnJXVPdydMYPAsvvIDsWp2dqqzF2OEeWWNhy">

  <!-- Include quick start JavaScript -->
  <script src="quick-start.js"></script>



// Create map and attach id to element with id "mapid"
var map ='mapid', {
  // Use LV95 (EPSG:2056) projection
  crs: L.CRS.EPSG2056,

// Add Swiss layer with default options;

// Center the map on Switzerland

// Add a marker with a popup in Bern
L.marker(L.CRS.EPSG2056.unproject(L.point(2600000, 1200000))).addTo(map)