Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

esri-leaflet-renderers

Esri13.1kApache-2.03.0.1

esri-leaflet plugin for rendering

arcgis, esri, esri leaflet, gis, leaflet plugin, mapping, renderers, symbology

readme

Esri Leaflet Renderers

Leaflet plugin for ArcGIS Feature Services. Esri Leaflet Renderers works in conjunction with the Esri Leaflet Plugin to draw feature services using renderers defined by the service.

travis

The sole purpose of this plugin is to allow L.esri.FeatureLayer to automatically take on renderers defined in ArcGIS Feature Services. Esri Leaflet Renderers works in conjunction with Esri Leaflet, but it does not add any additional methods or properties to the class that it extends.

Example

Take a look at the live demo.

You can also find a side by side comparison of the ArcGIS API for JavaScript here.

<!DOCTYPE html>
<html>
  <head>
    <meta charset=utf-8 />
    <title>Renderer from Service</title>
    <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />

    <!-- Load Leaflet from CDN-->
    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" />
    <script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet-src.js"></script>

    <!-- Load Esri Leaflet from CDN -->
    <script src="https://unpkg.com/esri-leaflet@3"></script>

    <!-- Load Esri Leaflet Renderers -->
    <!-- This will hook into Esri Leaflet to get renderer info when adding a feature layer -->
    <script src="https://unpkg.com/esri-leaflet-renderers@3"></script>

    <style>
      body {margin:0;padding:0;}
      #map {position: absolute;top:0;bottom:0;right:0;left:0;}
    </style>
  </head>
  <body>

    <div id="map"></div>

    <script>
      var map = L.map('map').setView([37.837, -122.479], 6);
      L.esri.basemapLayer('Streets').addTo(map);

      // this plugin will get the predefined renderer from the layer's drawing info at:
      // https://sampleserver6.arcgisonline.com/arcgis/rest/services/Earthquakes_Since1970/MapServer/0
      // use that renderer to style the polygons drawn on the map
      L.esri.featureLayer({
        url: 'https://sampleserver6.arcgisonline.com/arcgis/rest/services/Earthquakes_Since1970/MapServer/0'
      }).addTo(map);
    </script>

  </body>
</html>

Development Instructions

  1. Fork and clone Esri Leaflet Renderers
  2. cd into the esri-leaflet-renderers folder
  3. Install the dependencies with npm install
  4. Run npm start from the command line. This will compile minified source in a brand new dist directory, launch a tiny web server and begin watching the raw source for changes.
  5. Run npm test to make sure you haven't introduced a new 'feature' accidentally.
  6. Make your changes and create a pull request

Limitations

  • As of 2.0.1, It is possible to override aspects of polyline and polygon symbology defined by the service in the FeatureLayer constructor. For points, it is not.
  • Simple Marker symbols do not support rotation (ie: the 'angle' property is ignored).
  • Polygons only support solid fill. This does not include advanced fill types like PictureFill, Backward Diagonal, DiagonalCross, etc.
  • Text symbols are not supported.

Dependencies

  • Esri Leaflet Renderers 1.x (available on CDN) can be used in apps alongside:

  • Esri Leaflet Renderers 2.x (available on CDN) can be used in apps alongside:

  • Esri Leaflet Renderers 3.x (available on CDN) can be used in apps alongside:

Versioning

For transparency into the release cycle and in striving to maintain backward compatibility, Esri Leaflet is maintained under the Semantic Versioning guidelines and will adhere to these rules whenever possible.

Releases will be numbered with the following format:

<major>.<minor>.<patch>

And constructed with the following guidelines:

  • Breaking backward compatibility bumps the major while resetting minor and patch
  • New additions without breaking backward compatibility bumps the minor while resetting the patch
  • Bug fixes and misc changes bumps only the patch

For more information on SemVer, please visit http://semver.org/.

Contributing

Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.

Licensing

Copyright © 2015-2018 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

http://www.apache.org/licenses/LICENSE-2.0

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 file.

changelog

esri-leaflet-renderers change log

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning. This change log adheres to standards from Keep a CHANGELOG.

Unreleased

3.0.1 - 2023-08-28

