Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

esri-leaflet

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esri-leaflet - npm Package Compare versions

Comparing version 2.0.0-beta.8 to 2.0.0

.github/issue_template.md

4

bower.json
{
"name": "esri-leaflet",
"version": "v2.0.0-beta.7",
"version": "v2.0.0",
"main": "dist/esri-leaflet.js",
"dependencies": {
"leaflet": "^1.0.0-beta.2"
"leaflet": "^1.0.0-rc.1"
},

@@ -8,0 +8,0 @@ "ignore": [

@@ -8,2 +8,16 @@ # Change Log

## [2.0.0]
### Added
* new 'USATopo' `L.esri.basemapLayer` option.
* boilerplate issue template
### Fixed
* Worked around IE10,11 bug that caused `L.esri.featureLayer`s not to draw https://github.com/Esri/esri-leaflet/pull/770
* Ensured `L.esri.imageMapLayer` are overlaid appropriately at world scale https://github.com/Esri/esri-leaflet/pull/774
* Ensured copyright text makes it into the minified, concatenated build of the library
* create script tag after JSONP callback function is defined https://github.com/Esri/esri-leaflet/issues/762
## [2.0.0-beta.8]

@@ -31,2 +45,6 @@

### Breaking
* `L.esri.Util.arcgisToGeoJson` is now `L.esri.Util.arcgisToGeoJSON`
### Added

@@ -83,3 +101,3 @@

* Nested namespaces for `L.esri.Layers`, `L.esri.Services` and `L.esri.Tasks`, ``have been removed for better compatibility with ES 2015 modules. This means you should now write `L.esri.query()` for example as opposed to `L.esri.Tasks.query()`.
* Nested namespaces for `L.esri.Layers`, `L.esri.Services` and `L.esri.Tasks` have been removed for better compatibility with ES 2015 modules. This means you should now write `L.esri.query()` for example as opposed to `L.esri.Tasks.query()`.

@@ -406,3 +424,4 @@ ### Changed

[unreleased]: https://github.com/esri/esri-leaflet/compare/v2.0.0-beta.7...HEAD
[unreleased]: https://github.com/esri/esri-leaflet/compare/v2.0.0...HEAD
[2.0.0]: https://github.com/esri/esri-leaflet/compare/v2.0.0-beta.8...v2.0.0
[2.0.0-beta.8]: https://github.com/esri/esri-leaflet/compare/v2.0.0-beta.7...v2.0.0-beta.8

@@ -409,0 +428,0 @@ [2.0.0-beta.7]: https://github.com/esri/esri-leaflet/compare/v2.0.0-beta.6...v2.0.0-beta.7

@@ -28,3 +28,3 @@ Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/esri/contributing).

Esri Leaflet has a fairly comprehensive test suite built with [Mocha](http://visionmedia.github.io/mocha/), [Chai](http://chaijs.com/), [Sinon](http://sinonjs.org), and [Karma](http://karma-runner.github.io/0.12/index.html). The tests can be found in at https://github.com/Esri/esri-leaflet/tree/master/spec.
Esri Leaflet has a fairly comprehensive test suite built with [Mocha](http://mochajs.org/), [Chai](http://chaijs.com/), [Sinon](http://sinonjs.org), and [Karma](http://karma-runner.github.io/0.12/index.html). The tests can be found in at https://github.com/Esri/esri-leaflet/tree/master/spec.

@@ -45,3 +45,3 @@ You can run the tests with `npm test`.

2. `cd` into the `esri-leaflet` folder
3. Install the dependencies with `npm install`
3. Install the [`package.json`](https://github.com/Esri/esri-leaflet/blob/master/package.json#L14-L49) dependencies by running `npm install`
4. In order to compile/minify the source code of the API in a newly created `dist` folder, run `npm run build`.

@@ -59,2 +59,2 @@ 5. If you'd like to run the website locally, run `npm start` or `grunt` from the command line. This will start the web server at [http://localhost:8001](http://localhost:8001) and start watching the website source files for changes.

Please make sure your changes don't break existing tests. Testing is essential for determining backward compatibility and catching breaking changes. You can run tests with `npm test` or `npm t` if you'd like to avoid typing three extra characters.
Please make sure your changes don't break existing tests. Testing is essential for determining backward compatibility and catching breaking changes. You can run tests with `npm test` (or `npm t` if you'd like to avoid typing three extra characters).

@@ -1,3 +0,6 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("leaflet")):"function"==typeof define&&define.amd?define(["exports","leaflet"],e):e((t.L=t.L||{},t.L.esri=t.L.esri||{}),t.L)}(this,function(t,e){"use strict";function i(t,e){for(var i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}function s(t){return i(t[0],t[t.length-1])||t.push(t[0]),t}function r(t){var e,i=0,s=0,r=t.length,o=t[s];for(s;r-1>s;s++)e=t[s+1],i+=(e[0]-o[0])*(e[1]+o[1]),o=e;return i>=0}function o(t,e,i,s){var r=(s[0]-i[0])*(t[1]-i[1])-(s[1]-i[1])*(t[0]-i[0]),o=(e[0]-t[0])*(t[1]-i[1])-(e[1]-t[1])*(t[0]-i[0]),n=(s[1]-i[1])*(e[0]-t[0])-(s[0]-i[0])*(e[1]-t[1]);if(0!==n){var a=r/n,l=o/n;if(a>=0&&1>=a&&l>=0&&1>=l)return!0}return!1}function n(t,e){for(var i=0;i<t.length-1;i++)for(var s=0;s<e.length-1;s++)if(o(t[i],t[i+1],e[s],e[s+1]))return!0;return!1}function a(t,e){for(var i=!1,s=-1,r=t.length,o=r-1;++s<r;o=s)(t[s][1]<=e[1]&&e[1]<t[o][1]||t[o][1]<=e[1]&&e[1]<t[s][1])&&e[0]<(t[o][0]-t[s][0])*(e[1]-t[s][1])/(t[o][1]-t[s][1])+t[s][0]&&(i=!i);return i}function l(t,e){var i=n(t,e),s=a(t,e[0]);return!i&&s?!0:!1}function u(t){for(var e,i,o,a=[],u=[],h=0;h<t.length;h++){var c=s(t[h].slice(0));if(!(c.length<4))if(r(c)){var p=[c];a.push(p)}else u.push(c)}for(var d=[];u.length;){o=u.pop();var m=!1;for(e=a.length-1;e>=0;e--)if(i=a[e][0],l(i,o)){a[e].push(o),m=!0;break}m||d.push(o)}for(;d.length;){o=d.pop();var f=!1;for(e=a.length-1;e>=0;e--)if(i=a[e][0],n(i,o)){a[e].push(o),f=!0;break}f||a.push([o.reverse()])}return 1===a.length?{type:"Polygon",coordinates:a[0]}:{type:"MultiPolygon",coordinates:a}}function h(t){var e=[],i=t.slice(0),o=s(i.shift().slice(0));if(o.length>=4){r(o)||o.reverse(),e.push(o);for(var n=0;n<i.length;n++){var a=s(i[n].slice(0));a.length>=4&&(r(a)&&a.reverse(),e.push(a))}}return e}function c(t){for(var e=[],i=0;i<t.length;i++)for(var s=h(t[i]),r=s.length-1;r>=0;r--){var o=s[r].slice(0);e.push(o)}return e}function p(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function d(t,e){var i={};return"number"==typeof t.x&&"number"==typeof t.y&&(i.type="Point",i.coordinates=[t.x,t.y]),t.points&&(i.type="MultiPoint",i.coordinates=t.points.slice(0)),t.paths&&(1===t.paths.length?(i.type="LineString",i.coordinates=t.paths[0].slice(0)):(i.type="MultiLineString",i.coordinates=t.paths.slice(0))),t.rings&&(i=u(t.rings.slice(0))),(t.geometry||t.attributes)&&(i.type="Feature",i.geometry=t.geometry?d(t.geometry):null,i.properties=t.attributes?p(t.attributes):null,t.attributes&&(i.id=t.attributes[e]||t.attributes.OBJECTID||t.attributes.FID)),i}function m(t,e){e=e||"OBJECTID";var i,s={wkid:4326},r={};switch(t.type){case"Point":r.x=t.coordinates[0],r.y=t.coordinates[1],r.spatialReference=s;break;case"MultiPoint":r.points=t.coordinates.slice(0),r.spatialReference=s;break;case"LineString":r.paths=[t.coordinates.slice(0)],r.spatialReference=s;break;case"MultiLineString":r.paths=t.coordinates.slice(0),r.spatialReference=s;break;case"Polygon":r.rings=h(t.coordinates.slice(0)),r.spatialReference=s;break;case"MultiPolygon":r.rings=c(t.coordinates.slice(0)),r.spatialReference=s;break;case"Feature":t.geometry&&(r.geometry=m(t.geometry,e)),r.attributes=t.properties?p(t.properties):{},t.id&&(r.attributes[e]=t.id);break;case"FeatureCollection":for(r=[],i=0;i<t.features.length;i++)r.push(m(t.features[i],e));break;case"GeometryCollection":for(r=[],i=0;i<t.geometries.length;i++)r.push(m(t.geometries[i],e))}return r}function f(t,e){return m(t,e)}function g(t,e){return d(t,e)}function y(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function _(t){var i=e.latLng(t.ymin,t.xmin),s=e.latLng(t.ymax,t.xmax);return e.latLngBounds(i,s)}function v(t){return t=e.latLngBounds(t),{xmin:t.getSouthWest().lng,ymin:t.getSouthWest().lat,xmax:t.getNorthEast().lng,ymax:t.getNorthEast().lat,spatialReference:{wkid:4326}}}function b(t,e){var i;if(e)i=e;else if(t.objectIdFieldName)i=t.objectIdFieldName;else if(t.fields){for(var s=0;s<=t.fields.length-1;s++)if("esriFieldTypeOID"===t.fields[s].type){i=t.fields[s].name;break}}else i="OBJECTID";var r={type:"FeatureCollection",features:[]},o=t.features||t.results;if(o.length)for(var n=o.length-1;n>=0;n--){var a=g(o[n],i);r.features.push(a)}return r}function L(t){return t=e.Util.trim(t),"/"!==t[t.length-1]&&(t+="/"),t}function x(t){return/\.arcgis\.com.*?FeatureServer/g.test(t)}function S(t){var e;switch(t){case"Point":e="esriGeometryPoint";break;case"MultiPoint":e="esriGeometryMultipoint";break;case"LineString":e="esriGeometryPolyline";break;case"MultiLineString":e="esriGeometryPolyline";break;case"Polygon":e="esriGeometryPolygon";break;case"MultiPolygon":e="esriGeometryPolygon"}return e}function T(){console&&console.warn&&console.warn.apply(console,arguments)}function I(t){var e="";t.f=t.f||"json";for(var i in t)if(t.hasOwnProperty(i)){var s,r=t[i],o=Object.prototype.toString.call(r);e.length&&(e+="&"),s="[object Array]"===o?"[object Object]"===Object.prototype.toString.call(r[0])?JSON.stringify(r):r.join(","):"[object Object]"===o?JSON.stringify(r):"[object Date]"===o?r.valueOf():r,e+=encodeURIComponent(i)+"="+encodeURIComponent(s)}return e}function w(t,i){var s=new window.XMLHttpRequest;return s.onerror=function(r){s.onreadystatechange=e.Util.falseFn,t.call(i,{error:{code:500,message:"XMLHttpRequest error"}},null)},s.onreadystatechange=function(){var r,o;if(4===s.readyState){try{r=JSON.parse(s.responseText)}catch(n){r=null,o={code:500,message:"Could not parse response as JSON. This could also be caused by a CORS or XMLHttpRequest error."}}!o&&r.error&&(o=r.error,r=null),s.onerror=e.Util.falseFn,t.call(i,o,r)}},s.ontimeout=function(){this.onerror()},s}function P(t,e,i,s){var r=w(i,s);return"undefined"!=typeof s&&null!==s&&"undefined"!=typeof s.options&&(r.timeout=s.options.timeout),r.open("POST",t),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.send(I(e)),r}function R(t,e,i,s){var r=w(i,s);return"undefined"!=typeof s&&null!==s&&"undefined"!=typeof s.options&&(r.timeout=s.options.timeout),r.open("GET",t+"?"+I(e),!0),r.send(null),r}function C(t,e,i,s){var r=I(e),o=w(i,s);"undefined"!=typeof s&&null!==s&&"undefined"!=typeof s.options&&(o.timeout=s.options.timeout);var n=(t+"?"+r).length;if(2e3>=n&&X.cors)o.open("GET",t+"?"+r),o.send(null);else{if(!(n>2e3&&X.cors))return 2e3>=n&&!X.cors?O(t,e,i,s):void T("a request to "+t+" was longer then 2000 characters and this browser cannot make a cross-domain post request. Please use a proxy http://esri.github.io/esri-leaflet/api-reference/request.html");o.open("POST",t),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.send(r)}return o}function O(t,i,s,r){window._EsriLeafletCallbacks=window._EsriLeafletCallbacks||{};var o="c"+Y;i.callback="window._EsriLeafletCallbacks."+o;var n=e.DomUtil.create("script",null,document.body);return n.type="text/javascript",n.src=t+"?"+I(i),n.id=o,window._EsriLeafletCallbacks[o]=function(t){if(window._EsriLeafletCallbacks[o]!==!0){var e,i=Object.prototype.toString.call(t);"[object Object]"!==i&&"[object Array]"!==i&&(e={error:{code:500,message:"Expected array or object as JSONP response"}},t=null),!e&&t.error&&(e=t,t=null),s.call(r,e,t),window._EsriLeafletCallbacks[o]=!0}},Y++,{id:o,url:n.src,abort:function(){window._EsriLeafletCallbacks._callback[o]({code:0,message:"Request aborted."})}}}function F(t){return new it(t)}function k(t){return new st(t)}function M(t){return new rt(t)}function E(t){return new ot(t)}function G(t){return new nt(t)}function q(t){return new at(t)}function A(t){return new lt(t)}function U(t){return new ut(t)}function D(t){return new ht(t)}function B(t){return new ct(t)}function z(t){return new pt(t)}function j(t,e){return new mt(t,e)}function Z(t,e){return new ft(t,e)}function N(t,e){return new _t(t,e)}function W(t,e){return new vt(t,e)}function J(t){this.values=[].concat(t||[])}function Q(t){return new xt(t)}e="default"in e?e["default"]:e;var H="2.0.0-beta.8",K=window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest,V=""===document.documentElement.style.pointerEvents,X={cors:K,pointerEvents:V},$={shallowClone:y,warn:T,cleanUrl:L,isArcgisOnline:x,geojsonTypeToArcGIS:S,responseToFeatureCollection:b,geojsonToArcGIS:f,arcgisToGeoJSON:g,boundsToExtent:v,extentToBounds:_},Y=0,tt=X.cors?R:O;tt.CORS=R,tt.JSONP=O;var et={request:C,get:tt,post:P},it=e.Class.extend({options:{proxy:!1,useCors:K},generateSetter:function(t,i){return e.Util.bind(function(e){return this.params[t]=e,this},i)},initialize:function(t){if(t.request&&t.options?(this._service=t,e.Util.setOptions(this,t.options)):(e.Util.setOptions(this,t),this.options.url=L(t.url)),this.params=e.Util.extend({},this.params||{}),this.setters)for(var i in this.setters){var s=this.setters[i];this[i]=this.generateSetter(s,this)}},token:function(t){return this._service?this._service.authenticate(t):this.params.token=t,this},request:function(t,e){return this._service?this._service.request(this.path,this.params,t,e):this._request("request",this.path,this.params,t,e)},_request:function(t,e,i,s,r){var o=this.options.proxy?this.options.proxy+"?"+this.options.url+e:this.options.url+e;return"get"!==t&&"request"!==t||this.options.useCors?et[t](o,i,s,r):et.get.JSONP(o,i,s,r)}}),st=it.extend({setters:{offset:"offset",limit:"limit",fields:"outFields",precision:"geometryPrecision",featureIds:"objectIds",returnGeometry:"returnGeometry",token:"token"},path:"query",params:{returnGeometry:!0,where:"1=1",outSr:4326,outFields:"*"},within:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelContains",this},intersects:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelIntersects",this},contains:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelWithin",this},crosses:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelCrosses",this},touches:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelTouches",this},overlaps:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelOverlaps",this},nearby:function(t,i){return t=e.latLng(t),this.params.geometry=[t.lng,t.lat],this.params.geometryType="esriGeometryPoint",this.params.spatialRel="esriSpatialRelIntersects",this.params.units="esriSRUnit_Meter",this.params.distance=i,this.params.inSr=4326,this},where:function(t){return this.params.where=t,this},between:function(t,e){return this.params.time=[t.valueOf(),e.valueOf()],this},simplify:function(t,e){var i=Math.abs(t.getBounds().getWest()-t.getBounds().getEast());return this.params.maxAllowableOffset=i/t.getSize().y*e,this},orderBy:function(t,e){return e=e||"ASC",this.params.orderByFields=this.params.orderByFields?this.params.orderByFields+",":"",this.params.orderByFields+=[t,e].join(" "),this},run:function(t,e){return this._cleanParams(),$.isArcgisOnline(this.options.url)?(this.params.f="geojson",this.request(function(i,s){this._trapSQLerrors(i),t.call(e,i,s,s)},this)):this.request(function(i,s){this._trapSQLerrors(i),t.call(e,i,s&&$.responseToFeatureCollection(s),s)},this)},count:function(t,e){return this._cleanParams(),this.params.returnCountOnly=!0,this.request(function(e,i){t.call(this,e,i&&i.count,i)},e)},ids:function(t,e){return this._cleanParams(),this.params.returnIdsOnly=!0,this.request(function(e,i){t.call(this,e,i&&i.objectIds,i)},e)},bounds:function(t,e){return this._cleanParams(),this.params.returnExtentOnly=!0,this.request(function(i,s){t.call(e,i,s&&s.extent&&$.extentToBounds(s.extent),s)},e)},pixelSize:function(t){return t=e.point(t),this.params.pixelSize=[t.x,t.y],this},layer:function(t){return this.path=t+"/query",this},_trapSQLerrors:function(t){t&&"400"===t.code&&$.warn("one common syntax error in query requests is encasing string values in double quotes instead of single quotes")},_cleanParams:function(){delete this.params.returnIdsOnly,delete this.params.returnExtentOnly,delete this.params.returnCountOnly},_setGeometry:function(t){return this.params.inSr=4326,t instanceof e.LatLngBounds?(this.params.geometry=$.boundsToExtent(t),void(this.params.geometryType="esriGeometryEnvelope")):(t.getLatLng&&(t=t.getLatLng()),t instanceof e.LatLng&&(t={type:"Point",coordinates:[t.lng,t.lat]}),t instanceof e.GeoJSON&&(t=t.getLayers()[0].feature.geometry,this.params.geometry=$.geojsonToArcGIS(t),this.params.geometryType=$.geojsonTypeToArcGIS(t.type)),t.toGeoJSON&&(t=t.toGeoJSON()),"Feature"===t.type&&(t=t.geometry),"Point"===t.type||"LineString"===t.type||"Polygon"===t.type?(this.params.geometry=$.geojsonToArcGIS(t),void(this.params.geometryType=$.geojsonTypeToArcGIS(t.type))):void $.warn("invalid geometry passed to spatial query. Should be an L.LatLng, L.LatLngBounds or L.Marker or a GeoJSON Point Line or Polygon object"))}}),rt=it.extend({setters:{contains:"contains",text:"searchText",fields:"searchFields",spatialReference:"sr",sr:"sr",layers:"layers",returnGeometry:"returnGeometry",maxAllowableOffset:"maxAllowableOffset",precision:"geometryPrecision",dynamicLayers:"dynamicLayers",returnZ:"returnZ",returnM:"returnM",gdbVersion:"gdbVersion",token:"token"},path:"find",params:{sr:4326,contains:!0,returnGeometry:!0,returnZ:!0,returnM:!1},layerDefs:function(t,e){return this.params.layerDefs=this.params.layerDefs?this.params.layerDefs+";":"",this.params.layerDefs+=[t,e].join(":"),this},simplify:function(t,e){var i=Math.abs(t.getBounds().getWest()-t.getBounds().getEast());return this.params.maxAllowableOffset=i/t.getSize().y*e,this},run:function(t,e){return this.request(function(i,s){t.call(e,i,s&&$.responseToFeatureCollection(s),s)},e)}}),ot=it.extend({path:"identify",between:function(t,e){return this.params.time=[t.valueOf(),e.valueOf()],this}}),nt=ot.extend({setters:{layers:"layers",precision:"geometryPrecision",tolerance:"tolerance",returnGeometry:"returnGeometry"},params:{sr:4326,layers:"all",tolerance:3,returnGeometry:!0},on:function(t){var e=$.boundsToExtent(t.getBounds()),i=t.getSize();return this.params.imageDisplay=[i.x,i.y,96],this.params.mapExtent=[e.xmin,e.ymin,e.xmax,e.ymax],this},at:function(t){return t=e.latLng(t),this.params.geometry=[t.lng,t.lat],this.params.geometryType="esriGeometryPoint",this},layerDef:function(t,e){return this.params.layerDefs=this.params.layerDefs?this.params.layerDefs+";":"",this.params.layerDefs+=[t,e].join(":"),this},simplify:function(t,e){var i=Math.abs(t.getBounds().getWest()-t.getBounds().getEast());return this.params.maxAllowableOffset=i/t.getSize().y*(1-e),this},run:function(t,e){return this.request(function(i,s){if(i)return void t.call(e,i,void 0,s);var r=$.responseToFeatureCollection(s);s.results=s.results.reverse();for(var o=0;o<r.features.length;o++){var n=r.features[o];n.layerId=s.results[o].layerId}t.call(e,void 0,r,s)})}}),at=ot.extend({setters:{setMosaicRule:"mosaicRule",setRenderingRule:"renderingRule",setPixelSize:"pixelSize",returnCatalogItems:"returnCatalogItems",returnGeometry:"returnGeometry"},params:{returnGeometry:!1},at:function(t){return t=e.latLng(t),this.params.geometry=JSON.stringify({x:t.lng,y:t.lat,spatialReference:{wkid:4326}}),this.params.geometryType="esriGeometryPoint",this},getMosaicRule:function(){return this.params.mosaicRule},getRenderingRule:function(){return this.params.renderingRule},getPixelSize:function(){return this.params.pixelSize},run:function(t,e){return this.request(function(i,s){t.call(e,i,s&&this._responseToGeoJSON(s),s)},this)},_responseToGeoJSON:function(t){var e=t.location,i=t.catalogItems,s=t.catalogItemVisibilities,r={pixel:{type:"Feature",geometry:{type:"Point",coordinates:[e.x,e.y]},crs:{type:"EPSG",properties:{code:e.spatialReference.wkid}},properties:{OBJECTID:t.objectId,name:t.name,value:t.value},id:t.objectId}};if(t.properties&&t.properties.Values&&(r.pixel.properties.values=t.properties.Values),i&&i.features&&(r.catalogItems=$.responseToFeatureCollection(i),s&&s.length===r.catalogItems.features.length))for(var o=s.length-1;o>=0;o--)r.catalogItems.features[o].properties.catalogItemVisibility=s[o];return r}}),lt=e.Evented.extend({options:{proxy:!1,useCors:K,timeout:0},initialize:function(t){t=t||{},this._requestQueue=[],this._authenticating=!1,e.Util.setOptions(this,t),this.options.url=L(this.options.url)},get:function(t,e,i,s){return this._request("get",t,e,i,s)},post:function(t,e,i,s){return this._request("post",t,e,i,s)},request:function(t,e,i,s){return this._request("request",t,e,i,s)},metadata:function(t,e){return this._request("get","",{},t,e)},authenticate:function(t){return this._authenticating=!1,this.options.token=t,this._runQueue(),this},getTimeout:function(){return this.options.timeout},setTimeout:function(t){this.options.timeout=t},_request:function(t,e,i,s,r){this.fire("requeststart",{url:this.options.url+e,params:i,method:t},!0);var o=this._createServiceCallback(t,e,i,s,r);if(this.options.token&&(i.token=this.options.token),this._authenticating)return void this._requestQueue.push([t,e,i,s,r]);var n=this.options.proxy?this.options.proxy+"?"+this.options.url+e:this.options.url+e;return"get"!==t&&"request"!==t||this.options.useCors?et[t](n,i,o,r):et.get.JSONP(n,i,o,r)},_createServiceCallback:function(t,i,s,r,o){return e.Util.bind(function(n,a){!n||499!==n.code&&498!==n.code||(this._authenticating=!0,this._requestQueue.push([t,i,s,r,o]),this.fire("authenticationrequired",{authenticate:e.Util.bind(this.authenticate,this)},!0),n.authenticate=e.Util.bind(this.authenticate,this)),r.call(o,n,a),n?this.fire("requesterror",{url:this.options.url+i,params:s,message:n.message,code:n.code,method:t},!0):this.fire("requestsuccess",{url:this.options.url+i,params:s,response:a,method:t},!0),this.fire("requestend",{url:this.options.url+i,params:s,method:t},!0)},this)},_runQueue:function(){for(var t=this._requestQueue.length-1;t>=0;t--){var e=this._requestQueue[t],i=e.shift();this[i].apply(this,e)}this._requestQueue=[]}}),ut=lt.extend({identify:function(){return G(this)},find:function(){return M(this)},query:function(){return k(this)}}),ht=lt.extend({query:function(){return k(this)},identify:function(){return q(this)}}),ct=lt.extend({options:{idAttribute:"OBJECTID"},query:function(){return k(this)},addFeature:function(t,e,i){return delete t.id,t=f(t),this.post("addFeatures",{features:[t]},function(t,s){var r=s&&s.addResults?s.addResults[0]:void 0;e&&e.call(i,t||s.addResults[0].error,r)},i)},updateFeature:function(t,e,i){return t=f(t,this.options.idAttribute),this.post("updateFeatures",{features:[t]},function(t,s){var r=s&&s.updateResults?s.updateResults[0]:void 0;e&&e.call(i,t||s.updateResults[0].error,r)},i)},deleteFeature:function(t,e,i){return this.post("deleteFeatures",{objectIds:t},function(t,s){var r=s&&s.deleteResults?s.deleteResults[0]:void 0;e&&e.call(i,t||s.deleteResults[0].error,r)},i)},deleteFeatures:function(t,e,i){return this.post("deleteFeatures",{objectIds:t},function(t,s){var r=s&&s.deleteResults?s.deleteResults:void 0;e&&e.call(i,t||s.deleteResults[0].error,r)},i)}}),pt=e.Control.extend({options:{position:"bottomright",marginTop:0,marginLeft:0,marginBottom:0,marginRight:0},onAdd:function(){var t=e.DomUtil.create("div","esri-leaflet-logo");return t.style.marginTop=this.options.marginTop,t.style.marginLeft=this.options.marginLeft,t.style.marginBottom=this.options.marginBottom,t.style.marginRight=this.options.marginRight,t.innerHTML='<a href="http://www.esri.com" target="_blank" style="border: none;"><img src="https://js.arcgis.com/3.13/esri/images/map/logo-sm.png" alt="Powered by Esri" style="border: none;"></a>',t}}),dt="https:"!==window.location.protocol?"http:":"https:",mt=e.TileLayer.extend({statics:{TILES:{Streets:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}",attributionUrl:"https://static.arcgis.com/attribution/World_Street_Map",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"Esri"}},Topographic:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}",attributionUrl:"https://static.arcgis.com/attribution/World_Topo_Map",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"Esri"}},Oceans:{urlTemplate:dt+"//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}",attributionUrl:"https://static.arcgis.com/attribution/Ocean_Basemap",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"Esri"}},OceansLabels:{urlTemplate:dt+"//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"],pane:V?"esri-labels":"tilePane"}},NationalGeographic:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"National Geographic, Esri, DeLorme, HERE, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, increment P Corp."}},DarkGray:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"Esri, HERE, DeLorme, MapmyIndia, © OpenStreetMap contributors"}},DarkGrayLabels:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Reference/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"],pane:V?"esri-labels":"tilePane"}},Gray:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"Esri, HERE, DeLorme, MapmyIndia, © OpenStreetMap contributors"}},GrayLabels:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"],pane:V?"esri-labels":"tilePane"}},Imagery:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"Esri, DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community"}},ImageryLabels:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:19,subdomains:["server","services"],pane:V?"esri-labels":"tilePane"}},ImageryTransportation:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:19,subdomains:["server","services"],pane:V?"esri-labels":"tilePane"}},ShadedRelief:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:13,subdomains:["server","services"],attribution:"Esri, USGS"}},ShadedReliefLabels:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:12,subdomains:["server","services"],pane:V?"esri-labels":"tilePane"}},Terrain:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:13,subdomains:["server","services"],attribution:"Esri, USGS, NOAA"}},TerrainLabels:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:13,subdomains:["server","services"],pane:V?"esri-labels":"tilePane"}}}},initialize:function(t,i){var s;if("object"==typeof t&&t.urlTemplate&&t.options)s=t;else{if("string"!=typeof t||!mt.TILES[t])throw new Error('L.esri.BasemapLayer: Invalid parameter. Use one of "Streets", "Topographic", "Oceans", "OceansLabels", "NationalGeographic", "Gray", "GrayLabels", "DarkGray", "DarkGrayLabels", "Imagery", "ImageryLabels", "ImageryTransportation", "ShadedRelief", "ShadedReliefLabels", "Terrain" or "TerrainLabels"');s=mt.TILES[t]}var r=e.Util.extend(s.options,i);e.Util.setOptions(this,r),e.TileLayer.prototype.initialize.call(this,s.urlTemplate,r),s.attributionUrl&&this._getAttributionData(s.attributionUrl),this._logo=z({position:this.options.logoPosition})},onAdd:function(t){this.options.hideLogo||t._hasEsriLogo||(this._logo.addTo(t),t._hasEsriLogo=!0),"esri-labels"===this.options.pane&&this._initPane(),t.on("moveend",this._updateMapAttribution,this),e.TileLayer.prototype.onAdd.call(this,t)},onRemove:function(t){this._logo&&this._logo._container&&(t.removeControl(this._logo),t._hasEsriLogo=!1),t.off("moveend",this._updateMapAttribution,this),e.TileLayer.prototype.onRemove.call(this,t)},getAttribution:function(){if(this.options.attribution)var t='<span class="esri-attributions" style="line-height:14px; vertical-align: -3px; text-overflow:ellipsis; white-space:nowrap; overflow:hidden; display:inline-block;">'+this.options.attribution+"</span>";return t},_initPane:function(){if(!this._map.getPane(this.options.pane)){var t=this._map.createPane(this.options.pane);t.style.pointerEvents="none",t.style.zIndex=500}},_getAttributionData:function(t){O(t,{},e.Util.bind(function(t,i){if(!t){this._attributions=[];for(var s=0;s<i.contributors.length;s++)for(var r=i.contributors[s],o=0;o<r.coverageAreas.length;o++){var n=r.coverageAreas[o],a=e.latLng(n.bbox[0],n.bbox[1]),l=e.latLng(n.bbox[2],n.bbox[3]);this._attributions.push({attribution:r.attribution,score:n.score,bounds:e.latLngBounds(a,l),minZoom:n.zoomMin,maxZoom:n.zoomMax})}this._attributions.sort(function(t,e){return e.score-t.score}),this._updateMapAttribution()}},this))},_updateMapAttribution:function(){if(this._map&&this._map.attributionControl&&this._attributions){for(var t="",e=this._map.getBounds(),i=this._map.getZoom(),s=0;s<this._attributions.length;s++){var r=this._attributions[s],o=r.attribution;!t.match(o)&&e.intersects(r.bounds)&&i>=r.minZoom&&i<=r.maxZoom&&(t+=", "+o)}t=t.substr(2);var n=this._map.attributionControl._container.querySelector(".esri-attributions");n.innerHTML=t,n.style.maxWidth=.65*this._map.getSize().x+"px",this.fire("attributionupdated",{attribution:t})}}}),ft=e.TileLayer.extend({options:{zoomOffsetAllowance:.1},statics:{MercatorZoomLevels:{0:156543.033928,1:78271.5169639999,2:39135.7584820001,3:19567.8792409999,4:9783.93962049996,5:4891.96981024998,6:2445.98490512499,7:1222.99245256249,8:611.49622628138,9:305.748113140558,10:152.874056570411,11:76.4370282850732,12:38.2185141425366,13:19.1092570712683,14:9.55462853563415,15:4.77731426794937,16:2.38865713397468,17:1.19432856685505,18:.597164283559817,19:.298582141647617,20:.14929107082381,21:.07464553541191,22:.0373227677059525,23:.0186613838529763}},initialize:function(t){t.url=L(t.url),t=e.Util.setOptions(this,t),this.tileUrl=t.url+"tile/{z}/{y}/{x}",this.service=U(t),this.service.addEventParent(this);var i=new RegExp(/tiles.arcgis(online)?\.com/g);i.test(t.url)&&(this.tileUrl=this.tileUrl.replace("://tiles","://tiles{s}"),t.subdomains=["1","2","3","4"]),this.options.token&&(this.tileUrl+="?token="+this.options.token),e.TileLayer.prototype.initialize.call(this,this.tileUrl,t)},getTileUrl:function(t){return e.Util.template(this.tileUrl,e.extend({s:this._getSubdomain(t),z:this._lodMap&&this._lodMap[t.z]?this._lodMap[t.z]:t.z,x:t.x,y:t.y},this.options))},createTile:function(t,i){var s=document.createElement("img");return e.DomEvent.on(s,"load",e.bind(this._tileOnLoad,this,i,s)),e.DomEvent.on(s,"error",e.bind(this._tileOnError,this,i,s)),this.options.crossOrigin&&(s.crossOrigin=""),s.alt="",!this._lodMap||this._lodMap&&this._lodMap[t.z]?s.src=this.getTileUrl(t):this.once("lodmap",function(){s.src=this.getTileUrl(t)},this),s},onAdd:function(t){t.options.crs!==e.CRS.EPSG3857||this._lodMap||(this._lodMap={},this.metadata(function(t,e){if(!t){var i=e.spatialReference.latestWkid||e.spatialReference.wkid;if(102100===i||3857===i){for(var s=e.tileInfo.lods,r=ft.MercatorZoomLevels,o=0;o<s.length;o++){var n=s[o];for(var a in r){var l=r[a];if(this._withinPercentage(n.resolution,l,this.options.zoomOffsetAllowance)){this._lodMap[a]=n.level;break}}}this.fire("lodmap")}else T("L.esri.TiledMapLayer is using a non-mercator spatial reference. Support may be available through Proj4Leaflet http://esri.github.io/esri-leaflet/examples/non-mercator-projection.html")}},this)),e.TileLayer.prototype.onAdd.call(this,t)},metadata:function(t,e){return this.service.metadata(t,e),this},identify:function(){return this.service.identify()},find:function(){return this.service.find()},query:function(){return this.service.query()},authenticate:function(t){var e="?token="+t;return this.tileUrl=this.options.token?this.tileUrl.replace(/\?token=(.+)/g,e):this.tileUrl+e,this.options.token=t,this.service.authenticate(t),this},_withinPercentage:function(t,e,i){var s=Math.abs(t/e-1);return i>s}}),gt=e.ImageOverlay.extend({onAdd:function(t){this._topLeft=t.getPixelBounds().min,e.ImageOverlay.prototype.onAdd.call(this,t)},_reset:function(){this._map.options.crs===e.CRS.EPSG3857?e.ImageOverlay.prototype._reset.call(this):e.DomUtil.setPosition(this._image,this._topLeft.subtract(this._map.getPixelOrigin()))}}),yt=e.Layer.extend({options:{opacity:1,position:"front",f:"image",useCors:K,attribution:null,interactive:!1,alt:""},onAdd:function(t){this._update=e.Util.throttle(this._update,this.options.updateInterval,this),t.on("moveend",this._update,this),this._currentImage&&this._currentImage._bounds.equals(this._map.getBounds())?t.addLayer(this._currentImage):this._currentImage&&(this._map.removeLayer(this._currentImage),this._currentImage=null),this._update(),this._popup&&(this._map.on("click",this._getPopupData,this),this._map.on("dblclick",this._resetPopupState,this))},onRemove:function(t){this._currentImage&&this._map.removeLayer(this._currentImage),this._popup&&(this._map.off("click",this._getPopupData,this),this._map.off("dblclick",this._resetPopupState,this)),this._map.off("moveend",this._update,this)},bindPopup:function(t,i){return this._shouldRenderPopup=!1,this._lastClick=!1,this._popup=e.popup(i),this._popupFunction=t,this._map&&(this._map.on("click",this._getPopupData,this),this._map.on("dblclick",this._resetPopupState,this)),this},unbindPopup:function(){return this._map&&(this._map.closePopup(this._popup),this._map.off("click",this._getPopupData,this),this._map.off("dblclick",this._resetPopupState,this)),this._popup=!1,this},bringToFront:function(){return this.options.position="front",this._currentImage&&this._currentImage.bringToFront(),this},bringToBack:function(){return this.options.position="back",this._currentImage&&this._currentImage.bringToBack(),this},getAttribution:function(){return this.options.attribution},getOpacity:function(){return this.options.opacity},setOpacity:function(t){return this.options.opacity=t,this._currentImage.setOpacity(t),this},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(t,e){return this.options.from=t,this.options.to=e,this._update(),this},metadata:function(t,e){return this.service.metadata(t,e),this},authenticate:function(t){return this.service.authenticate(t),this},_renderImage:function(t,e){if(this._map){var i=new gt(t,e,{opacity:0,crossOrigin:this.options.useCors,
alt:this.options.alt,pane:this.options.pane||this.getPane(),interactive:this.options.interactive}).addTo(this._map);i.once("load",function(t){if(this._map){var i=t.target,s=this._currentImage;i._bounds.equals(e)&&i._bounds.equals(this._map.getBounds())?(this._currentImage=i,"front"===this.options.position?this.bringToFront():this.bringToBack(),this._map&&this._currentImage._map?this._currentImage.setOpacity(this.options.opacity):this._currentImage._map.removeLayer(this._currentImage),s&&this._map&&this._map.removeLayer(s),s&&s._map&&s._map.removeLayer(s)):this._map.removeLayer(i)}this.fire("load",{bounds:e})},this),this.fire("loading",{bounds:e})}},_update:function(){if(this._map){var t=this._map.getZoom(),e=this._map.getBounds();if(!(this._animatingZoom||this._map._panTransition&&this._map._panTransition._inProgress)){if(t>this.options.maxZoom||t<this.options.minZoom)return void this._currentImage._map.removeLayer(this._currentImage);var i=this._buildExportParams();this._requestExport(i,e)}}},_renderPopup:function(t,i,s,r){if(t=e.latLng(t),this._shouldRenderPopup&&this._lastClick.equals(t)){var o=this._popupFunction(i,s,r);o&&this._popup.setLatLng(t).setContent(o).openOn(this._map)}},_resetPopupState:function(t){this._shouldRenderPopup=!1,this._lastClick=t.latlng}}),_t=yt.extend({options:{updateInterval:150,format:"jpgpng",transparent:!0,f:"json"},query:function(){return this.service.query()},identify:function(){return this.service.identify()},initialize:function(t){t.url=L(t.url),this.service=D(t),this.service.addEventParent(this),e.Util.setOptions(this,t)},setPixelType:function(t){return this.options.pixelType=t,this._update(),this},getPixelType:function(){return this.options.pixelType},setBandIds:function(t){return e.Util.isArray(t)?this.options.bandIds=t.join(","):this.options.bandIds=t.toString(),this._update(),this},getBandIds:function(){return this.options.bandIds},setNoData:function(t,i){return e.Util.isArray(t)?this.options.noData=t.join(","):this.options.noData=t.toString(),i&&(this.options.noDataInterpretation=i),this._update(),this},getNoData:function(){return this.options.noData},getNoDataInterpretation:function(){return this.options.noDataInterpretation},setRenderingRule:function(t){this.options.renderingRule=t,this._update()},getRenderingRule:function(){return this.options.renderingRule},setMosaicRule:function(t){this.options.mosaicRule=t,this._update()},getMosaicRule:function(){return this.options.mosaicRule},_getPopupData:function(t){var i=e.Util.bind(function(i,s,r){i||setTimeout(e.Util.bind(function(){this._renderPopup(t.latlng,i,s,r)},this),300)},this),s=this.identify().at(t.latlng);this.options.mosaicRule&&s.setMosaicRule(this.options.mosaicRule),s.run(i),this._shouldRenderPopup=!0,this._lastClick=t.latlng},_buildExportParams:function(){var t=this._map.getBounds(),e=this._map.getSize(),i=this._map.options.crs.project(t._northEast),s=this._map.options.crs.project(t._southWest),r=parseInt(this._map.options.crs.code.split(":")[1],10),o={bbox:[s.x,s.y,i.x,i.y].join(","),size:e.x+","+e.y,format:this.options.format,transparent:this.options.transparent,bboxSR:r,imageSR:r};return this.options.from&&this.options.to&&(o.time=this.options.from.valueOf()+","+this.options.to.valueOf()),this.options.pixelType&&(o.pixelType=this.options.pixelType),this.options.interpolation&&(o.interpolation=this.options.interpolation),this.options.compressionQuality&&(o.compressionQuality=this.options.compressionQuality),this.options.bandIds&&(o.bandIds=this.options.bandIds),this.options.noData&&(o.noData=this.options.noData),this.options.noDataInterpretation&&(o.noDataInterpretation=this.options.noDataInterpretation),this.service.options.token&&(o.token=this.service.options.token),this.options.renderingRule&&(o.renderingRule=JSON.stringify(this.options.renderingRule)),this.options.mosaicRule&&(o.mosaicRule=JSON.stringify(this.options.mosaicRule)),o},_requestExport:function(t,i){"json"===this.options.f?this.service.request("exportImage",t,function(t,e){t||this._renderImage(e.href,i)},this):(t.f="image",this._renderImage(this.options.url+"exportImage"+e.Util.getParamString(t),i))}}),vt=yt.extend({options:{updateInterval:150,layers:!1,layerDefs:!1,timeOptions:!1,format:"png24",transparent:!0,f:"json"},initialize:function(t){t.url=L(t.url),this.service=U(t),this.service.addEventParent(this),(t.proxy||t.token)&&"json"!==t.f&&(t.f="json"),e.Util.setOptions(this,t)},getDynamicLayers:function(){return this.options.dynamicLayers},setDynamicLayers:function(t){return this.options.dynamicLayers=t,this._update(),this},getLayers:function(){return this.options.layers},setLayers:function(t){return this.options.layers=t,this._update(),this},getLayerDefs:function(){return this.options.layerDefs},setLayerDefs:function(t){return this.options.layerDefs=t,this._update(),this},getTimeOptions:function(){return this.options.timeOptions},setTimeOptions:function(t){return this.options.timeOptions=t,this._update(),this},query:function(){return this.service.query()},identify:function(){return this.service.identify()},find:function(){return this.service.find()},_getPopupData:function(t){var i=e.Util.bind(function(i,s,r){i||setTimeout(e.Util.bind(function(){this._renderPopup(t.latlng,i,s,r)},this),300)},this),s=this.identify().on(this._map).at(t.latlng);this.options.layers?s.layers("visible:"+this.options.layers.join(",")):s.layers("visible"),s.run(i),this._shouldRenderPopup=!0,this._lastClick=t.latlng},_buildExportParams:function(){var t=this._map.getBounds(),e=this._map.getSize(),i=this._map.options.crs.project(t.getNorthEast()),s=this._map.options.crs.project(t.getSouthWest()),r=parseInt(this._map.options.crs.code.split(":")[1],10),o=this._map.latLngToLayerPoint(t._northEast),n=this._map.latLngToLayerPoint(t._southWest);(o.y>0||n.y<e.y)&&(e.y=n.y-o.y);var a={bbox:[s.x,s.y,i.x,i.y].join(","),size:e.x+","+e.y,dpi:96,format:this.options.format,transparent:this.options.transparent,bboxSR:r,imageSR:r};return this.options.dynamicLayers&&(a.dynamicLayers=this.options.dynamicLayers),this.options.layers&&(a.layers="show:"+this.options.layers.join(",")),this.options.layerDefs&&(a.layerDefs=JSON.stringify(this.options.layerDefs)),this.options.timeOptions&&(a.timeOptions=JSON.stringify(this.options.timeOptions)),this.options.from&&this.options.to&&(a.time=this.options.from.valueOf()+","+this.options.to.valueOf()),this.service.options.token&&(a.token=this.service.options.token),a},_requestExport:function(t,i){"json"===this.options.f?this.service.request("export",t,function(t,e){t||this._renderImage(e.href,i)},this):(t.f="image",this._renderImage(this.options.url+"export"+e.Util.getParamString(t),i))}}),bt=e.Layer.extend({options:{cellSize:512,updateInterval:150},initialize:function(t){t=e.setOptions(this,t),this._ok=!0},onAdd:function(t){this._map=t,this._update=e.Util.throttle(this._update,this.options.updateInterval,this),this._reset(),this._update()},onRemove:function(){this._map.removeEventListener(this.getEvents(),this),this._removeCells()},getEvents:function(){var t={moveend:this._update,movestart:this._start,zoomend:this._reset};return t},addTo:function(t){return t.addLayer(this),this},removeFrom:function(t){return t.removeLayer(this),this},_start:function(){this._ok=!0},_reset:function(){this._ok&&(this._removeCells(),this._cells={},this._activeCells={},this._cellsToLoad=0,this._cellsTotal=0,this._cellNumBounds=this._getCellNumBounds(),this._resetWrap(),this._zooming=!1)},_resetWrap:function(){var t=this._map,e=t.options.crs;if(!e.infinite){var i=this._getCellSize();e.wrapLng&&(this._wrapLng=[Math.floor(t.project([0,e.wrapLng[0]]).x/i),Math.ceil(t.project([0,e.wrapLng[1]]).x/i)]),e.wrapLat&&(this._wrapLat=[Math.floor(t.project([e.wrapLat[0],0]).y/i),Math.ceil(t.project([e.wrapLat[1],0]).y/i)])}},_getCellSize:function(){return this.options.cellSize},_update:function(){if(this._ok&&this._map){var t=this._map.getPixelBounds(),i=this._getCellSize(),s=e.bounds(t.min.divideBy(i).floor(),t.max.divideBy(i).floor());this._removeOtherCells(s),this._addCells(s),this.fire("cellsupdated"),this._ok=!1}},_addCells:function(t){var i,s,r,o=[],n=t.getCenter(),a=this._map.getZoom();for(i=t.min.y;i<=t.max.y;i++)for(s=t.min.x;s<=t.max.x;s++)r=e.point(s,i),r.z=a,this._isValidCell(r)&&o.push(r);var l=o.length;if(0!==l)for(this._cellsToLoad+=l,this._cellsTotal+=l,o.sort(function(t,e){return t.distanceTo(n)-e.distanceTo(n)}),s=0;l>s;s++)this._addCell(o[s])},_isValidCell:function(t){var i=this._map.options.crs;if(!i.infinite){var s=this._cellNumBounds;if(!i.wrapLng&&(t.x<s.min.x||t.x>s.max.x)||!i.wrapLat&&(t.y<s.min.y||t.y>s.max.y))return!1}if(!this.options.bounds)return!0;var r=this._cellCoordsToBounds(t);return e.latLngBounds(this.options.bounds).intersects(r)},_cellCoordsToBounds:function(t){var i=this._map,s=this.options.cellSize,r=t.multiplyBy(s),o=r.add([s,s]),n=i.wrapLatLng(i.unproject(r,t.z)),a=i.wrapLatLng(i.unproject(o,t.z));return e.latLngBounds(n,a)},_cellCoordsToKey:function(t){return t.x+":"+t.y},_keyToCellCoords:function(t){var i=t.split(":"),s=parseInt(i[0],10),r=parseInt(i[1],10);return e.point(s,r)},_removeOtherCells:function(t){for(var e in this._cells)t.contains(this._keyToCellCoords(e))||this._removeCell(e)},_removeCell:function(t){var e=this._activeCells[t];e&&(delete this._activeCells[t],this.cellLeave&&this.cellLeave(e.bounds,e.coords),this.fire("cellleave",{bounds:e.bounds,coords:e.coords}))},_removeCells:function(){for(var t in this._cells){var e=this._cells[t].bounds,i=this._cells[t].coords;this.cellLeave&&this.cellLeave(e,i),this.fire("cellleave",{bounds:e,coords:i})}},_addCell:function(t){this._wrapCoords(t);var e=this._cellCoordsToKey(t),i=this._cells[e];i&&!this._activeCells[e]&&(this.cellEnter&&this.cellEnter(i.bounds,t),this.fire("cellenter",{bounds:i.bounds,coords:t}),this._activeCells[e]=i),i||(i={coords:t,bounds:this._cellCoordsToBounds(t)},this._cells[e]=i,this._activeCells[e]=i,this.createCell&&this.createCell(i.bounds,t),this.fire("cellcreate",{bounds:i.bounds,coords:t}))},_wrapCoords:function(t){t.x=this._wrapLng?e.Util.wrapNum(t.x,this._wrapLng):t.x,t.y=this._wrapLat?e.Util.wrapNum(t.y,this._wrapLat):t.y},_getCellNumBounds:function(){var t=this._map.getPixelWorldBounds(),i=this._getCellSize();return t?e.bounds(t.min.divideBy(i).floor(),t.max.divideBy(i).ceil().subtract([1,1])):null}});J.prototype.query=function(t){var e=this.getIndex(t);return this.values[e]},J.prototype.getIndex=function(t){this.dirty&&this.sort();for(var e,i,s=0,r=this.values.length-1;r>=s;)if(e=(s+r)/2|0,i=this.values[Math.round(e)],+i.value<+t)s=e+1;else{if(!(+i.value>+t))return e;r=e-1}return Math.abs(~r)},J.prototype.between=function(t,e){var i=this.getIndex(t),s=this.getIndex(e);if(0===i&&0===s)return[];for(;this.values[i-1]&&this.values[i-1].value===t;)i--;for(;this.values[s+1]&&this.values[s+1].value===e;)s++;return this.values[s]&&this.values[s].value===e&&this.values[s+1]&&s++,this.values.slice(i,s)},J.prototype.insert=function(t){return this.values.splice(this.getIndex(t.value),0,t),this},J.prototype.bulkAdd=function(t,e){return this.values=this.values.concat([].concat(t||[])),e?this.sort():this.dirty=!0,this},J.prototype.sort=function(){return this.values.sort(function(t,e){return+e.value-+t.value}).reverse(),this.dirty=!1,this};var Lt=bt.extend({options:{attribution:null,where:"1=1",fields:["*"],from:!1,to:!1,timeField:!1,timeFilterMode:"server",simplifyFactor:0,precision:6},initialize:function(t){if(bt.prototype.initialize.call(this,t),t.url=L(t.url),t=e.setOptions(this,t),this.service=B(t),this.service.addEventParent(this),"*"!==this.options.fields[0]){for(var i=!1,s=0;s<this.options.fields.length;s++)this.options.fields[s].match(/^(OBJECTID|FID|OID|ID)$/i)&&(i=!0);i===!1&&T("no known esriFieldTypeOID field detected in fields Array. Please add an attribute field containing unique IDs to ensure the layer can be drawn correctly.")}this.options.timeField.start&&this.options.timeField.end?(this._startTimeIndex=new J,this._endTimeIndex=new J):this.options.timeField&&(this._timeIndex=new J),this._cache={},this._currentSnapshot=[],this._activeRequests=0},onAdd:function(t){return t.on("zoomend",this._handleZoomChange,this),bt.prototype.onAdd.call(this,t)},onRemove:function(t){return t.off("zoomend",this._handleZoomChange,this),bt.prototype.onRemove.call(this,t)},getAttribution:function(){return this.options.attribution},createCell:function(t,e){this._requestFeatures(t,e)},_requestFeatures:function(t,i,s){return this._activeRequests++,1===this._activeRequests&&this.fire("loading",{bounds:t},!0),this._buildQuery(t).run(function(r,o,n){n&&n.exceededTransferLimit&&this.fire("drawlimitexceeded"),!r&&o&&o.features.length&&e.Util.requestAnimFrame(e.Util.bind(function(){this._addFeatures(o.features,i),this._postProcessFeatures(t)},this)),r||!o||o.features.length||this._postProcessFeatures(t),r&&this._postProcessFeatures(t),s&&s.call(this,r,o)},this)},_postProcessFeatures:function(t){this._activeRequests--,this._activeRequests<=0&&this.fire("load",{bounds:t})},_cacheKey:function(t){return t.z+":"+t.x+":"+t.y},_addFeatures:function(t,e){var i=this._cacheKey(e);this._cache[i]=this._cache[i]||[];for(var s=t.length-1;s>=0;s--){var r=t[s].id;this._currentSnapshot.push(r),this._cache[i].push(r)}this.options.timeField&&this._buildTimeIndexes(t),this.createLayers(t)},_buildQuery:function(t){var e=this.service.query().intersects(t).where(this.options.where).fields(this.options.fields).precision(this.options.precision);return this.options.simplifyFactor&&e.simplify(this._map,this.options.simplifyFactor),"server"===this.options.timeFilterMode&&this.options.from&&this.options.to&&e.between(this.options.from,this.options.to),e},setWhere:function(t,i,s){this.options.where=t&&t.length?t:"1=1";for(var r=[],o=[],n=0,a=null,l=e.Util.bind(function(t,l){if(t&&(a=t),l)for(var u=l.features.length-1;u>=0;u--)o.push(l.features[u].id);n--,0>=n&&(this._currentSnapshot=o,e.Util.requestAnimFrame(e.Util.bind(function(){this.removeLayers(r),this.addLayers(o),i&&i.call(s,a)},this)))},this),u=this._currentSnapshot.length-1;u>=0;u--)r.push(this._currentSnapshot[u]);for(var h in this._activeCells){n++;var c=this._keyToCellCoords(h),p=this._cellCoordsToBounds(c);this._requestFeatures(p,h,l)}return this},getWhere:function(){return this.options.where},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(t,i,s,r){var o=this.options.from,n=this.options.to,a=0,l=null,u=e.Util.bind(function(e){e&&(l=e),this._filterExistingFeatures(o,n,t,i),a--,s&&0>=a&&s.call(r,l)},this);if(this.options.from=t,this.options.to=i,this._filterExistingFeatures(o,n,t,i),"server"===this.options.timeFilterMode)for(var h in this._activeCells){a++;var c=this._keyToCellCoords(h),p=this._cellCoordsToBounds(c);this._requestFeatures(p,h,u)}return this},refresh:function(){for(var t in this._activeCells){var e=this._keyToCellCoords(t),i=this._cellCoordsToBounds(e);this._requestFeatures(i,t)}this.redraw&&this.once("load",function(){this.eachFeature(function(t){this._redraw(t.feature.id)},this)},this)},_filterExistingFeatures:function(t,i,s,r){var o=t&&i?this._getFeaturesInTimeRange(t,i):this._currentSnapshot,n=this._getFeaturesInTimeRange(s,r);if(n.indexOf)for(var a=0;a<n.length;a++){var l=o.indexOf(n[a]);l>=0&&o.splice(l,1)}e.Util.requestAnimFrame(e.Util.bind(function(){this.removeLayers(o),this.addLayers(n)},this))},_getFeaturesInTimeRange:function(t,e){var i,s=[];if(this.options.timeField.start&&this.options.timeField.end){var r=this._startTimeIndex.between(t,e),o=this._endTimeIndex.between(t,e);i=r.concat(o)}else i=this._timeIndex.between(t,e);for(var n=i.length-1;n>=0;n--)s.push(i[n].id);return s},_buildTimeIndexes:function(t){var e,i;if(this.options.timeField.start&&this.options.timeField.end){var s=[],r=[];for(e=t.length-1;e>=0;e--)i=t[e],s.push({id:i.id,value:new Date(i.properties[this.options.timeField.start])}),r.push({id:i.id,value:new Date(i.properties[this.options.timeField.end])});this._startTimeIndex.bulkAdd(s),this._endTimeIndex.bulkAdd(r)}else{var o=[];for(e=t.length-1;e>=0;e--)i=t[e],o.push({id:i.id,value:new Date(i.properties[this.options.timeField])});this._timeIndex.bulkAdd(o)}},_featureWithinTimeRange:function(t){if(!this.options.from||!this.options.to)return!0;var e=+this.options.from.valueOf(),i=+this.options.to.valueOf();if("string"==typeof this.options.timeField){var s=+t.properties[this.options.timeField];return s>=e&&i>=s}if(this.options.timeField.start&&this.options.timeField.end){var r=+t.properties[this.options.timeField.start],o=+t.properties[this.options.timeField.end];return r>=e&&i>=r||o>=e&&i>=o}},_visibleZoom:function(){if(!this._map)return!1;var t=this._map.getZoom();return t>this.options.maxZoom||t<this.options.minZoom?!1:!0},_handleZoomChange:function(){if(this._visibleZoom())for(var t in this._activeCells){var e=this._activeCells[t].coords,i=this._cacheKey(e);this._cache[i]&&this.addLayers(this._cache[i])}else this.removeLayers(this._currentSnapshot),this._currentSnapshot=[]},authenticate:function(t){return this.service.authenticate(t),this},metadata:function(t,e){return this.service.metadata(t,e),this},query:function(){return this.service.query()},_getMetadata:function(t){if(this._metadata){var i;t(i,this._metadata)}else this.metadata(e.Util.bind(function(e,i){this._metadata=i,t(e,this._metadata)},this))},addFeature:function(t,i,s){this._getMetadata(e.Util.bind(function(r,o){return r?void(i&&i.call(this,r,null)):void this.service.addFeature(t,e.Util.bind(function(e,r){e||(t.properties[o.objectIdField]=r.objectId,t.id=r.objectId,this.createLayers([t])),i&&i.call(s,e,r)},this))},this))},updateFeature:function(t,e,i){this.service.updateFeature(t,function(s,r){s||(this.removeLayers([t.id],!0),this.createLayers([t])),e&&e.call(i,s,r)},this)},deleteFeature:function(t,e,i){this.service.deleteFeature(t,function(t,s){!t&&s.objectId&&this.removeLayers([s.objectId],!0),e&&e.call(i,t,s)},this)},deleteFeatures:function(t,e,i){return this.service.deleteFeatures(t,function(t,s){if(!t&&s.length>0)for(var r=0;r<s.length;r++)this.removeLayers([s[r].objectId],!0);e&&e.call(i,t,s)},this)}}),xt=Lt.extend({options:{cacheLayers:!0},initialize:function(t){Lt.prototype.initialize.call(this,t),this._originalStyle=this.options.style,this._layers={}},onRemove:function(t){for(var e in this._layers)t.removeLayer(this._layers[e]);return Lt.prototype.onRemove.call(this,t)},createNewLayer:function(t){var i=e.GeoJSON.geometryToLayer(t,this.options);return i.defaultOptions=i.options,i},_updateLayer:function(t,i){var s=[],r=this.options.coordsToLatLng||e.GeoJSON.coordsToLatLng;switch(i.properties&&(t.feature.properties=i.properties),i.geometry.type){case"Point":s=e.GeoJSON.coordsToLatLng(i.geometry.coordinates),t.setLatLng(s);break;case"LineString":s=e.GeoJSON.coordsToLatLngs(i.geometry.coordinates,0,r),t.setLatLngs(s);break;case"MultiLineString":s=e.GeoJSON.coordsToLatLngs(i.geometry.coordinates,1,r),t.setLatLngs(s);break;case"Polygon":s=e.GeoJSON.coordsToLatLngs(i.geometry.coordinates,1,r),t.setLatLngs(s);break;case"MultiPolygon":s=e.GeoJSON.coordsToLatLngs(i.geometry.coordinates,2,r),t.setLatLngs(s)}},createLayers:function(t){for(var e=t.length-1;e>=0;e--){var i,s=t[e],r=this._layers[s.id];this._visibleZoom()&&r&&!this._map.hasLayer(r)&&this._map.addLayer(r),r&&this.options.simplifyFactor>0&&(r.setLatLngs||r.setLatLng)&&this._updateLayer(r,s),r||(i=this.createNewLayer(s),i.feature=s,i.addEventParent(this),this.options.onEachFeature&&this.options.onEachFeature(i.feature,i),this._layers[i.feature.id]=i,this.setFeatureStyle(i.feature.id,this.options.style),this.fire("createfeature",{feature:i.feature},!0),this._visibleZoom()&&(!this.options.timeField||this.options.timeField&&this._featureWithinTimeRange(s))&&this._map.addLayer(i))}},addLayers:function(t){for(var e=t.length-1;e>=0;e--){var i=this._layers[t[e]];i&&(this.fire("addfeature",{feature:i.feature},!0),this._map.addLayer(i))}},removeLayers:function(t,e){for(var i=t.length-1;i>=0;i--){var s=t[i],r=this._layers[s];r&&(this.fire("removefeature",{feature:r.feature,permanent:e},!0),this._map.removeLayer(r)),r&&e&&delete this._layers[s]}},cellEnter:function(t,i){!this._zooming&&this._map&&e.Util.requestAnimFrame(e.Util.bind(function(){var t=this._cacheKey(i),e=this._cellCoordsToKey(i),s=this._cache[t];this._activeCells[e]&&s&&this.addLayers(s)},this))},cellLeave:function(t,i){this._zooming||e.Util.requestAnimFrame(e.Util.bind(function(){if(this._map){var t=this._cacheKey(i),e=this._cellCoordsToKey(i),s=this._cache[t],r=this._map.getBounds();if(!this._activeCells[e]&&s){for(var o=!0,n=0;n<s.length;n++){var a=this._layers[s[n]];a&&a.getBounds&&r.intersects(a.getBounds())&&(o=!1)}o&&this.removeLayers(s,!this.options.cacheLayers),!this.options.cacheLayers&&o&&(delete this._cache[t],delete this._cells[e],delete this._activeCells[e])}}},this))},resetStyle:function(){return this.options.style=this._originalStyle,this.eachFeature(function(t){this.resetFeatureStyle(t.feature.id)},this),this},setStyle:function(t){return this.options.style=t,this.eachFeature(function(e){this.setFeatureStyle(e.feature.id,t)},this),this},resetFeatureStyle:function(t){var i=this._layers[t],s=this._originalStyle||e.Path.prototype.options;return i&&(e.Util.extend(i.options,i.defaultOptions),this.setFeatureStyle(t,s)),this},setFeatureStyle:function(t,e){var i=this._layers[t];return"function"==typeof e&&(e=e(i.feature)),i.setStyle&&i.setStyle(e),this},eachFeature:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},getFeature:function(t){return this._layers[t]},bringToBack:function(){this.eachFeature(function(t){t.bringToBack&&t.bringToBack()})},bringToFront:function(){this.eachFeature(function(t){t.bringToFront&&t.bringToFront()})},redraw:function(t){return t&&this._redraw(t),this},_redraw:function(t){var i=this._layers[t],s=i.feature;if(i&&i.setIcon&&this.options.pointToLayer&&this.options.pointToLayer){var r=this.options.pointToLayer(s,e.latLng(s.geometry.coordinates[1],s.geometry.coordinates[0])),o=r.options.icon;i.setIcon(o)}if(i&&i.setStyle&&this.options.pointToLayer){var n=this.options.pointToLayer(s,e.latLng(s.geometry.coordinates[1],s.geometry.coordinates[0])),a=n.options;this.setFeatureStyle(s.id,a)}i&&i.setStyle&&this.options.style&&this.resetStyle(s.id)}});t.VERSION=H,t.Support=X,t.Util=$,t.get=tt,t.post=P,t.request=C,t.Task=it,t.task=F,t.Query=st,t.query=k,t.Find=rt,t.find=M,t.Identify=ot,t.identify=E,t.IdentifyFeatures=nt,t.identifyFeatures=G,t.IdentifyImage=at,t.identifyImage=q,t.Service=lt,t.service=A,t.MapService=ut,t.mapService=U,t.ImageService=ht,t.imageService=D,t.FeatureLayerService=ct,t.featureLayerService=B,t.BasemapLayer=mt,t.basemapLayer=j,t.TiledMapLayer=ft,t.tiledMapLayer=Z,t.RasterLayer=yt,t.ImageMapLayer=_t,t.imageMapLayer=N,t.DynamicMapLayer=vt,t.dynamicMapLayer=W,t.FeatureManager=Lt,t.FeatureLayer=xt,t.featureLayer=Q});
/* esri-leaflet - v2.0.0 - Fri Apr 29 2016 10:58:58 GMT-0700 (PDT)
* Copyright (c) 2016 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("leaflet")):"function"==typeof define&&define.amd?define(["exports","leaflet"],e):e((t.L=t.L||{},t.L.esri=t.L.esri||{}),t.L)}(this,function(t,e){"use strict";function i(t,e){for(var i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}function s(t){return i(t[0],t[t.length-1])||t.push(t[0]),t}function o(t){var e,i=0,s=0,o=t.length,r=t[s];for(s;o-1>s;s++)e=t[s+1],i+=(e[0]-r[0])*(e[1]+r[1]),r=e;return i>=0}function r(t,e,i,s){var o=(s[0]-i[0])*(t[1]-i[1])-(s[1]-i[1])*(t[0]-i[0]),r=(e[0]-t[0])*(t[1]-i[1])-(e[1]-t[1])*(t[0]-i[0]),n=(s[1]-i[1])*(e[0]-t[0])-(s[0]-i[0])*(e[1]-t[1]);if(0!==n){var a=o/n,l=r/n;if(a>=0&&1>=a&&l>=0&&1>=l)return!0}return!1}function n(t,e){for(var i=0;i<t.length-1;i++)for(var s=0;s<e.length-1;s++)if(r(t[i],t[i+1],e[s],e[s+1]))return!0;return!1}function a(t,e){for(var i=!1,s=-1,o=t.length,r=o-1;++s<o;r=s)(t[s][1]<=e[1]&&e[1]<t[r][1]||t[r][1]<=e[1]&&e[1]<t[s][1])&&e[0]<(t[r][0]-t[s][0])*(e[1]-t[s][1])/(t[r][1]-t[s][1])+t[s][0]&&(i=!i);return i}function l(t,e){var i=n(t,e),s=a(t,e[0]);return!(i||!s)}function u(t){for(var e,i,r,a=[],u=[],h=0;h<t.length;h++){var c=s(t[h].slice(0));if(!(c.length<4))if(o(c)){var p=[c];a.push(p)}else u.push(c)}for(var d=[];u.length;){r=u.pop();var m=!1;for(e=a.length-1;e>=0;e--)if(i=a[e][0],l(i,r)){a[e].push(r),m=!0;break}m||d.push(r)}for(;d.length;){r=d.pop();var f=!1;for(e=a.length-1;e>=0;e--)if(i=a[e][0],n(i,r)){a[e].push(r),f=!0;break}f||a.push([r.reverse()])}return 1===a.length?{type:"Polygon",coordinates:a[0]}:{type:"MultiPolygon",coordinates:a}}function h(t){var e=[],i=t.slice(0),r=s(i.shift().slice(0));if(r.length>=4){o(r)||r.reverse(),e.push(r);for(var n=0;n<i.length;n++){var a=s(i[n].slice(0));a.length>=4&&(o(a)&&a.reverse(),e.push(a))}}return e}function c(t){for(var e=[],i=0;i<t.length;i++)for(var s=h(t[i]),o=s.length-1;o>=0;o--){var r=s[o].slice(0);e.push(r)}return e}function p(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function d(t,e){var i={};return"number"==typeof t.x&&"number"==typeof t.y&&(i.type="Point",i.coordinates=[t.x,t.y]),t.points&&(i.type="MultiPoint",i.coordinates=t.points.slice(0)),t.paths&&(1===t.paths.length?(i.type="LineString",i.coordinates=t.paths[0].slice(0)):(i.type="MultiLineString",i.coordinates=t.paths.slice(0))),t.rings&&(i=u(t.rings.slice(0))),(t.geometry||t.attributes)&&(i.type="Feature",i.geometry=t.geometry?d(t.geometry):null,i.properties=t.attributes?p(t.attributes):null,t.attributes&&(i.id=t.attributes[e]||t.attributes.OBJECTID||t.attributes.FID)),i}function m(t,e){e=e||"OBJECTID";var i,s={wkid:4326},o={};switch(t.type){case"Point":o.x=t.coordinates[0],o.y=t.coordinates[1],o.spatialReference=s;break;case"MultiPoint":o.points=t.coordinates.slice(0),o.spatialReference=s;break;case"LineString":o.paths=[t.coordinates.slice(0)],o.spatialReference=s;break;case"MultiLineString":o.paths=t.coordinates.slice(0),o.spatialReference=s;break;case"Polygon":o.rings=h(t.coordinates.slice(0)),o.spatialReference=s;break;case"MultiPolygon":o.rings=c(t.coordinates.slice(0)),o.spatialReference=s;break;case"Feature":t.geometry&&(o.geometry=m(t.geometry,e)),o.attributes=t.properties?p(t.properties):{},t.id&&(o.attributes[e]=t.id);break;case"FeatureCollection":for(o=[],i=0;i<t.features.length;i++)o.push(m(t.features[i],e));break;case"GeometryCollection":for(o=[],i=0;i<t.geometries.length;i++)o.push(m(t.geometries[i],e))}return o}function f(t,e){return m(t,e)}function g(t,e){return d(t,e)}function y(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function _(t){var i=e.latLng(t.ymin,t.xmin),s=e.latLng(t.ymax,t.xmax);return e.latLngBounds(i,s)}function v(t){return t=e.latLngBounds(t),{xmin:t.getSouthWest().lng,ymin:t.getSouthWest().lat,xmax:t.getNorthEast().lng,ymax:t.getNorthEast().lat,spatialReference:{wkid:4326}}}function b(t,e){var i;if(e)i=e;else if(t.objectIdFieldName)i=t.objectIdFieldName;else if(t.fields){for(var s=0;s<=t.fields.length-1;s++)if("esriFieldTypeOID"===t.fields[s].type){i=t.fields[s].name;break}}else i="OBJECTID";var o={type:"FeatureCollection",features:[]},r=t.features||t.results;if(r.length)for(var n=r.length-1;n>=0;n--){var a=g(r[n],i);o.features.push(a)}return o}function L(t){return t=e.Util.trim(t),"/"!==t[t.length-1]&&(t+="/"),t}function x(t){return/\.arcgis\.com.*?FeatureServer/g.test(t)}function S(t){var e;switch(t){case"Point":e="esriGeometryPoint";break;case"MultiPoint":e="esriGeometryMultipoint";break;case"LineString":e="esriGeometryPolyline";break;case"MultiLineString":e="esriGeometryPolyline";break;case"Polygon":e="esriGeometryPolygon";break;case"MultiPolygon":e="esriGeometryPolygon"}return e}function T(){console&&console.warn&&console.warn.apply(console,arguments)}function I(t){var e="";t.f=t.f||"json";for(var i in t)if(t.hasOwnProperty(i)){var s,o=t[i],r=Object.prototype.toString.call(o);e.length&&(e+="&"),s="[object Array]"===r?"[object Object]"===Object.prototype.toString.call(o[0])?JSON.stringify(o):o.join(","):"[object Object]"===r?JSON.stringify(o):"[object Date]"===r?o.valueOf():o,e+=encodeURIComponent(i)+"="+encodeURIComponent(s)}return e}function w(t,i){var s=new window.XMLHttpRequest;return s.onerror=function(o){s.onreadystatechange=e.Util.falseFn,t.call(i,{error:{code:500,message:"XMLHttpRequest error"}},null)},s.onreadystatechange=function(){var o,r;if(4===s.readyState){try{o=JSON.parse(s.responseText)}catch(n){o=null,r={code:500,message:"Could not parse response as JSON. This could also be caused by a CORS or XMLHttpRequest error."}}!r&&o.error&&(r=o.error,o=null),s.onerror=e.Util.falseFn,t.call(i,r,o)}},s.ontimeout=function(){this.onerror()},s}function P(t,e,i,s){var o=w(i,s);return o.open("POST",t),"undefined"!=typeof s&&null!==s&&"undefined"!=typeof s.options&&(o.timeout=s.options.timeout),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.send(I(e)),o}function R(t,e,i,s){var o=w(i,s);return o.open("GET",t+"?"+I(e),!0),"undefined"!=typeof s&&null!==s&&"undefined"!=typeof s.options&&(o.timeout=s.options.timeout),o.send(null),o}function C(t,e,i,s){var o=I(e),r=w(i,s),n=(t+"?"+o).length;if(2e3>=n&&X.cors?r.open("GET",t+"?"+o):n>2e3&&X.cors&&(r.open("POST",t),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded")),"undefined"!=typeof s&&null!==s&&"undefined"!=typeof s.options&&(r.timeout=s.options.timeout),2e3>=n&&X.cors)r.send(null);else{if(!(n>2e3&&X.cors))return 2e3>=n&&!X.cors?O(t,e,i,s):void T("a request to "+t+" was longer then 2000 characters and this browser cannot make a cross-domain post request. Please use a proxy http://esri.github.io/esri-leaflet/api-reference/request.html");r.send(o)}return r}function O(t,i,s,o){window._EsriLeafletCallbacks=window._EsriLeafletCallbacks||{};var r="c"+Y;i.callback="window._EsriLeafletCallbacks."+r,window._EsriLeafletCallbacks[r]=function(t){if(window._EsriLeafletCallbacks[r]!==!0){var e,i=Object.prototype.toString.call(t);"[object Object]"!==i&&"[object Array]"!==i&&(e={error:{code:500,message:"Expected array or object as JSONP response"}},t=null),!e&&t.error&&(e=t,t=null),s.call(o,e,t),window._EsriLeafletCallbacks[r]=!0}};var n=e.DomUtil.create("script",null,document.body);return n.type="text/javascript",n.src=t+"?"+I(i),n.id=r,Y++,{id:r,url:n.src,abort:function(){window._EsriLeafletCallbacks._callback[r]({code:0,message:"Request aborted."})}}}function F(t){return new it(t)}function k(t){return new st(t)}function M(t){return new ot(t)}function G(t){return new rt(t)}function E(t){return new nt(t)}function q(t){return new at(t)}function A(t){return new lt(t)}function U(t){return new ut(t)}function z(t){return new ht(t)}function D(t){return new ct(t)}function B(t){return new pt(t)}function j(t,e){return new mt(t,e)}function Z(t,e){return new ft(t,e)}function N(t,e){return new _t(t,e)}function W(t,e){return new vt(t,e)}function J(t){this.values=[].concat(t||[])}function Q(t){return new xt(t)}e="default"in e?e["default"]:e;var H="2.0.0",K=window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest,V=""===document.documentElement.style.pointerEvents,X={cors:K,pointerEvents:V},$={shallowClone:y,warn:T,cleanUrl:L,isArcgisOnline:x,geojsonTypeToArcGIS:S,responseToFeatureCollection:b,geojsonToArcGIS:f,arcgisToGeoJSON:g,boundsToExtent:v,extentToBounds:_},Y=0,tt=X.cors?R:O;tt.CORS=R,tt.JSONP=O;var et={request:C,get:tt,post:P},it=e.Class.extend({options:{proxy:!1,useCors:K},generateSetter:function(t,i){return e.Util.bind(function(e){return this.params[t]=e,this},i)},initialize:function(t){if(t.request&&t.options?(this._service=t,e.Util.setOptions(this,t.options)):(e.Util.setOptions(this,t),this.options.url=L(t.url)),this.params=e.Util.extend({},this.params||{}),this.setters)for(var i in this.setters){var s=this.setters[i];this[i]=this.generateSetter(s,this)}},token:function(t){return this._service?this._service.authenticate(t):this.params.token=t,this},request:function(t,e){return this._service?this._service.request(this.path,this.params,t,e):this._request("request",this.path,this.params,t,e)},_request:function(t,e,i,s,o){var r=this.options.proxy?this.options.proxy+"?"+this.options.url+e:this.options.url+e;return"get"!==t&&"request"!==t||this.options.useCors?et[t](r,i,s,o):et.get.JSONP(r,i,s,o)}}),st=it.extend({setters:{offset:"offset",limit:"limit",fields:"outFields",precision:"geometryPrecision",featureIds:"objectIds",returnGeometry:"returnGeometry",token:"token"},path:"query",params:{returnGeometry:!0,where:"1=1",outSr:4326,outFields:"*"},within:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelContains",this},intersects:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelIntersects",this},contains:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelWithin",this},crosses:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelCrosses",this},touches:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelTouches",this},overlaps:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelOverlaps",this},nearby:function(t,i){return t=e.latLng(t),this.params.geometry=[t.lng,t.lat],this.params.geometryType="esriGeometryPoint",this.params.spatialRel="esriSpatialRelIntersects",this.params.units="esriSRUnit_Meter",this.params.distance=i,this.params.inSr=4326,this},where:function(t){return this.params.where=t,this},between:function(t,e){return this.params.time=[t.valueOf(),e.valueOf()],this},simplify:function(t,e){var i=Math.abs(t.getBounds().getWest()-t.getBounds().getEast());return this.params.maxAllowableOffset=i/t.getSize().y*e,this},orderBy:function(t,e){return e=e||"ASC",this.params.orderByFields=this.params.orderByFields?this.params.orderByFields+",":"",this.params.orderByFields+=[t,e].join(" "),this},run:function(t,e){return this._cleanParams(),$.isArcgisOnline(this.options.url)?(this.params.f="geojson",this.request(function(i,s){this._trapSQLerrors(i),t.call(e,i,s,s)},this)):this.request(function(i,s){this._trapSQLerrors(i),t.call(e,i,s&&$.responseToFeatureCollection(s),s)},this)},count:function(t,e){return this._cleanParams(),this.params.returnCountOnly=!0,this.request(function(e,i){t.call(this,e,i&&i.count,i)},e)},ids:function(t,e){return this._cleanParams(),this.params.returnIdsOnly=!0,this.request(function(e,i){t.call(this,e,i&&i.objectIds,i)},e)},bounds:function(t,e){return this._cleanParams(),this.params.returnExtentOnly=!0,this.request(function(i,s){t.call(e,i,s&&s.extent&&$.extentToBounds(s.extent),s)},e)},pixelSize:function(t){return t=e.point(t),this.params.pixelSize=[t.x,t.y],this},layer:function(t){return this.path=t+"/query",this},_trapSQLerrors:function(t){t&&"400"===t.code&&$.warn("one common syntax error in query requests is encasing string values in double quotes instead of single quotes")},_cleanParams:function(){delete this.params.returnIdsOnly,delete this.params.returnExtentOnly,delete this.params.returnCountOnly},_setGeometry:function(t){return this.params.inSr=4326,t instanceof e.LatLngBounds?(this.params.geometry=$.boundsToExtent(t),void(this.params.geometryType="esriGeometryEnvelope")):(t.getLatLng&&(t=t.getLatLng()),t instanceof e.LatLng&&(t={type:"Point",coordinates:[t.lng,t.lat]}),t instanceof e.GeoJSON&&(t=t.getLayers()[0].feature.geometry,this.params.geometry=$.geojsonToArcGIS(t),this.params.geometryType=$.geojsonTypeToArcGIS(t.type)),t.toGeoJSON&&(t=t.toGeoJSON()),"Feature"===t.type&&(t=t.geometry),"Point"===t.type||"LineString"===t.type||"Polygon"===t.type?(this.params.geometry=$.geojsonToArcGIS(t),void(this.params.geometryType=$.geojsonTypeToArcGIS(t.type))):void $.warn("invalid geometry passed to spatial query. Should be an L.LatLng, L.LatLngBounds or L.Marker or a GeoJSON Point Line or Polygon object"))}}),ot=it.extend({setters:{contains:"contains",text:"searchText",fields:"searchFields",spatialReference:"sr",sr:"sr",layers:"layers",returnGeometry:"returnGeometry",maxAllowableOffset:"maxAllowableOffset",precision:"geometryPrecision",dynamicLayers:"dynamicLayers",returnZ:"returnZ",returnM:"returnM",gdbVersion:"gdbVersion",token:"token"},path:"find",params:{sr:4326,contains:!0,returnGeometry:!0,returnZ:!0,returnM:!1},layerDefs:function(t,e){return this.params.layerDefs=this.params.layerDefs?this.params.layerDefs+";":"",this.params.layerDefs+=[t,e].join(":"),this},simplify:function(t,e){var i=Math.abs(t.getBounds().getWest()-t.getBounds().getEast());return this.params.maxAllowableOffset=i/t.getSize().y*e,this},run:function(t,e){return this.request(function(i,s){t.call(e,i,s&&$.responseToFeatureCollection(s),s)},e)}}),rt=it.extend({path:"identify",between:function(t,e){return this.params.time=[t.valueOf(),e.valueOf()],this}}),nt=rt.extend({setters:{layers:"layers",precision:"geometryPrecision",tolerance:"tolerance",returnGeometry:"returnGeometry"},params:{sr:4326,layers:"all",tolerance:3,returnGeometry:!0},on:function(t){var e=$.boundsToExtent(t.getBounds()),i=t.getSize();return this.params.imageDisplay=[i.x,i.y,96],this.params.mapExtent=[e.xmin,e.ymin,e.xmax,e.ymax],this},at:function(t){return t=e.latLng(t),this.params.geometry=[t.lng,t.lat],this.params.geometryType="esriGeometryPoint",this},layerDef:function(t,e){return this.params.layerDefs=this.params.layerDefs?this.params.layerDefs+";":"",this.params.layerDefs+=[t,e].join(":"),this},simplify:function(t,e){var i=Math.abs(t.getBounds().getWest()-t.getBounds().getEast());return this.params.maxAllowableOffset=i/t.getSize().y*(1-e),this},run:function(t,e){return this.request(function(i,s){if(i)return void t.call(e,i,void 0,s);var o=$.responseToFeatureCollection(s);s.results=s.results.reverse();for(var r=0;r<o.features.length;r++){var n=o.features[r];n.layerId=s.results[r].layerId}t.call(e,void 0,o,s)})}}),at=rt.extend({setters:{setMosaicRule:"mosaicRule",setRenderingRule:"renderingRule",setPixelSize:"pixelSize",returnCatalogItems:"returnCatalogItems",returnGeometry:"returnGeometry"},params:{returnGeometry:!1},at:function(t){return t=e.latLng(t),this.params.geometry=JSON.stringify({x:t.lng,y:t.lat,spatialReference:{wkid:4326}}),this.params.geometryType="esriGeometryPoint",this},getMosaicRule:function(){return this.params.mosaicRule},getRenderingRule:function(){return this.params.renderingRule},getPixelSize:function(){return this.params.pixelSize},run:function(t,e){return this.request(function(i,s){t.call(e,i,s&&this._responseToGeoJSON(s),s)},this)},_responseToGeoJSON:function(t){var e=t.location,i=t.catalogItems,s=t.catalogItemVisibilities,o={pixel:{type:"Feature",geometry:{type:"Point",coordinates:[e.x,e.y]},crs:{type:"EPSG",properties:{code:e.spatialReference.wkid}},properties:{OBJECTID:t.objectId,name:t.name,value:t.value},id:t.objectId}};if(t.properties&&t.properties.Values&&(o.pixel.properties.values=t.properties.Values),i&&i.features&&(o.catalogItems=$.responseToFeatureCollection(i),s&&s.length===o.catalogItems.features.length))for(var r=s.length-1;r>=0;r--)o.catalogItems.features[r].properties.catalogItemVisibility=s[r];return o}}),lt=e.Evented.extend({options:{proxy:!1,useCors:K,timeout:0},initialize:function(t){t=t||{},this._requestQueue=[],this._authenticating=!1,e.Util.setOptions(this,t),this.options.url=L(this.options.url)},get:function(t,e,i,s){return this._request("get",t,e,i,s)},post:function(t,e,i,s){return this._request("post",t,e,i,s)},request:function(t,e,i,s){return this._request("request",t,e,i,s)},metadata:function(t,e){return this._request("get","",{},t,e)},authenticate:function(t){return this._authenticating=!1,this.options.token=t,this._runQueue(),this},getTimeout:function(){return this.options.timeout},setTimeout:function(t){this.options.timeout=t},_request:function(t,e,i,s,o){this.fire("requeststart",{url:this.options.url+e,params:i,method:t},!0);var r=this._createServiceCallback(t,e,i,s,o);if(this.options.token&&(i.token=this.options.token),this._authenticating)return void this._requestQueue.push([t,e,i,s,o]);var n=this.options.proxy?this.options.proxy+"?"+this.options.url+e:this.options.url+e;return"get"!==t&&"request"!==t||this.options.useCors?et[t](n,i,r,o):et.get.JSONP(n,i,r,o)},_createServiceCallback:function(t,i,s,o,r){return e.Util.bind(function(n,a){!n||499!==n.code&&498!==n.code||(this._authenticating=!0,this._requestQueue.push([t,i,s,o,r]),this.fire("authenticationrequired",{authenticate:e.Util.bind(this.authenticate,this)},!0),n.authenticate=e.Util.bind(this.authenticate,this)),o.call(r,n,a),n?this.fire("requesterror",{url:this.options.url+i,params:s,message:n.message,code:n.code,method:t},!0):this.fire("requestsuccess",{url:this.options.url+i,params:s,response:a,method:t},!0),this.fire("requestend",{url:this.options.url+i,params:s,method:t},!0)},this)},_runQueue:function(){for(var t=this._requestQueue.length-1;t>=0;t--){var e=this._requestQueue[t],i=e.shift();this[i].apply(this,e)}this._requestQueue=[]}}),ut=lt.extend({identify:function(){return E(this)},find:function(){return M(this)},query:function(){return k(this)}}),ht=lt.extend({query:function(){return k(this)},identify:function(){return q(this)}}),ct=lt.extend({options:{idAttribute:"OBJECTID"},query:function(){return k(this)},addFeature:function(t,e,i){return delete t.id,t=f(t),this.post("addFeatures",{features:[t]},function(t,s){var o=s&&s.addResults?s.addResults[0]:void 0;e&&e.call(i,t||s.addResults[0].error,o)},i)},updateFeature:function(t,e,i){return t=f(t,this.options.idAttribute),this.post("updateFeatures",{features:[t]},function(t,s){var o=s&&s.updateResults?s.updateResults[0]:void 0;e&&e.call(i,t||s.updateResults[0].error,o)},i)},deleteFeature:function(t,e,i){return this.post("deleteFeatures",{objectIds:t},function(t,s){var o=s&&s.deleteResults?s.deleteResults[0]:void 0;e&&e.call(i,t||s.deleteResults[0].error,o)},i)},deleteFeatures:function(t,e,i){return this.post("deleteFeatures",{objectIds:t},function(t,s){var o=s&&s.deleteResults?s.deleteResults:void 0;e&&e.call(i,t||s.deleteResults[0].error,o)},i)}}),pt=e.Control.extend({options:{position:"bottomright",marginTop:0,marginLeft:0,marginBottom:0,marginRight:0},onAdd:function(){var t=e.DomUtil.create("div","esri-leaflet-logo");return t.style.marginTop=this.options.marginTop,t.style.marginLeft=this.options.marginLeft,t.style.marginBottom=this.options.marginBottom,t.style.marginRight=this.options.marginRight,t.innerHTML='<a href="http://www.esri.com" target="_blank" style="border: none;"><img src="https://js.arcgis.com/3.13/esri/images/map/logo-sm.png" alt="Powered by Esri" style="border: none;"></a>',t}}),dt="https:"!==window.location.protocol?"http:":"https:",mt=e.TileLayer.extend({statics:{TILES:{Streets:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}",attributionUrl:"https://static.arcgis.com/attribution/World_Street_Map",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"Esri"}},Topographic:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}",attributionUrl:"https://static.arcgis.com/attribution/World_Topo_Map",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"Esri"}},Oceans:{urlTemplate:dt+"//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}",attributionUrl:"https://static.arcgis.com/attribution/Ocean_Basemap",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"Esri"}},OceansLabels:{urlTemplate:dt+"//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"],pane:V?"esri-labels":"tilePane"}},NationalGeographic:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"National Geographic, Esri, DeLorme, HERE, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, increment P Corp."}},DarkGray:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"Esri, HERE, DeLorme, MapmyIndia, © OpenStreetMap contributors"}},DarkGrayLabels:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Reference/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"],pane:V?"esri-labels":"tilePane"}},Gray:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"Esri, HERE, DeLorme, MapmyIndia, © OpenStreetMap contributors"}},GrayLabels:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"],pane:V?"esri-labels":"tilePane"}},Imagery:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"Esri, DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community"}},ImageryLabels:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:19,subdomains:["server","services"],pane:V?"esri-labels":"tilePane"}},ImageryTransportation:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:19,subdomains:["server","services"],pane:V?"esri-labels":"tilePane"}},ShadedRelief:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:13,subdomains:["server","services"],attribution:"Esri, USGS"}},ShadedReliefLabels:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:12,subdomains:["server","services"],pane:V?"esri-labels":"tilePane"}},Terrain:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:13,subdomains:["server","services"],attribution:"Esri, USGS, NOAA"}},TerrainLabels:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:13,subdomains:["server","services"],pane:V?"esri-labels":"tilePane"}},USATopo:{urlTemplate:dt+"//{s}.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:15,subdomains:["server","services"],attribution:"National Geographic Society, i-cubed"}}}},initialize:function(t,i){var s;if("object"==typeof t&&t.urlTemplate&&t.options)s=t;else{if("string"!=typeof t||!mt.TILES[t])throw new Error('L.esri.BasemapLayer: Invalid parameter. Use one of "Streets", "Topographic", "Oceans", "OceansLabels", "NationalGeographic", "Gray", "GrayLabels", "DarkGray", "DarkGrayLabels", "Imagery", "ImageryLabels", "ImageryTransportation", "ShadedRelief", "ShadedReliefLabels", "Terrain" or "TerrainLabels"');s=mt.TILES[t]}var o=e.Util.extend(s.options,i);e.Util.setOptions(this,o),e.TileLayer.prototype.initialize.call(this,s.urlTemplate,o),s.attributionUrl&&this._getAttributionData(s.attributionUrl),this._logo=B({position:this.options.logoPosition})},onAdd:function(t){this.options.hideLogo||t._hasEsriLogo||(this._logo.addTo(t),t._hasEsriLogo=!0),"esri-labels"===this.options.pane&&this._initPane(),t.on("moveend",this._updateMapAttribution,this),e.TileLayer.prototype.onAdd.call(this,t)},onRemove:function(t){this._logo&&this._logo._container&&(t.removeControl(this._logo),t._hasEsriLogo=!1),t.off("moveend",this._updateMapAttribution,this),e.TileLayer.prototype.onRemove.call(this,t)},getAttribution:function(){if(this.options.attribution)var t='<span class="esri-attributions" style="line-height:14px; vertical-align: -3px; text-overflow:ellipsis; white-space:nowrap; overflow:hidden; display:inline-block;">'+this.options.attribution+"</span>";return t},_initPane:function(){if(!this._map.getPane(this.options.pane)){var t=this._map.createPane(this.options.pane);t.style.pointerEvents="none",t.style.zIndex=500}},_getAttributionData:function(t){O(t,{},e.Util.bind(function(t,i){if(!t){this._attributions=[];for(var s=0;s<i.contributors.length;s++)for(var o=i.contributors[s],r=0;r<o.coverageAreas.length;r++){var n=o.coverageAreas[r],a=e.latLng(n.bbox[0],n.bbox[1]),l=e.latLng(n.bbox[2],n.bbox[3]);this._attributions.push({attribution:o.attribution,score:n.score,bounds:e.latLngBounds(a,l),minZoom:n.zoomMin,maxZoom:n.zoomMax})}this._attributions.sort(function(t,e){return e.score-t.score}),this._updateMapAttribution()}},this))},_updateMapAttribution:function(){if(this._map&&this._map.attributionControl&&this._attributions){for(var t="",e=this._map.getBounds(),i=this._map.getZoom(),s=0;s<this._attributions.length;s++){var o=this._attributions[s],r=o.attribution;!t.match(r)&&e.intersects(o.bounds)&&i>=o.minZoom&&i<=o.maxZoom&&(t+=", "+r)}t=t.substr(2);var n=this._map.attributionControl._container.querySelector(".esri-attributions");n.innerHTML=t,n.style.maxWidth=.65*this._map.getSize().x+"px",this.fire("attributionupdated",{attribution:t})}}}),ft=e.TileLayer.extend({options:{zoomOffsetAllowance:.1},statics:{MercatorZoomLevels:{0:156543.033928,1:78271.5169639999,2:39135.7584820001,3:19567.8792409999,4:9783.93962049996,5:4891.96981024998,6:2445.98490512499,7:1222.99245256249,8:611.49622628138,9:305.748113140558,10:152.874056570411,11:76.4370282850732,12:38.2185141425366,13:19.1092570712683,14:9.55462853563415,15:4.77731426794937,16:2.38865713397468,17:1.19432856685505,18:.597164283559817,19:.298582141647617,20:.14929107082381,21:.07464553541191,22:.0373227677059525,23:.0186613838529763}},initialize:function(t){t.url=L(t.url),t=e.Util.setOptions(this,t),this.tileUrl=t.url+"tile/{z}/{y}/{x}",this.service=U(t),this.service.addEventParent(this);var i=new RegExp(/tiles.arcgis(online)?\.com/g);i.test(t.url)&&(this.tileUrl=this.tileUrl.replace("://tiles","://tiles{s}"),t.subdomains=["1","2","3","4"]),this.options.token&&(this.tileUrl+="?token="+this.options.token),e.TileLayer.prototype.initialize.call(this,this.tileUrl,t)},getTileUrl:function(t){return e.Util.template(this.tileUrl,e.extend({s:this._getSubdomain(t),z:this._lodMap&&this._lodMap[t.z]?this._lodMap[t.z]:t.z,x:t.x,y:t.y},this.options))},createTile:function(t,i){var s=document.createElement("img");return e.DomEvent.on(s,"load",e.bind(this._tileOnLoad,this,i,s)),e.DomEvent.on(s,"error",e.bind(this._tileOnError,this,i,s)),this.options.crossOrigin&&(s.crossOrigin=""),s.alt="",!this._lodMap||this._lodMap&&this._lodMap[t.z]?s.src=this.getTileUrl(t):this.once("lodmap",function(){s.src=this.getTileUrl(t)},this),s},onAdd:function(t){t.options.crs!==e.CRS.EPSG3857||this._lodMap||(this._lodMap={},this.metadata(function(t,e){if(!t){var i=e.spatialReference.latestWkid||e.spatialReference.wkid;if(102100===i||3857===i){for(var s=e.tileInfo.lods,o=ft.MercatorZoomLevels,r=0;r<s.length;r++){var n=s[r];for(var a in o){var l=o[a];if(this._withinPercentage(n.resolution,l,this.options.zoomOffsetAllowance)){this._lodMap[a]=n.level;break}}}this.fire("lodmap")}else T("L.esri.TiledMapLayer is using a non-mercator spatial reference. Support may be available through Proj4Leaflet http://esri.github.io/esri-leaflet/examples/non-mercator-projection.html")}},this)),e.TileLayer.prototype.onAdd.call(this,t)},metadata:function(t,e){return this.service.metadata(t,e),this},identify:function(){return this.service.identify()},find:function(){return this.service.find()},query:function(){return this.service.query()},authenticate:function(t){var e="?token="+t;return this.tileUrl=this.options.token?this.tileUrl.replace(/\?token=(.+)/g,e):this.tileUrl+e,this.options.token=t,this.service.authenticate(t),this},_withinPercentage:function(t,e,i){var s=Math.abs(t/e-1);return i>s}}),gt=e.ImageOverlay.extend({onAdd:function(t){this._topLeft=t.getPixelBounds().min,e.ImageOverlay.prototype.onAdd.call(this,t)},_reset:function(){this._map.options.crs===e.CRS.EPSG3857?e.ImageOverlay.prototype._reset.call(this):e.DomUtil.setPosition(this._image,this._topLeft.subtract(this._map.getPixelOrigin()))}}),yt=e.Layer.extend({options:{opacity:1,position:"front",f:"image",useCors:K,attribution:null,interactive:!1,alt:""},onAdd:function(t){this._update=e.Util.throttle(this._update,this.options.updateInterval,this),t.on("moveend",this._update,this),this._currentImage&&this._currentImage._bounds.equals(this._map.getBounds())?t.addLayer(this._currentImage):this._currentImage&&(this._map.removeLayer(this._currentImage),this._currentImage=null),this._update(),this._popup&&(this._map.on("click",this._getPopupData,this),this._map.on("dblclick",this._resetPopupState,this))},onRemove:function(t){this._currentImage&&this._map.removeLayer(this._currentImage),this._popup&&(this._map.off("click",this._getPopupData,this),this._map.off("dblclick",this._resetPopupState,this)),this._map.off("moveend",this._update,this)},bindPopup:function(t,i){return this._shouldRenderPopup=!1,this._lastClick=!1,this._popup=e.popup(i),this._popupFunction=t,this._map&&(this._map.on("click",this._getPopupData,this),this._map.on("dblclick",this._resetPopupState,this)),this},unbindPopup:function(){return this._map&&(this._map.closePopup(this._popup),this._map.off("click",this._getPopupData,this),this._map.off("dblclick",this._resetPopupState,this)),this._popup=!1,this},bringToFront:function(){return this.options.position="front",this._currentImage&&this._currentImage.bringToFront(),this},bringToBack:function(){return this.options.position="back",this._currentImage&&this._currentImage.bringToBack(),this},getAttribution:function(){return this.options.attribution},getOpacity:function(){return this.options.opacity},setOpacity:function(t){return this.options.opacity=t,this._currentImage.setOpacity(t),this},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(t,e){return this.options.from=t,
this.options.to=e,this._update(),this},metadata:function(t,e){return this.service.metadata(t,e),this},authenticate:function(t){return this.service.authenticate(t),this},_renderImage:function(t,e){if(this._map){var i=new gt(t,e,{opacity:0,crossOrigin:this.options.useCors,alt:this.options.alt,pane:this.options.pane||this.getPane(),interactive:this.options.interactive}).addTo(this._map);i.once("load",function(t){if(this._map){var i=t.target,s=this._currentImage;i._bounds.equals(e)&&i._bounds.equals(this._map.getBounds())?(this._currentImage=i,"front"===this.options.position?this.bringToFront():this.bringToBack(),this._map&&this._currentImage._map?this._currentImage.setOpacity(this.options.opacity):this._currentImage._map.removeLayer(this._currentImage),s&&this._map&&this._map.removeLayer(s),s&&s._map&&s._map.removeLayer(s)):this._map.removeLayer(i)}this.fire("load",{bounds:e})},this),this.fire("loading",{bounds:e})}},_update:function(){if(this._map){var t=this._map.getZoom(),e=this._map.getBounds();if(!(this._animatingZoom||this._map._panTransition&&this._map._panTransition._inProgress)){if(t>this.options.maxZoom||t<this.options.minZoom)return void this._currentImage._map.removeLayer(this._currentImage);var i=this._buildExportParams();this._requestExport(i,e)}}},_renderPopup:function(t,i,s,o){if(t=e.latLng(t),this._shouldRenderPopup&&this._lastClick.equals(t)){var r=this._popupFunction(i,s,o);r&&this._popup.setLatLng(t).setContent(r).openOn(this._map)}},_resetPopupState:function(t){this._shouldRenderPopup=!1,this._lastClick=t.latlng}}),_t=yt.extend({options:{updateInterval:150,format:"jpgpng",transparent:!0,f:"json"},query:function(){return this.service.query()},identify:function(){return this.service.identify()},initialize:function(t){t.url=L(t.url),this.service=z(t),this.service.addEventParent(this),e.Util.setOptions(this,t)},setPixelType:function(t){return this.options.pixelType=t,this._update(),this},getPixelType:function(){return this.options.pixelType},setBandIds:function(t){return e.Util.isArray(t)?this.options.bandIds=t.join(","):this.options.bandIds=t.toString(),this._update(),this},getBandIds:function(){return this.options.bandIds},setNoData:function(t,i){return e.Util.isArray(t)?this.options.noData=t.join(","):this.options.noData=t.toString(),i&&(this.options.noDataInterpretation=i),this._update(),this},getNoData:function(){return this.options.noData},getNoDataInterpretation:function(){return this.options.noDataInterpretation},setRenderingRule:function(t){this.options.renderingRule=t,this._update()},getRenderingRule:function(){return this.options.renderingRule},setMosaicRule:function(t){this.options.mosaicRule=t,this._update()},getMosaicRule:function(){return this.options.mosaicRule},_getPopupData:function(t){var i=e.Util.bind(function(i,s,o){i||setTimeout(e.Util.bind(function(){this._renderPopup(t.latlng,i,s,o)},this),300)},this),s=this.identify().at(t.latlng);this.options.mosaicRule&&s.setMosaicRule(this.options.mosaicRule),s.run(i),this._shouldRenderPopup=!0,this._lastClick=t.latlng},_buildExportParams:function(){var t=this._map.getBounds(),e=this._map.getSize(),i=this._map.options.crs.project(t._northEast),s=this._map.options.crs.project(t._southWest),o=this._map.latLngToLayerPoint(t._northEast),r=this._map.latLngToLayerPoint(t._southWest);(o.y>0||r.y<e.y)&&(e.y=r.y-o.y);var n=parseInt(this._map.options.crs.code.split(":")[1],10),a={bbox:[s.x,s.y,i.x,i.y].join(","),size:e.x+","+e.y,format:this.options.format,transparent:this.options.transparent,bboxSR:n,imageSR:n};return this.options.from&&this.options.to&&(a.time=this.options.from.valueOf()+","+this.options.to.valueOf()),this.options.pixelType&&(a.pixelType=this.options.pixelType),this.options.interpolation&&(a.interpolation=this.options.interpolation),this.options.compressionQuality&&(a.compressionQuality=this.options.compressionQuality),this.options.bandIds&&(a.bandIds=this.options.bandIds),this.options.noData&&(a.noData=this.options.noData),this.options.noDataInterpretation&&(a.noDataInterpretation=this.options.noDataInterpretation),this.service.options.token&&(a.token=this.service.options.token),this.options.renderingRule&&(a.renderingRule=JSON.stringify(this.options.renderingRule)),this.options.mosaicRule&&(a.mosaicRule=JSON.stringify(this.options.mosaicRule)),a},_requestExport:function(t,i){"json"===this.options.f?this.service.request("exportImage",t,function(t,e){t||this._renderImage(e.href,i)},this):(t.f="image",this._renderImage(this.options.url+"exportImage"+e.Util.getParamString(t),i))}}),vt=yt.extend({options:{updateInterval:150,layers:!1,layerDefs:!1,timeOptions:!1,format:"png24",transparent:!0,f:"json"},initialize:function(t){t.url=L(t.url),this.service=U(t),this.service.addEventParent(this),(t.proxy||t.token)&&"json"!==t.f&&(t.f="json"),e.Util.setOptions(this,t)},getDynamicLayers:function(){return this.options.dynamicLayers},setDynamicLayers:function(t){return this.options.dynamicLayers=t,this._update(),this},getLayers:function(){return this.options.layers},setLayers:function(t){return this.options.layers=t,this._update(),this},getLayerDefs:function(){return this.options.layerDefs},setLayerDefs:function(t){return this.options.layerDefs=t,this._update(),this},getTimeOptions:function(){return this.options.timeOptions},setTimeOptions:function(t){return this.options.timeOptions=t,this._update(),this},query:function(){return this.service.query()},identify:function(){return this.service.identify()},find:function(){return this.service.find()},_getPopupData:function(t){var i=e.Util.bind(function(i,s,o){i||setTimeout(e.Util.bind(function(){this._renderPopup(t.latlng,i,s,o)},this),300)},this),s=this.identify().on(this._map).at(t.latlng);this.options.layers?s.layers("visible:"+this.options.layers.join(",")):s.layers("visible"),s.run(i),this._shouldRenderPopup=!0,this._lastClick=t.latlng},_buildExportParams:function(){var t=this._map.getBounds(),e=this._map.getSize(),i=this._map.options.crs.project(t.getNorthEast()),s=this._map.options.crs.project(t.getSouthWest()),o=parseInt(this._map.options.crs.code.split(":")[1],10),r=this._map.latLngToLayerPoint(t._northEast),n=this._map.latLngToLayerPoint(t._southWest);(r.y>0||n.y<e.y)&&(e.y=n.y-r.y);var a={bbox:[s.x,s.y,i.x,i.y].join(","),size:e.x+","+e.y,dpi:96,format:this.options.format,transparent:this.options.transparent,bboxSR:o,imageSR:o};return this.options.dynamicLayers&&(a.dynamicLayers=this.options.dynamicLayers),this.options.layers&&(a.layers="show:"+this.options.layers.join(",")),this.options.layerDefs&&(a.layerDefs=JSON.stringify(this.options.layerDefs)),this.options.timeOptions&&(a.timeOptions=JSON.stringify(this.options.timeOptions)),this.options.from&&this.options.to&&(a.time=this.options.from.valueOf()+","+this.options.to.valueOf()),this.service.options.token&&(a.token=this.service.options.token),a},_requestExport:function(t,i){"json"===this.options.f?this.service.request("export",t,function(t,e){t||this._renderImage(e.href,i)},this):(t.f="image",this._renderImage(this.options.url+"export"+e.Util.getParamString(t),i))}}),bt=e.Layer.extend({options:{cellSize:512,updateInterval:150},initialize:function(t){t=e.setOptions(this,t),this._zooming=!1},onAdd:function(t){this._map=t,this._update=e.Util.throttle(this._update,this.options.updateInterval,this),this._reset(),this._update()},onRemove:function(){this._map.removeEventListener(this.getEvents(),this),this._removeCells()},getEvents:function(){var t={moveend:this._update,zoomstart:this._zoomstart,zoomend:this._reset};return t},addTo:function(t){return t.addLayer(this),this},removeFrom:function(t){return t.removeLayer(this),this},_zoomstart:function(){this._zooming=!0},_reset:function(){this._removeCells(),this._cells={},this._activeCells={},this._cellsToLoad=0,this._cellsTotal=0,this._cellNumBounds=this._getCellNumBounds(),this._resetWrap(),this._zooming=!1},_resetWrap:function(){var t=this._map,e=t.options.crs;if(!e.infinite){var i=this._getCellSize();e.wrapLng&&(this._wrapLng=[Math.floor(t.project([0,e.wrapLng[0]]).x/i),Math.ceil(t.project([0,e.wrapLng[1]]).x/i)]),e.wrapLat&&(this._wrapLat=[Math.floor(t.project([e.wrapLat[0],0]).y/i),Math.ceil(t.project([e.wrapLat[1],0]).y/i)])}},_getCellSize:function(){return this.options.cellSize},_update:function(){if(this._map){var t=this._map.getPixelBounds(),i=this._getCellSize(),s=e.bounds(t.min.divideBy(i).floor(),t.max.divideBy(i).floor());this._removeOtherCells(s),this._addCells(s),this.fire("cellsupdated")}},_addCells:function(t){var i,s,o,r=[],n=t.getCenter(),a=this._map.getZoom();for(i=t.min.y;i<=t.max.y;i++)for(s=t.min.x;s<=t.max.x;s++)o=e.point(s,i),o.z=a,this._isValidCell(o)&&r.push(o);var l=r.length;if(0!==l)for(this._cellsToLoad+=l,this._cellsTotal+=l,r.sort(function(t,e){return t.distanceTo(n)-e.distanceTo(n)}),s=0;l>s;s++)this._addCell(r[s])},_isValidCell:function(t){var i=this._map.options.crs;if(!i.infinite){var s=this._cellNumBounds;if(!i.wrapLng&&(t.x<s.min.x||t.x>s.max.x)||!i.wrapLat&&(t.y<s.min.y||t.y>s.max.y))return!1}if(!this.options.bounds)return!0;var o=this._cellCoordsToBounds(t);return e.latLngBounds(this.options.bounds).intersects(o)},_cellCoordsToBounds:function(t){var i=this._map,s=this.options.cellSize,o=t.multiplyBy(s),r=o.add([s,s]),n=i.wrapLatLng(i.unproject(o,t.z)),a=i.wrapLatLng(i.unproject(r,t.z));return e.latLngBounds(n,a)},_cellCoordsToKey:function(t){return t.x+":"+t.y},_keyToCellCoords:function(t){var i=t.split(":"),s=parseInt(i[0],10),o=parseInt(i[1],10);return e.point(s,o)},_removeOtherCells:function(t){for(var e in this._cells)t.contains(this._keyToCellCoords(e))||this._removeCell(e)},_removeCell:function(t){var e=this._activeCells[t];e&&(delete this._activeCells[t],this.cellLeave&&this.cellLeave(e.bounds,e.coords),this.fire("cellleave",{bounds:e.bounds,coords:e.coords}))},_removeCells:function(){for(var t in this._cells){var e=this._cells[t].bounds,i=this._cells[t].coords;this.cellLeave&&this.cellLeave(e,i),this.fire("cellleave",{bounds:e,coords:i})}},_addCell:function(t){this._wrapCoords(t);var e=this._cellCoordsToKey(t),i=this._cells[e];i&&!this._activeCells[e]&&(this.cellEnter&&this.cellEnter(i.bounds,t),this.fire("cellenter",{bounds:i.bounds,coords:t}),this._activeCells[e]=i),i||(i={coords:t,bounds:this._cellCoordsToBounds(t)},this._cells[e]=i,this._activeCells[e]=i,this.createCell&&this.createCell(i.bounds,t),this.fire("cellcreate",{bounds:i.bounds,coords:t}))},_wrapCoords:function(t){t.x=this._wrapLng?e.Util.wrapNum(t.x,this._wrapLng):t.x,t.y=this._wrapLat?e.Util.wrapNum(t.y,this._wrapLat):t.y},_getCellNumBounds:function(){var t=this._map.getPixelWorldBounds(),i=this._getCellSize();return t?e.bounds(t.min.divideBy(i).floor(),t.max.divideBy(i).ceil().subtract([1,1])):null}});J.prototype.query=function(t){var e=this.getIndex(t);return this.values[e]},J.prototype.getIndex=function(t){this.dirty&&this.sort();for(var e,i,s=0,o=this.values.length-1;o>=s;)if(e=(s+o)/2|0,i=this.values[Math.round(e)],+i.value<+t)s=e+1;else{if(!(+i.value>+t))return e;o=e-1}return Math.abs(~o)},J.prototype.between=function(t,e){var i=this.getIndex(t),s=this.getIndex(e);if(0===i&&0===s)return[];for(;this.values[i-1]&&this.values[i-1].value===t;)i--;for(;this.values[s+1]&&this.values[s+1].value===e;)s++;return this.values[s]&&this.values[s].value===e&&this.values[s+1]&&s++,this.values.slice(i,s)},J.prototype.insert=function(t){return this.values.splice(this.getIndex(t.value),0,t),this},J.prototype.bulkAdd=function(t,e){return this.values=this.values.concat([].concat(t||[])),e?this.sort():this.dirty=!0,this},J.prototype.sort=function(){return this.values.sort(function(t,e){return+e.value-+t.value}).reverse(),this.dirty=!1,this};var Lt=bt.extend({options:{attribution:null,where:"1=1",fields:["*"],from:!1,to:!1,timeField:!1,timeFilterMode:"server",simplifyFactor:0,precision:6},initialize:function(t){if(bt.prototype.initialize.call(this,t),t.url=L(t.url),t=e.setOptions(this,t),this.service=D(t),this.service.addEventParent(this),"*"!==this.options.fields[0]){for(var i=!1,s=0;s<this.options.fields.length;s++)this.options.fields[s].match(/^(OBJECTID|FID|OID|ID)$/i)&&(i=!0);i===!1&&T("no known esriFieldTypeOID field detected in fields Array. Please add an attribute field containing unique IDs to ensure the layer can be drawn correctly.")}this.options.timeField.start&&this.options.timeField.end?(this._startTimeIndex=new J,this._endTimeIndex=new J):this.options.timeField&&(this._timeIndex=new J),this._cache={},this._currentSnapshot=[],this._activeRequests=0},onAdd:function(t){return t.on("zoomend",this._handleZoomChange,this),bt.prototype.onAdd.call(this,t)},onRemove:function(t){return t.off("zoomend",this._handleZoomChange,this),bt.prototype.onRemove.call(this,t)},getAttribution:function(){return this.options.attribution},createCell:function(t,e){this._requestFeatures(t,e)},_requestFeatures:function(t,i,s){return this._activeRequests++,1===this._activeRequests&&this.fire("loading",{bounds:t},!0),this._buildQuery(t).run(function(o,r,n){n&&n.exceededTransferLimit&&this.fire("drawlimitexceeded"),!o&&r&&r.features.length&&e.Util.requestAnimFrame(e.Util.bind(function(){this._addFeatures(r.features,i),this._postProcessFeatures(t)},this)),o||!r||r.features.length||this._postProcessFeatures(t),o&&this._postProcessFeatures(t),s&&s.call(this,o,r)},this)},_postProcessFeatures:function(t){this._activeRequests--,this._activeRequests<=0&&this.fire("load",{bounds:t})},_cacheKey:function(t){return t.z+":"+t.x+":"+t.y},_addFeatures:function(t,e){var i=this._cacheKey(e);this._cache[i]=this._cache[i]||[];for(var s=t.length-1;s>=0;s--){var o=t[s].id;this._currentSnapshot.push(o),this._cache[i].push(o)}this.options.timeField&&this._buildTimeIndexes(t),this.createLayers(t)},_buildQuery:function(t){var e=this.service.query().intersects(t).where(this.options.where).fields(this.options.fields).precision(this.options.precision);return this.options.simplifyFactor&&e.simplify(this._map,this.options.simplifyFactor),"server"===this.options.timeFilterMode&&this.options.from&&this.options.to&&e.between(this.options.from,this.options.to),e},setWhere:function(t,i,s){this.options.where=t&&t.length?t:"1=1";for(var o=[],r=[],n=0,a=null,l=e.Util.bind(function(t,l){if(t&&(a=t),l)for(var u=l.features.length-1;u>=0;u--)r.push(l.features[u].id);n--,0>=n&&(this._currentSnapshot=r,e.Util.requestAnimFrame(e.Util.bind(function(){this.removeLayers(o),this.addLayers(r),i&&i.call(s,a)},this)))},this),u=this._currentSnapshot.length-1;u>=0;u--)o.push(this._currentSnapshot[u]);for(var h in this._activeCells){n++;var c=this._keyToCellCoords(h),p=this._cellCoordsToBounds(c);this._requestFeatures(p,h,l)}return this},getWhere:function(){return this.options.where},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(t,i,s,o){var r=this.options.from,n=this.options.to,a=0,l=null,u=e.Util.bind(function(e){e&&(l=e),this._filterExistingFeatures(r,n,t,i),a--,s&&0>=a&&s.call(o,l)},this);if(this.options.from=t,this.options.to=i,this._filterExistingFeatures(r,n,t,i),"server"===this.options.timeFilterMode)for(var h in this._activeCells){a++;var c=this._keyToCellCoords(h),p=this._cellCoordsToBounds(c);this._requestFeatures(p,h,u)}return this},refresh:function(){for(var t in this._activeCells){var e=this._keyToCellCoords(t),i=this._cellCoordsToBounds(e);this._requestFeatures(i,t)}this.redraw&&this.once("load",function(){this.eachFeature(function(t){this._redraw(t.feature.id)},this)},this)},_filterExistingFeatures:function(t,i,s,o){var r=t&&i?this._getFeaturesInTimeRange(t,i):this._currentSnapshot,n=this._getFeaturesInTimeRange(s,o);if(n.indexOf)for(var a=0;a<n.length;a++){var l=r.indexOf(n[a]);l>=0&&r.splice(l,1)}e.Util.requestAnimFrame(e.Util.bind(function(){this.removeLayers(r),this.addLayers(n)},this))},_getFeaturesInTimeRange:function(t,e){var i,s=[];if(this.options.timeField.start&&this.options.timeField.end){var o=this._startTimeIndex.between(t,e),r=this._endTimeIndex.between(t,e);i=o.concat(r)}else i=this._timeIndex.between(t,e);for(var n=i.length-1;n>=0;n--)s.push(i[n].id);return s},_buildTimeIndexes:function(t){var e,i;if(this.options.timeField.start&&this.options.timeField.end){var s=[],o=[];for(e=t.length-1;e>=0;e--)i=t[e],s.push({id:i.id,value:new Date(i.properties[this.options.timeField.start])}),o.push({id:i.id,value:new Date(i.properties[this.options.timeField.end])});this._startTimeIndex.bulkAdd(s),this._endTimeIndex.bulkAdd(o)}else{var r=[];for(e=t.length-1;e>=0;e--)i=t[e],r.push({id:i.id,value:new Date(i.properties[this.options.timeField])});this._timeIndex.bulkAdd(r)}},_featureWithinTimeRange:function(t){if(!this.options.from||!this.options.to)return!0;var e=+this.options.from.valueOf(),i=+this.options.to.valueOf();if("string"==typeof this.options.timeField){var s=+t.properties[this.options.timeField];return s>=e&&i>=s}if(this.options.timeField.start&&this.options.timeField.end){var o=+t.properties[this.options.timeField.start],r=+t.properties[this.options.timeField.end];return o>=e&&i>=o||r>=e&&i>=r}},_visibleZoom:function(){if(!this._map)return!1;var t=this._map.getZoom();return!(t>this.options.maxZoom||t<this.options.minZoom)},_handleZoomChange:function(){if(this._visibleZoom())for(var t in this._activeCells){var e=this._activeCells[t].coords,i=this._cacheKey(e);this._cache[i]&&this.addLayers(this._cache[i])}else this.removeLayers(this._currentSnapshot),this._currentSnapshot=[]},authenticate:function(t){return this.service.authenticate(t),this},metadata:function(t,e){return this.service.metadata(t,e),this},query:function(){return this.service.query()},_getMetadata:function(t){if(this._metadata){var i;t(i,this._metadata)}else this.metadata(e.Util.bind(function(e,i){this._metadata=i,t(e,this._metadata)},this))},addFeature:function(t,i,s){this._getMetadata(e.Util.bind(function(o,r){return o?void(i&&i.call(this,o,null)):void this.service.addFeature(t,e.Util.bind(function(e,o){e||(t.properties[r.objectIdField]=o.objectId,t.id=o.objectId,this.createLayers([t])),i&&i.call(s,e,o)},this))},this))},updateFeature:function(t,e,i){this.service.updateFeature(t,function(s,o){s||(this.removeLayers([t.id],!0),this.createLayers([t])),e&&e.call(i,s,o)},this)},deleteFeature:function(t,e,i){this.service.deleteFeature(t,function(t,s){!t&&s.objectId&&this.removeLayers([s.objectId],!0),e&&e.call(i,t,s)},this)},deleteFeatures:function(t,e,i){return this.service.deleteFeatures(t,function(t,s){if(!t&&s.length>0)for(var o=0;o<s.length;o++)this.removeLayers([s[o].objectId],!0);e&&e.call(i,t,s)},this)}}),xt=Lt.extend({options:{cacheLayers:!0},initialize:function(t){Lt.prototype.initialize.call(this,t),this._originalStyle=this.options.style,this._layers={}},onRemove:function(t){for(var e in this._layers)t.removeLayer(this._layers[e]);return Lt.prototype.onRemove.call(this,t)},createNewLayer:function(t){var i=e.GeoJSON.geometryToLayer(t,this.options);return i.defaultOptions=i.options,i},_updateLayer:function(t,i){var s=[],o=this.options.coordsToLatLng||e.GeoJSON.coordsToLatLng;switch(i.properties&&(t.feature.properties=i.properties),i.geometry.type){case"Point":s=e.GeoJSON.coordsToLatLng(i.geometry.coordinates),t.setLatLng(s);break;case"LineString":s=e.GeoJSON.coordsToLatLngs(i.geometry.coordinates,0,o),t.setLatLngs(s);break;case"MultiLineString":s=e.GeoJSON.coordsToLatLngs(i.geometry.coordinates,1,o),t.setLatLngs(s);break;case"Polygon":s=e.GeoJSON.coordsToLatLngs(i.geometry.coordinates,1,o),t.setLatLngs(s);break;case"MultiPolygon":s=e.GeoJSON.coordsToLatLngs(i.geometry.coordinates,2,o),t.setLatLngs(s)}},createLayers:function(t){for(var e=t.length-1;e>=0;e--){var i,s=t[e],o=this._layers[s.id];this._visibleZoom()&&o&&!this._map.hasLayer(o)&&this._map.addLayer(o),o&&this.options.simplifyFactor>0&&(o.setLatLngs||o.setLatLng)&&this._updateLayer(o,s),o||(i=this.createNewLayer(s),i.feature=s,i.addEventParent(this),this.options.onEachFeature&&this.options.onEachFeature(i.feature,i),this._layers[i.feature.id]=i,this.setFeatureStyle(i.feature.id,this.options.style),this.fire("createfeature",{feature:i.feature},!0),this._visibleZoom()&&(!this.options.timeField||this.options.timeField&&this._featureWithinTimeRange(s))&&this._map.addLayer(i))}},addLayers:function(t){for(var e=t.length-1;e>=0;e--){var i=this._layers[t[e]];i&&(this.fire("addfeature",{feature:i.feature},!0),this._map.addLayer(i))}},removeLayers:function(t,e){for(var i=t.length-1;i>=0;i--){var s=t[i],o=this._layers[s];o&&(this.fire("removefeature",{feature:o.feature,permanent:e},!0),this._map.removeLayer(o)),o&&e&&delete this._layers[s]}},cellEnter:function(t,i){!this._zooming&&this._map&&e.Util.requestAnimFrame(e.Util.bind(function(){var t=this._cacheKey(i),e=this._cellCoordsToKey(i),s=this._cache[t];this._activeCells[e]&&s&&this.addLayers(s)},this))},cellLeave:function(t,i){this._zooming||e.Util.requestAnimFrame(e.Util.bind(function(){if(this._map){var t=this._cacheKey(i),e=this._cellCoordsToKey(i),s=this._cache[t],o=this._map.getBounds();if(!this._activeCells[e]&&s){for(var r=!0,n=0;n<s.length;n++){var a=this._layers[s[n]];a&&a.getBounds&&o.intersects(a.getBounds())&&(r=!1)}r&&this.removeLayers(s,!this.options.cacheLayers),!this.options.cacheLayers&&r&&(delete this._cache[t],delete this._cells[e],delete this._activeCells[e])}}},this))},resetStyle:function(){return this.options.style=this._originalStyle,this.eachFeature(function(t){this.resetFeatureStyle(t.feature.id)},this),this},setStyle:function(t){return this.options.style=t,this.eachFeature(function(e){this.setFeatureStyle(e.feature.id,t)},this),this},resetFeatureStyle:function(t){var i=this._layers[t],s=this._originalStyle||e.Path.prototype.options;return i&&(e.Util.extend(i.options,i.defaultOptions),this.setFeatureStyle(t,s)),this},setFeatureStyle:function(t,e){var i=this._layers[t];return"function"==typeof e&&(e=e(i.feature)),i.setStyle&&i.setStyle(e),this},eachFeature:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},getFeature:function(t){return this._layers[t]},bringToBack:function(){this.eachFeature(function(t){t.bringToBack&&t.bringToBack()})},bringToFront:function(){this.eachFeature(function(t){t.bringToFront&&t.bringToFront()})},redraw:function(t){return t&&this._redraw(t),this},_redraw:function(t){var i=this._layers[t],s=i.feature;if(i&&i.setIcon&&this.options.pointToLayer&&this.options.pointToLayer){var o=this.options.pointToLayer(s,e.latLng(s.geometry.coordinates[1],s.geometry.coordinates[0])),r=o.options.icon;i.setIcon(r)}if(i&&i.setStyle&&this.options.pointToLayer){var n=this.options.pointToLayer(s,e.latLng(s.geometry.coordinates[1],s.geometry.coordinates[0])),a=n.options;this.setFeatureStyle(s.id,a)}i&&i.setStyle&&this.options.style&&this.resetStyle(s.id)}});t.VERSION=H,t.Support=X,t.Util=$,t.get=tt,t.post=P,t.request=C,t.Task=it,t.task=F,t.Query=st,t.query=k,t.Find=ot,t.find=M,t.Identify=rt,t.identify=G,t.IdentifyFeatures=nt,t.identifyFeatures=E,t.IdentifyImage=at,t.identifyImage=q,t.Service=lt,t.service=A,t.MapService=ut,t.mapService=U,t.ImageService=ht,t.imageService=z,t.FeatureLayerService=ct,t.featureLayerService=D,t.BasemapLayer=mt,t.basemapLayer=j,t.TiledMapLayer=ft,t.tiledMapLayer=Z,t.RasterLayer=yt,t.ImageMapLayer=_t,t.imageMapLayer=N,t.DynamicMapLayer=vt,t.dynamicMapLayer=W,t.FeatureManager=Lt,t.FeatureLayer=xt,t.featureLayer=Q});
//# sourceMappingURL=esri-leaflet.js.map
{
"name": "esri-leaflet",
"description": "Leaflet plugins for consuming ArcGIS Online and ArcGIS Server services.",
"version": "2.0.0-beta.8",
"version": "2.0.0",
"author": "Patrick Arlt <parlt@esri.com> (http://patrickarlt.com)",

@@ -16,3 +16,3 @@ "browser": "dist/esri-leaflet-debug.js",

"arcgis-to-geojson-utils": "^1.0.1",
"leaflet": "^1.0.0-beta.2",
"leaflet": "^1.0.0-rc.1",
"leaflet-virtual-grid": "^1.0.3",

@@ -43,4 +43,3 @@ "tiny-binary-search": "^1.0.2"

"rollup-plugin-node-resolve": "^1.4.0",
"rollup-plugin-npm": "^1.2.1",
"rollup-plugin-uglify": "^0.1.0",
"rollup-plugin-uglify": "^0.3.1",
"semistandard": "^7.0.5",

@@ -47,0 +46,0 @@ "sinon": "^1.11.1",

@@ -1,2 +0,1 @@

import uglify from 'rollup-plugin-uglify';
import config from './base.js'

@@ -3,0 +2,0 @@

@@ -6,4 +6,6 @@ import uglify from 'rollup-plugin-uglify';

config.sourceMap = 'dist/esri-leaflet.js.map';
config.plugins.push(uglify());
// use a Regex to preserve copyright text
config.plugins.push(uglify({ output: { comments: /Institute, Inc/} }));
export default config;

@@ -28,7 +28,7 @@ # Esri Leaflet

<!-- Load Leaflet from CDN-->
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/leaflet/1.0.0-beta.2/leaflet.css" />
<script src="https://cdn.jsdelivr.net/leaflet/1.0.0-beta.2/leaflet.js"></script>
<!-- Load Esri Leaflet locally, after cloning this repository -->
<script src="http://cdn.jsdelivr.net/leaflet.esri/2.0.0-beta.7/esri-leaflet.js"></script>
<script src="https://cdn.jsdelivr.net/leaflet.esri/2.0.0-beta.8/esri-leaflet.js"></script>

@@ -45,3 +45,2 @@ <style>

var map = L.map('map').setView([45.528, -122.680], 13);
L.esri.basemapLayer("Gray").addTo(map);

@@ -113,3 +112,3 @@

2. `cd` into the `esri-leaflet` folder
3. Install the dependencies with `npm install`
3. Install the [`package.json`](https://github.com/Esri/esri-leaflet/blob/master/package.json#L14-L49) dependencies by running `npm install`
4. Run `npm start` from the command line. This will compile minified source in a brand new `dist` directory, launch a tiny webserver and begin watching the raw source for changes.

@@ -116,0 +115,0 @@ 5. Run `npm test` to make sure you haven't introduced a new 'feature' accidently.

@@ -48,3 +48,3 @@ describe('L.esri.BasemapLayer', function () {

it('can return valid basemaps', function () {
var testmaps = ['Streets', 'Topographic', 'NationalGeographic', 'Oceans', 'OceansLabels','DarkGray', 'DarkGrayLabels', 'Gray', 'GrayLabels', 'Imagery', 'ImageryLabels', 'ImageryTransportation', 'ShadedRelief', 'ShadedReliefLabels', 'Terrain', 'TerrainLabels'];
var testmaps = ['Streets', 'Topographic', 'NationalGeographic', 'Oceans', 'OceansLabels','DarkGray', 'DarkGrayLabels', 'Gray', 'GrayLabels', 'Imagery', 'ImageryLabels', 'ImageryTransportation', 'ShadedRelief', 'ShadedReliefLabels', 'Terrain', 'TerrainLabels', 'USATopo'];
for (var i = 0, len = testmaps.length; i < len; i++) {

@@ -51,0 +51,0 @@ var name = testmaps[i];

@@ -190,2 +190,13 @@ import L from 'leaflet';

}
},
USATopo: {
urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/tile/{z}/{y}/{x}',
options: {
hideLogo: false,
logoPosition: 'bottomright',
minZoom: 1,
maxZoom: 15,
subdomains: ['server', 'services'],
attribution: 'National Geographic Society, i-cubed'
}
}

@@ -192,0 +203,0 @@ }

@@ -128,2 +128,11 @@ import L from 'leaflet';

var sw = this._map.options.crs.project(bounds._southWest);
// ensure that we don't ask ArcGIS Server for a taller image than we have actual map displaying
var top = this._map.latLngToLayerPoint(bounds._northEast);
var bottom = this._map.latLngToLayerPoint(bounds._southWest);
if (top.y > 0 || bottom.y < size.y) {
size.y = bottom.y - top.y;
}
var sr = parseInt(this._map.options.crs.code.split(':')[1], 10);

@@ -130,0 +139,0 @@

@@ -88,2 +88,3 @@ import L from 'leaflet';

var httpRequest = createRequest(callback, context);
httpRequest.open('POST', url);

@@ -95,4 +96,2 @@ if (typeof context !== 'undefined' && context !== null) {

}
httpRequest.open('POST', url);
httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

@@ -106,2 +105,3 @@ httpRequest.send(serialize(params));

var httpRequest = createRequest(callback, context);
httpRequest.open('GET', url + '?' + serialize(params), true);

@@ -113,4 +113,2 @@ if (typeof context !== 'undefined' && context !== null) {

}
httpRequest.open('GET', url + '?' + serialize(params), true);
httpRequest.send(null);

@@ -125,3 +123,13 @@

var httpRequest = createRequest(callback, context);
var requestLength = (url + '?' + paramString).length;
// get around ie10/11 bug which requires that the request be opened before a timeout is applied
if (requestLength <= 2000 && Support.cors) {
httpRequest.open('GET', url + '?' + paramString);
} else if (requestLength > 2000 && Support.cors) {
httpRequest.open('POST', url);
httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
}
if (typeof context !== 'undefined' && context !== null) {

@@ -133,7 +141,4 @@ if (typeof context.options !== 'undefined') {

var requestLength = (url + '?' + paramString).length;
// request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest
if (requestLength <= 2000 && Support.cors) {
httpRequest.open('GET', url + '?' + paramString);
httpRequest.send(null);

@@ -143,4 +148,2 @@

} else if (requestLength > 2000 && Support.cors) {
httpRequest.open('POST', url);
httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
httpRequest.send(paramString);

@@ -164,10 +167,4 @@

var callbackId = 'c' + callbacks;
params.callback = 'window._EsriLeafletCallbacks.' + callbackId;
var script = L.DomUtil.create('script', null, document.body);
script.type = 'text/javascript';
script.src = url + '?' + serialize(params);
script.id = callbackId;
window._EsriLeafletCallbacks[callbackId] = function (response) {

@@ -198,2 +195,7 @@ if (window._EsriLeafletCallbacks[callbackId] !== true) {

var script = L.DomUtil.create('script', null, document.body);
script.type = 'text/javascript';
script.src = url + '?' + serialize(params);
script.id = callbackId;
callbacks++;

@@ -200,0 +202,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc