Exemple serveis rasters ICGC

Veure codi font pantalla completa



      <html lang="ca">
      <head>
          <meta charset="utf-8">
          <meta name="viewport" content="width=device-width, initial-scale=1">
          <title>ICGC - Mapes Base</title>
          <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
              integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="" />
          <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
              integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
          <style>
              html,
              body {
                  height: 100%;
                  margin: 0;
              }
              #map {
                  width: 100%;
                  height: 100%;
              }
          </style>
      </head>
      <body>
          <div id="map"></div>
          <script>
              const topo = L.tileLayer('https://geoserveis.icgc.cat/servei/catalunya/mapa-base/wmts/topografic/MON3857NW/{z}/{x}/{y}.png', {
                  maxZoom: 20,
                  attribution: '©'
              });
              const topogris = L.tileLayer('https://geoserveis.icgc.cat/servei/catalunya/mapa-base/wmts/topografic-gris/MON3857NW/{z}/{x}/{y}.png', {
                  maxZoom: 20
              });
              const simplificat = L.tileLayer('https://geoserveis.icgc.cat/servei/catalunya/mapa-base/wmts/simplificat/MON3857NW/{z}/{x}/{y}.png', {
                  maxZoom: 20
              });
              const admin = L.tileLayer('https://geoserveis.icgc.cat/servei/catalunya/mapa-base/wmts/administratiu/MON3857NW/{z}/{x}/{y}.png', {
                  maxZoom: 20
              });
              const estandard = L.tileLayer('https://geoserveis.icgc.cat/servei/catalunya/mapa-base/wmts/estandard/MON3857NW/{z}/{x}/{y}.png', {
                  maxZoom: 20
              });
              const orto = L.tileLayer('https://geoserveis.icgc.cat/servei/catalunya/mapa-base/wmts/orto/MON3857NW/{z}/{x}/{y}.png', {
                  maxZoom: 20
              });
              const ortogris = L.tileLayer('https://geoserveis.icgc.cat/servei/catalunya/mapa-base/wmts/orto-gris/MON3857NW/{z}/{x}/{y}.png', {
                  maxZoom: 20
              });
              const hibrid = L.tileLayer('https://geoserveis.icgc.cat/servei/catalunya/mapa-base/wmts/orto-hibrida/MON3857NW/{z}/{x}/{y}.png', {
                  maxZoom: 20
              });
              const map = L.map('map', {
                  attributionControl: false,
                  minZoom: 6,
                  center: [41.8, 1.7],
                  zoom: 8,
                  layers: [topo]
              });
              const baseLayers = {
                  'Topogràfic': topo,
                  'Topogràfic gris': topogris,
                  'Simplificat': simplificat,
                  'Administratiu': admin,
                  'Estàndard': estandard,
                  'Orto': orto,
                  'Orto gris': ortogris,
                  'Orto híbrida': hibrid
              };
              const layerControl = L.control.layers(baseLayers, null, { collapsed: false }).addTo(map);
          </script>
      </body>
      </html>