Leaflet (latest/1.7.1) Boilerplate

A Leaflet map boilerplate that is being updated when new Leaflet versions are released. It features the Stamen Terrain basemap and nothing else. Fork it, play around with it, use it to help others! Resources: - https://leafletjs.com/reference - https://gis.stackexchange.com/

by Stefan

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.css">
<div id="map">

</div>

CSS

#map {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

JavaScript

const map = L.map('map').setView([48.2083537, 16.3725042], 11)

L.tileLayer('https://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.jpg', {
  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'
}).addTo(map)