Skip to content
George Owen edited this page Jul 31, 2023 · 52 revisions

What is Esri Leaflet?

Esri Leaflet is a collection of API plugins for the open-source javascript mapping library Leaflet. It is not a fork/improvement/replacement for Leaflet, but rather additional code aimed at making it convenient, intuitive (and even pleasurable!) to mashup data and ArcGIS location services in Leaflet applications.

Will Esri Leaflet replace the ArcGIS API for JavaScript?

Absolutely not. Esri Leaflet does not have nearly the level of API completeness as the ArcGIS API for JavaScript and does not provide coverage for all use cases and services that ArcGIS provides. Esri Leaflet only concerns itself with the most commonly used pieces, aiming to make them more easily accessible in Leaflet. Esri Leaflet does not support WebGL, 3D scenes or map rotation.

While the project is open source, we have no plans to expand the surface area of this API beyond what is already present. This means that you should only choose Esri Leaflet for a project if the current (and future) requirements are already covered. If you're drawn to Leaflet because it plays nice with your JavaScript bundler/loader/framework of choice, check out esri-loader and the arcgis-webpack-plugin.

If you are interested in a comparison of the ArcGIS API for Javascript and Esri Leaflet check out this presentation. There is also a video of the talk given at the 2018 Esri Developer Summit.

Why use Esri Leaflet?

Esri Leaflet greatly simplifies incorporating ArcGIS services into Leaflet applications. We see two different primary use cases for the plugins that we've created.

  • Esri Leaflet is a great choice for developers who are excited about Leaflet and want to incorporate live authoritative content from government agencies and other organizations instead of relying on ETL (followed by republishing static/duplicative content).
  • Because Esri offers rock bottom pricing for hosting spatial data in the cloud that can interpret spatial queries and emit GeoJSON, we hope that Esri Leaflet also provides an appealing alternative to developers who love Leaflet and prefer to skip maintaining a PostGIS instance and writing their own services to execute spatial queries.

Because of Leaflet's rich plugin ecosystem Esri Leaflet users can also leverage Leaflet plugins to accent some of the features that are not implemented by Esri Leaflet. A list of good plugins can be found in this FAQ as well as the full Leaflet plugin list.

What are the goals of Esri Leaflet?

  • To provide small reusable components for consuming ArcGIS location services in Leaflet.
  • To provide a solid core of utilities that can be used to help developers integrate ArcGIS location services into Leaflet
  • Foster an ecosystem of plugins for consuming ArcGIS location services in Leaflet. Esri Leaflet Geocoder is the first.
  • Provide wrappers for common tasks like visualizing and querying feature services.

Can I use Esri Leaflet with Leaflet Version 1.x?

Yes! version 2.x of Esri Leaflet is compatible with Leaflet version 1.x.

If you'd like to continue building applications that target Leaflet 0.7.x, please use Esri Leaflet 1.x.

How do you decide what features get included in Esri Leaflet?

  • Will including the feature benefit a significant number of developers?
  • Will including the feature allow for lots of new applications of Esri Leaflet?
  • Will including the feature significantly impact the size of Esri Leaflet?
  • How much work will it be to implement the feature?
  • Are there multiple people who need or are suggesting the feature?

Features are also sometimes built out as separate plugins that rely on Esri Leaflet Core. The Esri Leaflet Geocoder is one such plugin.

If a feature looks like it would be beneficial, but might impact the size of the library or require a significant increase in complexity, it might work better as a plugin.

I have an idea! What should I do?

Please file an issue. Issues are a great way to discuss new ideas, build consensus and talk about implementation details.

When will you support "x"?

Depends on what "x" is. While Esri Leaflet is maintained by Esri staff there isn't enough time to impliment every new feature, so we make no guarantees regarding the availability of individual features and offer no development roadmap or product lifecycle to support planning. In general, we are happy to receive suggestions. Please first check to see whether an issue has already been filed to request inclusion of the feature in the issue tracker. Alternatively, the feature might be a good candidate for a plugin.

Esri Leaflet provides generic helper methods for making requests to ArcGIS REST APIs and for converting between ArcGIS Geometries and GeoJSON objects that can be used by Leaflet. These methods can be combined to support a wide variety of services with some extra work.

Can you implement feature "x"?

It depends if it meets the above criteria for if a feature should be included. Filing an issue is a great way to get a discussion started.

I want to contribute. How can I help?

Check out the contributing guide!

I built something with Esri Leaflet can I show you?

Absolutely! Share it on twitter with @patrickarlt, @geogangster or @esripdx. You can add your project to the list in the readme too.

I built a reusable component (layer type, api wrapper, ui control etc...) can I contribute it to Esri Leaflet?

It depends if it meets the criteria above. The feature might be a perfect fit in Esri Leaflet core or it may work better as a separate plugin. In general, we are happy to chat about it. Filing an issue is typically the best way to get the discussion started.

Which services require authentication?

Most ready-to-use location services require authentication with an API key or oAuth 2 token. See the security and authentication section for more details.

Accessing public services hosted on ArcGIS Online or ArcGIS Enterprise does not require authentication.

What are some good Leaflet Plugins?

Make sure you check out the full list of Leaflet plugins.

What browsers does Esri Leaflet support?

Esri Leaflet supports the same browsers as Leaflet http://leafletjs.com/#features with the exception of Internet Explorer 7.

What versions of ArcGIS Server does Esri Leaflet support?

In general Esri Leaflet supports any version of ArcGIS Server that is not retired. You can see if a version of ArcGIS Server is supported on the Product Life Cycle page.

If you server is not setup for CORS (pre 10.1) you will either need to setup CORS on your server or set the useCORS option to false when using Esri Leaflet.

ArcGIS Server 9.3 is not supported. There are known bugs with L.esri.DynamicMapLayer.

Upgrading the version of Esri Leaflet used in my app broke everything!

The single most common breaking change that developers encounter unexpectedly is our move from expecting the urls of ArcGIS Services to be provided as a string in Service, Task and Layer constructors to providing them within an options object.

In Esri Leaflet 0.0.0-beta.x and 1.0.0-rc.x we instantiated L.esri.FeatureLayer's like this:

var myUrl = 'http://services.arcgis.com/uCX../arcgis/rest/services/yourService/FeatureServer/0';
L.esri.featureLayer(myUrl);

Starting with version 1.0.0 final (and including version 2.0.0 which is compatible with Leaflet's own 1.x version) the constructor should look like this:

var myUrl = 'http://services.arcgis.com/uCX../arcgis/rest/services/yourService/FeatureServer/0';
L.esri.featureLayer( { 
  url: myUrl
});

check out the API reference for more information.

Compatibility Mode

Esri Leaflet does not work when IE<=11 compatibility mode is enabled. see this issue for more info.

TypeScript Typings

Esri Leaflet isn't a native TypeScript project, but typings can be found in DefinitelyTyped. Thank you @strajuser for this contribution!