Leaflet 1.5.1 | GeoJSON

by Dennis Bauszus

HTML

<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css">
<div id="map" class="map"></div>

CSS

html,
body {
  height: 100%;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
}

.map {
  height: 100%;
  width: 100%;
}

JavaScript

const map = L.map('map', {
  center: [53.2, -1.7],
  zoom: 6
});

L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_nolabels/{z}/{x}/{y}.png').addTo(map);

L.geoJson({
  "type": "FeatureCollection",
  "crs": {
    "type": "name",
    "properties": {
      "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
    }
  },
  "features": [{
    "type": "Feature",
    "properties": {

    },
    "geometry": {
      "type": "Polygon",
      "coordinates": [
        [
          [-5.61, 50.11],
          [-2.73, 51.42],
          [-4.90, 51.82],
          [-4.00, 53.37],
          [-2.51, 53.39],
          [-3.22, 54.87],
          [-1.89, 55.63],
          [0.56, 52.85],
          [1.98, 52.59],
          [0.81, 51.44],
          [1.91, 51.34],
          [-5.61, 50.11]
        ]
      ]
    }
  }]
}).addTo(map);