Updated

  • Updated dependencies (#191)
  • Updated version export style (#190)

3.0.0 - 2022-06-24

Changed

  • Updated esri-leaflet peer dependency version in package.json so that there will not be errors when installing via NPM (#177)

Updated

  • Fixed renderers when working with esri-leaflet-cluster (#179)

2.1.3 - 2022-03-08

Updated

  • Updated dependencies and changed build-related settings to be consistent with Esri Leaflet (#171)

2.1.2 - 2020-07-06

Changed

  • Update esri-leaflet-cluster version in package.json (🙏francharbo🙏 #160)

2.1.1 - 2020-06-23

Fixed

  • Follow-up to #144 to fix the clustering changes (🙏jgravois🙏 #158)

2.1.0 - 2020-06-19

Added

Changed

  • esri-leaflet, leaflet, and leaflet-shape-markers are now peer dependencies (#154)

2.0.6 - 2017-06-02

Fixed

  • bug that mangled server side color interpretation

2.0.5 - 2017-06-02

Added

  • support for loading via AMD
  • support for Node 7

Fixed

  • ensure that point geometry layers are assigned to Leaflet's markerPane by default

2.0.4 - 2016-08-17

Added

  • support for picture marker symbols stored outside the ArcGIS ecosystem

Fixed

  • ensure the plugin only fires one metadata requests
  • ensure that [esriSLSNull] symbol types display correctly

2.0.3 - 2016-07-01

Added

  • support for base64 encoded PictureMarkerSymbols. thx @ynunokawa!
  • support for overriding service symbology with 'drawingInfo' provided in L.esri.featureLayers constructor. thx @ynunokawa!
var fl = L.esri.featureLayer({
  url: 'http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/0',
  drawingInfo: {
    "renderer": {
      "type": "simple",
      "symbol": {
        "type": "esriSMS",
        "style": "esriSMSCircle",
        "color": [115, 178, 255, 255],
        "size": 10,
        "angle": 0,
        "xoffset": 0,
        "yoffset": 0,
        "outline": {
         "color": [0, 0, 0, 255],
         "width": 1
        }
      },
      "label": "",
      "description": ""
    },
    "transparency": 0,
    "labelingInfo": null
  }
}).addTo(map);

Fixed

  • odd cases where a subset of features were drawn with leaflet symbology.

Added

2.0.2 - 2016-06-15

Added

  • now its possible for individual featureLayers to not utilize the renderer defined by the service (when ignoreRenderer: true is included as a contructor option)

Fixed

  • Ensured that its possible to specify custom panes for marker symbols (thanks @pbastia!)
  • Race condition encountered when metadata is slow to load

Changed

  • Build system refactored to use latest Rollup and Rollup plugins.
  • Reworked bundling directives for various modules systems to resolve and simplify various issues
    • WebPack users no longer have to use the Babel loader.
    • Babelify with Babel 6 now works

2.0.1 - 2016-01-19

Added

  • Now developers can now override individual style properties of interest for polyline and polygon services directly in the FeatureLayer constructor. (via pull #100)
L.esri.featureLayer({
  url: 'http://[server]/arcgis/rest/services/[yourservice]/MapServer/0',
  style: function (feature) {
    return {
      // override service symbology to make polygon fill 50% transparent
      fillOpacity: 0.5
    };
  }
}).addTo(map);

2.0.0 - 2015-09-10

This is the first release that supports Leaflet 1.0.0-beta.1. As with version 1.0.0 of Esri Leaflet, FeatureLayer constructors now expect urls to be provided within an options object (ie: L.esri.featureLayer(url) should be replaced with L.esri.featureLayer( {url: url} )).

1.0.1 - 2015-11-30

Added

  • support for clusteredFeatureLayers
  • support for unique value renderers based on more than one field
  • support for transparency applied to the entire renderer (via the service symbology)

Changed

  • Rewritten build and test systems to rely on ES 2015 Modules specification
  • More build and release automation

1.0.0 - 2015-09-08

This is expected to be the last (and only) stable release of Esri Leaflet Renderers compatible with Leaflet 0.7.3. All future 1.0.X releases will be compatible with Leaflet 0.7.3 and contain only bug fixes. New features will only be added in Esri Leaflet Renderers 2.0.0 (which will require Leaflet 1.0.0).

Breaking Changes

  • In Esri Leaflet itself, in L.esri.FeatureLayer constructors, the url is now provided within an options object (ie: L.esri.featureLayer(url) should be replaced with L.esri.featureLayer( {url: url} )).

Added

  • support for unique value renderers based on more than one field
  • support for transparency applied to the entire renderer

Fixed

  • ensured that tokens are passed through in requests for picture marker symbols

0.0.1-beta.3 - 2015-03-24

  • Render from the new visualVariables objects in the renderer JSON
  • Still backwards compatible with classic renderers

0.0.1-beta.2 - 2015-03-02

  • Fix to work with Browserify
  • Update to work with esri-leaflet 1.0.0-rc.5
  • Still backwards compatible with esri-leaflet 1.0.0-rc.4

0.0.1-beta.1 - 2015-01-29

  • First Beta release
  • Works with esri-leaflet 1.0.0-rc.4