Leaflet 1.5.1 | GeoJSON

by spydmobile

HTML

<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<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: [60, -111],
  zoom: 4
});

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



$.getJSON("https://lrgs.api.sparcsonline.com/api/getStationsGeoJSON", function(data) {
    L.geoJson(data, {
        style: something => {
        console.log(something)
        }
    }).addTo(map);
})