Get started with esri-leaflet-related CDN

Apache-2.0 licensed

ESRI ArcGIS basemaps and features integrate with Leaflet library.

Tags:
  • esri
  • leaflet
  • related
  • ArcGIS
  • API
  • plugin
  • query

Stable version

Copied!

How to start using esri-leaflet-related CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with esri-leaflet-related CDN - cdnhub.io</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/leaflet/1.7.1/leaflet.css"/>
  <script src="https://cdn.jsdelivr.net/leaflet/1.7.1/leaflet.js"></script>
  <script src="https://cdn.cdnhub.io/esri-leaflet-related/3.0.0/esri-leaflet-related.js"></script>
  <style>
    #map { height: 400px; width: 100%; }
  </style>
</head>
<body>
  <div id="map"></div>
  <script>
    const map = L.map('map').setView([51.505, -0.09], 13);

    L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
      attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
      maxZoom: 19
    }).addTo(map);

    // Add Esri basemap
    EsriLeaflet.esriUrl = 'https://services.arcgisonline.com/ArcGIS/rest/services';
    EsriLeaflet.addEsriBasemap('Topographic');
    EsriLeaflet.baseLayers.Topographic.addTo(map);

    // Add Esri feature group
    const featureGroup = L.featureGroup().addTo(map);

    // Add Esri GeoJSON data
    fetch('path/to/your/geojson.json')
      .then(response => response.json())
      .then(data => {
        L.geoJSON(data, {
          onEachFeature: function (feature, layer) {
            layer.bindPopup(feature.properties.name);
          }
        }).addTo(featureGroup);
      });
  </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions