Leaflet plugins for ArcGIS Services. Currently Esri Leaflet supports loading Esri basemaps and feature services, as well as tiled, dynamic and image map services.
The goal of Esri Leaflet is not to replace the ArcGIS API for JavaScript, but rather to provide small components to allow developers to build mapping applications with Leaflet.
Currently Esri Leaflet is in development and should be thought of as a beta or preview.
There are loads of demos showing the features of Esri Leaflet that will help you get started.
Here is a quick example to get you started. Just change the paths to point to the proper libraries and go.
<!DOCTYPE html>
<html>
<head>
<!-- Load Leaflet from CDN-->
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<!-- Load Esri Leaflet from CDN -->
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet/0.0.1-beta.5/esri-leaflet.js"></script>
<style>
html, body, #map {
width : 100%;
height : 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map = L.map('map').setView([45.528, -122.680], 13);
L.esri.basemapLayer("Gray").addTo(map);
var parks = new L.esri.FeatureLayer("http://services.arcgis.com/rOo16HdIMeOBI4Mb/arcgis/rest/services/Portland_Parks/FeatureServer/0", {
style: function () {
return { color: "#70ca49", weight: 2 };
}
}).addTo(map);
var popupTemplate = "<h3>{NAME}</h3>{ACRES} Acres<br><small>Property ID: {PROPERTYID}<small>";
parks.bindPopup(function(feature){
return L.Util.template(popupTemplate, feature.properties)
});
</script>
</body>
</html>
A full API Reference and plenty of sample code can be found at the Esri Leaflet website.
If you are interested in contributing to Esri Leaflet or are interetsed in seeing what is coming up next checkout the development roadmap.
- Will Esri Leaflet replace the ArcGIS API for JavaScript?
- What are the goals of Esri Leaflet?
- When will Esri Leaflet leave beta?
- How do you decide what features get included in Esri Leaflet?
- I have an idea! What should I do?
- When will you support "x"?
- Can you implement feature "x"?
- When will feature "x" get done?
- I want to contribute. How can I help?
- I built something with Esri Leaflet can I show you?
- I built a reusable component (layer type, api wrapper, ui control ect...) can I contribute it to Esri Leaflet?
- What are some good Leaflet Plugins?
Feel free to add your projects to this list!
Make Sure you have the Grunt CLI installed.
- Fork and clone Esri Leaflet
cd
into theesri-leaflet
folder- Install the dependencies with
npm install
- run
grunt
from the command line. This will start the web server locally at http://localhost:8001 and start watching the source files and running linting and testing commands. - Make your changes and create a pull request
- Leaflet version 0.7 or higher is required but the latest version is recommended.
- Leaflet.markercluster - for
L.esri.ClusteredFeatureLayer
- Leaflet.heat - only for
L.esri.HeatmapLayer
. - Esri Leaflet Geocoder - for geocoding functionality.
Find a bug or want to request a new feature? Please let us know by submitting an issue.
Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.
L.esri.DymanicMapLayer
was originally code from https://github.com/sanborn/leaflet-ags/blob/master/src/AGS.Layer.Dynamic.js
Copyright 2013 Esri
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
A copy of the license is available in the repository's license.txt file.
[](Esri Tags: ArcGIS Web Mapping Leaflet) [](Esri Language: JavaScript)