From 7dfa2359c669a2f650beaf5915ca0fe0e9d8eda9 Mon Sep 17 00:00:00 2001 From: Patrick Arlt Date: Mon, 10 Nov 2014 08:52:52 -0800 Subject: [PATCH] building v1.0.0-rc.4 --- .../basemaps/esri-leaflet-basemaps-src.js | 559 +++ .../basemaps/esri-leaflet-basemaps-src.js.map | 1 + dist/builds/basemaps/esri-leaflet-basemaps.js | 24 + .../basemaps/esri-leaflet-basemaps.js.map | 1 + dist/builds/core/esri-leaflet-core-src.js | 851 +++++ dist/builds/core/esri-leaflet-core-src.js.map | 1 + dist/builds/core/esri-leaflet-core.js | 24 + dist/builds/core/esri-leaflet-core.js.map | 1 + .../esri-leaflet-feature-layer-src.js | 2132 +++++++++++ .../esri-leaflet-feature-layer-src.js.map | 1 + .../esri-leaflet-feature-layer.js | 24 + .../esri-leaflet-feature-layer.js.map | 1 + .../esri-leaflet-image-service-src.js | 1517 ++++++++ .../esri-leaflet-image-service-src.js.map | 1 + .../esri-leaflet-image-service.js | 24 + .../esri-leaflet-image-service.js.map | 1 + .../esri-leaflet-map-service-src.js | 1640 ++++++++ .../esri-leaflet-map-service-src.js.map | 1 + .../map-service/esri-leaflet-map-service.js | 24 + .../esri-leaflet-map-service.js.map | 1 + dist/esri-leaflet-src.js | 3335 +++++++++++++++++ dist/esri-leaflet-src.js.map | 1 + dist/esri-leaflet.js | 25 + dist/esri-leaflet.js.map | 1 + 24 files changed, 10191 insertions(+) create mode 100644 dist/builds/basemaps/esri-leaflet-basemaps-src.js create mode 100644 dist/builds/basemaps/esri-leaflet-basemaps-src.js.map create mode 100644 dist/builds/basemaps/esri-leaflet-basemaps.js create mode 100644 dist/builds/basemaps/esri-leaflet-basemaps.js.map create mode 100644 dist/builds/core/esri-leaflet-core-src.js create mode 100644 dist/builds/core/esri-leaflet-core-src.js.map create mode 100644 dist/builds/core/esri-leaflet-core.js create mode 100644 dist/builds/core/esri-leaflet-core.js.map create mode 100644 dist/builds/feature-layer/esri-leaflet-feature-layer-src.js create mode 100644 dist/builds/feature-layer/esri-leaflet-feature-layer-src.js.map create mode 100644 dist/builds/feature-layer/esri-leaflet-feature-layer.js create mode 100644 dist/builds/feature-layer/esri-leaflet-feature-layer.js.map create mode 100644 dist/builds/image-service/esri-leaflet-image-service-src.js create mode 100644 dist/builds/image-service/esri-leaflet-image-service-src.js.map create mode 100644 dist/builds/image-service/esri-leaflet-image-service.js create mode 100644 dist/builds/image-service/esri-leaflet-image-service.js.map create mode 100644 dist/builds/map-service/esri-leaflet-map-service-src.js create mode 100644 dist/builds/map-service/esri-leaflet-map-service-src.js.map create mode 100644 dist/builds/map-service/esri-leaflet-map-service.js create mode 100644 dist/builds/map-service/esri-leaflet-map-service.js.map create mode 100644 dist/esri-leaflet-src.js create mode 100644 dist/esri-leaflet-src.js.map create mode 100644 dist/esri-leaflet.js create mode 100644 dist/esri-leaflet.js.map diff --git a/dist/builds/basemaps/esri-leaflet-basemaps-src.js b/dist/builds/basemaps/esri-leaflet-basemaps-src.js new file mode 100644 index 000000000..b2dd020cd --- /dev/null +++ b/dist/builds/basemaps/esri-leaflet-basemaps-src.js @@ -0,0 +1,559 @@ +/*! esri-leaflet - v1.0.0-rc.3 - 2014-11-04 +* Copyright (c) 2014 Environmental Systems Research Institute, Inc. +* Apache License*/ +(function (factory) { + //define an AMD module that relies on 'leaflet' + if (typeof define === 'function' && define.amd) { + define(['leaflet'], function (L) { + return factory(L); + }); + //define a common js module that relies on 'leaflet' + } else if (typeof module === 'object' && typeof module.exports === 'object') { + module.exports = factory(require('leaflet')); + } + + if(typeof window !== 'undefined' && window.L){ + factory(window.L); + } +}(function (L) { +var EsriLeaflet = { //jshint ignore:line + VERSION: '1.0.0-rc.2', + Layers: {}, + Services: {}, + Controls: {}, + Tasks: {}, + Util: {}, + Support: { + CORS: !!(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()), + pointerEvents: document.documentElement.style.pointerEvents === '' + } +}; + +if(typeof window !== 'undefined' && window.L){ + window.L.esri = EsriLeaflet; +} + +(function(EsriLeaflet){ + + var callbacks = 0; + + window._EsriLeafletCallbacks = {}; + + function serialize(params){ + var data = ''; + + params.f = 'json'; + + for (var key in params){ + if(params.hasOwnProperty(key)){ + var param = params[key]; + var type = Object.prototype.toString.call(param); + var value; + + if(data.length){ + data += '&'; + } + + if(type === '[object Array]' || type === '[object Object]'){ + value = JSON.stringify(param); + } else if (type === '[object Date]'){ + value = param.valueOf(); + } else { + value = param; + } + + data += encodeURIComponent(key) + '=' + encodeURIComponent(value); + } + } + + return data; + } + + function createRequest(callback, context){ + var httpRequest = new XMLHttpRequest(); + + httpRequest.onerror = function(e) { + callback.call(context, { + error: { + code: 500, + message: 'XMLHttpRequest error' + } + }, null); + }; + + httpRequest.onreadystatechange = function(){ + var response; + var error; + + if (httpRequest.readyState === 4) { + try { + response = JSON.parse(httpRequest.responseText); + } catch(e) { + response = null; + error = { + code: 500, + message: 'Could not parse response as JSON.' + }; + } + + if (!error && response.error) { + error = response.error; + response = null; + } + + callback.call(context, error, response); + } + }; + + return httpRequest; + } + + // AJAX handlers for CORS (modern browsers) or JSONP (older browsers) + EsriLeaflet.Request = { + request: function(url, params, callback, context){ + var paramString = serialize(params); + var httpRequest = createRequest(callback, context); + var requestLength = (url + '?' + paramString).length; + + // request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest + if(requestLength <= 2000 && L.esri.Support.CORS){ + httpRequest.open('GET', url + '?' + paramString); + httpRequest.send(null); + + // request is less more then 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest + } else if (requestLength > 2000 && L.esri.Support.CORS){ + httpRequest.open('POST', url); + httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + httpRequest.send(paramString); + + // request is less more then 2000 characters and the browser does not support CORS, make a JSONP request + } else if(requestLength <= 2000 && !L.esri.Support.CORS){ + return L.esri.Request.get.JSONP(url, params, callback, context); + + // request is longer then 2000 characters and the browser does not support CORS, log a warning + } else { + if(console && console.warn){ + console.warn('a request to ' + url + ' 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'); + return; + } + } + + return httpRequest; + }, + post: { + XMLHTTP: function (url, params, callback, context) { + var httpRequest = createRequest(callback, context); + httpRequest.open('POST', url); + httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + httpRequest.send(serialize(params)); + + return httpRequest; + } + }, + + get: { + CORS: function (url, params, callback, context) { + var httpRequest = createRequest(callback, context); + + httpRequest.open('GET', url + '?' + serialize(params), true); + httpRequest.send(null); + + return httpRequest; + }, + JSONP: function(url, params, callback, context){ + 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){ + if(window._EsriLeafletCallbacks[callbackId] !== true){ + var error; + var responseType = Object.prototype.toString.call(response); + + if(!(responseType === '[object Object]' || responseType === '[object Array]')){ + error = { + error: { + code: 500, + message: 'Expected array or object as JSONP response' + } + }; + response = null; + } + + if (!error && response.error) { + error = response; + response = null; + } + + callback.call(context, error, response); + window._EsriLeafletCallbacks[callbackId] = true; + } + }; + + callbacks++; + + return { + id: callbackId, + url: script.src, + abort: function(){ + window._EsriLeafletCallbacks._callback[callbackId]({ + code: 0, + message: 'Request aborted.' + }); + } + }; + } + } + }; + + // Choose the correct AJAX handler depending on CORS support + EsriLeaflet.get = (EsriLeaflet.Support.CORS) ? EsriLeaflet.Request.get.CORS : EsriLeaflet.Request.get.JSONP; + + // Always use XMLHttpRequest for posts + EsriLeaflet.post = EsriLeaflet.Request.post.XMLHTTP; + + // expose a common request method the uses GET\POST based on request length + EsriLeaflet.request = EsriLeaflet.Request.request; + +})(EsriLeaflet); + +(function(EsriLeaflet){ + + var tileProtocol = (window.location.protocol !== 'https:') ? 'http:' : 'https:'; + + EsriLeaflet.Layers.BasemapLayer = L.TileLayer.extend({ + statics: { + TILES: { + Streets: { + urlTemplate: tileProtocol + '//{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: false, + logoPosition: 'bottomright', + minZoom: 1, + maxZoom: 19, + subdomains: ['server', 'services'], + attribution: 'Esri' + } + }, + Topographic: { + urlTemplate: tileProtocol + '//{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: false, + logoPosition: 'bottomright', + minZoom: 1, + maxZoom: 19, + subdomains: ['server', 'services'], + attribution: 'Esri' + } + }, + Oceans: { + urlTemplate: tileProtocol + '//{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: false, + logoPosition: 'bottomright', + minZoom: 1, + maxZoom: 16, + subdomains: ['server', 'services'], + attribution: 'Esri' + } + }, + OceansLabels: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: true, + logoPosition: 'bottomright', + //pane: 'esri-label', + minZoom: 1, + maxZoom: 16, + subdomains: ['server', 'services'] + } + }, + NationalGeographic: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: false, + logoPosition: 'bottomright', + minZoom: 1, + maxZoom: 16, + subdomains: ['server', 'services'], + attribution: 'Esri' + } + }, + DarkGray: { + urlTemplate: tileProtocol + '//tiles{s}.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Dark_Gray_Base_Beta/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: false, + logoPosition: 'bottomright', + minZoom: 1, + maxZoom: 10, + subdomains: ['1', '2'], + attribution: 'Esri, DeLorme, HERE' + } + }, + DarkGrayLabels: { + urlTemplate: tileProtocol + '//tiles{s}.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Dark_Gray_Reference_Beta/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: true, + logoPosition: 'bottomright', + //pane: 'esri-label', + minZoom: 1, + maxZoom: 10, + subdomains: ['1', '2'] + } + }, + Gray: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: false, + logoPosition: 'bottomright', + minZoom: 1, + maxZoom: 16, + subdomains: ['server', 'services'], + attribution: 'Esri, NAVTEQ, DeLorme' + } + }, + GrayLabels: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: true, + logoPosition: 'bottomright', + //pane: 'esri-label', + minZoom: 1, + maxZoom: 16, + subdomains: ['server', 'services'] + } + }, + Imagery: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: false, + 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: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: true, + logoPosition: 'bottomright', + //pane: 'esri-label', + minZoom: 1, + maxZoom: 19, + subdomains: ['server', 'services'] + } + }, + ImageryTransportation: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}', + //pane: 'esri-label', + options: { + hideLogo: true, + logoPosition: 'bottomright', + minZoom: 1, + maxZoom: 19, + subdomains: ['server', 'services'] + } + }, + ShadedRelief: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: false, + logoPosition: 'bottomright', + minZoom: 1, + maxZoom: 13, + subdomains: ['server', 'services'], + attribution: 'ESRI, NAVTEQ, DeLorme' + } + }, + ShadedReliefLabels: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: true, + logoPosition: 'bottomright', + //pane: 'esri-label', + minZoom: 1, + maxZoom: 12, + subdomains: ['server', 'services'] + } + }, + Terrain: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: false, + logoPosition: 'bottomright', + minZoom: 1, + maxZoom: 13, + subdomains: ['server', 'services'], + attribution: 'Esri, USGS, NOAA' + } + }, + TerrainLabels: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: true, + logoPosition: 'bottomright', + //pane: 'esri-label', + minZoom: 1, + maxZoom: 13, + subdomains: ['server', 'services'] + } + } + } + }, + initialize: function(key, options){ + var config; + + // set the config variable with the appropriate config object + if (typeof key === 'object' && key.urlTemplate && key.options){ + config = key; + } else if(typeof key === 'string' && EsriLeaflet.BasemapLayer.TILES[key]){ + config = EsriLeaflet.BasemapLayer.TILES[key]; + } else { + 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"'); + } + + // merge passed options into the config options + var tileOptions = L.Util.extend(config.options, options); + + // call the initialize method on L.TileLayer to set everything up + L.TileLayer.prototype.initialize.call(this, config.urlTemplate, L.Util.setOptions(this, tileOptions)); + + // if this basemap requires dynamic attribution set it up + if(config.attributionUrl){ + this._getAttributionData(config.attributionUrl); + } + }, + onAdd: function(map){ + if(!this.options.hideLogo){ + this._logo = new EsriLeaflet.Controls.Logo({ + position: this.options.logoPosition + }).addTo(map); + } + + // if(this.options.pane && EsriLeaflet.Support.pointerEvents){ + // this._initPane(); + // } + + L.TileLayer.prototype.onAdd.call(this, map); + + map.on('moveend', this._updateMapAttribution, this); + }, + onRemove: function(map){ + if(this._logo){ + map.removeControl(this._logo); + } + + L.TileLayer.prototype.onRemove.call(this, map); + + map.off('moveend', this._updateMapAttribution, this); + }, + getAttribution:function(){ + var attribution = '' + this.options.attribution + ''/* + logo*/; + return attribution; + }, + // _initPane: function(){ + // if(!this._map.getPane(this.options.pane)){ + // var pane = this._map.createPane(this.options.pane); + // pane.style.pointerEvents = 'none'; + // pane.style.zIndex = 5; + // } + // }, + _getAttributionData: function(url){ + EsriLeaflet.get(url, {}, function(error, attributions){ + this._attributions = []; + for (var c = 0; c < attributions.contributors.length; c++) { + var contributor = attributions.contributors[c]; + for (var i = 0; i < contributor.coverageAreas.length; i++) { + var coverageArea = contributor.coverageAreas[i]; + var southWest = new L.LatLng(coverageArea.bbox[0], coverageArea.bbox[1]); + var northEast = new L.LatLng(coverageArea.bbox[2], coverageArea.bbox[3]); + this._attributions.push({ + attribution: contributor.attribution, + score: coverageArea.score, + bounds: new L.LatLngBounds(southWest, northEast), + minZoom: coverageArea.zoomMin, + maxZoom: coverageArea.zoomMax + }); + } + } + + this._attributions.sort(function(a, b){ + return b.score - a.score; + }); + + this._updateMapAttribution(); + }, this); + }, + _updateMapAttribution: function(){ + if(this._map && this._map.attributionControl && this._attributions){ + var newAttributions = ''; + var bounds = this._map.getBounds(); + var zoom = this._map.getZoom(); + + for (var i = 0; i < this._attributions.length; i++) { + var attribution = this._attributions[i]; + var text = attribution.attribution; + if(!newAttributions.match(text) && bounds.intersects(attribution.bounds) && zoom >= attribution.minZoom && zoom <= attribution.maxZoom) { + newAttributions += (', ' + text); + } + } + newAttributions = newAttributions.substr(2); + var attributionElement = this._map.attributionControl._container.querySelector('.esri-attributions'); + attributionElement.innerHTML = newAttributions; + attributionElement.style.maxWidth = (this._map.getSize().x * 0.65) + 'px'; + this.fire('attributionupdated', { + attribution: newAttributions + }); + } + } + }); + + EsriLeaflet.BasemapLayer = EsriLeaflet.Layers.BasemapLayer; + + EsriLeaflet.Layers.basemapLayer = function(key, options){ + return new EsriLeaflet.Layers.BasemapLayer(key, options); + }; + + EsriLeaflet.basemapLayer = function(key, options){ + return new EsriLeaflet.Layers.BasemapLayer(key, options); + }; + +})(EsriLeaflet); + +EsriLeaflet.Controls.Logo = L.Control.extend({ + options: { + position: 'bottomright', + marginTop: 0, + marginLeft: 0, + marginBottom: 0, + marginRight: 0 + }, + onAdd: function () { + var div = L.DomUtil.create('div', 'esri-leaflet-logo'); + div.style.marginTop = this.options.marginTop; + div.style.marginLeft = this.options.marginLeft; + div.style.marginBottom = this.options.marginBottom; + div.style.marginRight = this.options.marginRight; + div.innerHTML = ''; + return div; + } +}); + +EsriLeaflet.Controls.logo = function(options){ + return new L.esri.Controls.Logo(options); +}; + + + return EsriLeaflet; +})); +//# sourceMappingURL=esri-leaflet-basemaps-src.js.map \ No newline at end of file diff --git a/dist/builds/basemaps/esri-leaflet-basemaps-src.js.map b/dist/builds/basemaps/esri-leaflet-basemaps-src.js.map new file mode 100644 index 000000000..22801140d --- /dev/null +++ b/dist/builds/basemaps/esri-leaflet-basemaps-src.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/EsriLeaflet.js","../../../src/Request.js","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AAG,IAAI,CAAC,OAAO,CAAC,WAAW;AAAA,IAChD,GAAG,CAAC,SAAS,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,IAAI,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,KAAK,CAAC;AAAA,IAC9K,MAAM,CAAC,GAAG;AAAA;AAAA;AAAA;AAId,WAAW,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,OAAO;AAAA,EAC1C,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO;AAAA","file":"esri-leaflet-basemaps-src.js","sourcesContent":["var EsriLeaflet = { //jshint ignore:line\n VERSION: '1.0.0-rc.2',\n Layers: {},\n Services: {},\n Controls: {},\n Tasks: {},\n Util: {},\n Support: {\n CORS: !!(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()),\n pointerEvents: document.documentElement.style.pointerEvents === ''\n }\n};\n\nif(typeof window !== 'undefined' && window.L){\n window.L.esri = EsriLeaflet;\n}","(function(EsriLeaflet){\n\n var callbacks = 0;\n\n window._EsriLeafletCallbacks = {};\n\n function serialize(params){\n var data = '';\n\n params.f = 'json';\n\n for (var key in params){\n if(params.hasOwnProperty(key)){\n var param = params[key];\n var type = Object.prototype.toString.call(param);\n var value;\n\n if(data.length){\n data += '&';\n }\n\n if(type === '[object Array]' || type === '[object Object]'){\n value = JSON.stringify(param);\n } else if (type === '[object Date]'){\n value = param.valueOf();\n } else {\n value = param;\n }\n\n data += encodeURIComponent(key) + '=' + encodeURIComponent(value);\n }\n }\n\n return data;\n }\n\n function createRequest(callback, context){\n var httpRequest = new XMLHttpRequest();\n\n httpRequest.onerror = function(e) {\n callback.call(context, {\n error: {\n code: 500,\n message: 'XMLHttpRequest error'\n }\n }, null);\n };\n\n httpRequest.onreadystatechange = function(){\n var response;\n var error;\n\n if (httpRequest.readyState === 4) {\n try {\n response = JSON.parse(httpRequest.responseText);\n } catch(e) {\n response = null;\n error = {\n code: 500,\n message: 'Could not parse response as JSON.'\n };\n }\n\n if (!error && response.error) {\n error = response.error;\n response = null;\n }\n\n callback.call(context, error, response);\n }\n };\n\n return httpRequest;\n }\n\n // AJAX handlers for CORS (modern browsers) or JSONP (older browsers)\n EsriLeaflet.Request = {\n request: function(url, params, callback, context){\n var paramString = serialize(params);\n var httpRequest = createRequest(callback, context);\n var requestLength = (url + '?' + paramString).length;\n\n // request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest\n if(requestLength <= 2000 && L.esri.Support.CORS){\n httpRequest.open('GET', url + '?' + paramString);\n httpRequest.send(null);\n\n // request is less more then 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest\n } else if (requestLength > 2000 && L.esri.Support.CORS){\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(paramString);\n\n // request is less more then 2000 characters and the browser does not support CORS, make a JSONP request\n } else if(requestLength <= 2000 && !L.esri.Support.CORS){\n return L.esri.Request.get.JSONP(url, params, callback, context);\n\n // request is longer then 2000 characters and the browser does not support CORS, log a warning\n } else {\n if(console && console.warn){\n console.warn('a request to ' + url + ' 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');\n return;\n }\n }\n\n return httpRequest;\n },\n post: {\n XMLHTTP: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(serialize(params));\n\n return httpRequest;\n }\n },\n\n get: {\n CORS: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n\n httpRequest.open('GET', url + '?' + serialize(params), true);\n httpRequest.send(null);\n\n return httpRequest;\n },\n JSONP: function(url, params, callback, context){\n var callbackId = 'c' + callbacks;\n\n params.callback = 'window._EsriLeafletCallbacks.' + callbackId;\n\n var script = L.DomUtil.create('script', null, document.body);\n script.type = 'text/javascript';\n script.src = url + '?' + serialize(params);\n script.id = callbackId;\n\n window._EsriLeafletCallbacks[callbackId] = function(response){\n if(window._EsriLeafletCallbacks[callbackId] !== true){\n var error;\n var responseType = Object.prototype.toString.call(response);\n\n if(!(responseType === '[object Object]' || responseType === '[object Array]')){\n error = {\n error: {\n code: 500,\n message: 'Expected array or object as JSONP response'\n }\n };\n response = null;\n }\n\n if (!error && response.error) {\n error = response;\n response = null;\n }\n\n callback.call(context, error, response);\n window._EsriLeafletCallbacks[callbackId] = true;\n }\n };\n\n callbacks++;\n\n return {\n id: callbackId,\n url: script.src,\n abort: function(){\n window._EsriLeafletCallbacks._callback[callbackId]({\n code: 0,\n message: 'Request aborted.'\n });\n }\n };\n }\n }\n };\n\n // Choose the correct AJAX handler depending on CORS support\n EsriLeaflet.get = (EsriLeaflet.Support.CORS) ? EsriLeaflet.Request.get.CORS : EsriLeaflet.Request.get.JSONP;\n\n // Always use XMLHttpRequest for posts\n EsriLeaflet.post = EsriLeaflet.Request.post.XMLHTTP;\n\n // expose a common request method the uses GET\\POST based on request length\n EsriLeaflet.request = EsriLeaflet.Request.request;\n\n})(EsriLeaflet);","(function(EsriLeaflet){\n\n var tileProtocol = (window.location.protocol !== 'https:') ? 'http:' : 'https:';\n\n EsriLeaflet.Layers.BasemapLayer = L.TileLayer.extend({\n statics: {\n TILES: {\n Streets: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}',\n attributionUrl: 'https://static.arcgis.com/attribution/World_Street_Map',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services'],\n attribution: 'Esri'\n }\n },\n Topographic: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}',\n attributionUrl: 'https://static.arcgis.com/attribution/World_Topo_Map',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services'],\n attribution: 'Esri'\n }\n },\n Oceans: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}',\n attributionUrl: 'https://static.arcgis.com/attribution/Ocean_Basemap',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services'],\n attribution: 'Esri'\n }\n },\n OceansLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services']\n }\n },\n NationalGeographic: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services'],\n attribution: 'Esri'\n }\n },\n DarkGray: {\n urlTemplate: tileProtocol + '//tiles{s}.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Dark_Gray_Base_Beta/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 10,\n subdomains: ['1', '2'],\n attribution: 'Esri, DeLorme, HERE'\n }\n },\n DarkGrayLabels: {\n urlTemplate: tileProtocol + '//tiles{s}.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Dark_Gray_Reference_Beta/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 10,\n subdomains: ['1', '2']\n }\n },\n Gray: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services'],\n attribution: 'Esri, NAVTEQ, DeLorme'\n }\n },\n GrayLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services']\n }\n },\n Imagery: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services'],\n attribution: 'Esri, DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community'\n }\n },\n ImageryLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services']\n }\n },\n ImageryTransportation: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}',\n //pane: 'esri-label',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services']\n }\n },\n ShadedRelief: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 13,\n subdomains: ['server', 'services'],\n attribution: 'ESRI, NAVTEQ, DeLorme'\n }\n },\n ShadedReliefLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 12,\n subdomains: ['server', 'services']\n }\n },\n Terrain: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 13,\n subdomains: ['server', 'services'],\n attribution: 'Esri, USGS, NOAA'\n }\n },\n TerrainLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 13,\n subdomains: ['server', 'services']\n }\n }\n }\n },\n initialize: function(key, options){\n var config;\n\n // set the config variable with the appropriate config object\n if (typeof key === 'object' && key.urlTemplate && key.options){\n config = key;\n } else if(typeof key === 'string' && EsriLeaflet.BasemapLayer.TILES[key]){\n config = EsriLeaflet.BasemapLayer.TILES[key];\n } else {\n 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\"');\n }\n\n // merge passed options into the config options\n var tileOptions = L.Util.extend(config.options, options);\n\n // call the initialize method on L.TileLayer to set everything up\n L.TileLayer.prototype.initialize.call(this, config.urlTemplate, L.Util.setOptions(this, tileOptions));\n\n // if this basemap requires dynamic attribution set it up\n if(config.attributionUrl){\n this._getAttributionData(config.attributionUrl);\n }\n },\n onAdd: function(map){\n if(!this.options.hideLogo){\n this._logo = new EsriLeaflet.Controls.Logo({\n position: this.options.logoPosition\n }).addTo(map);\n }\n\n // if(this.options.pane && EsriLeaflet.Support.pointerEvents){\n // this._initPane();\n // }\n\n L.TileLayer.prototype.onAdd.call(this, map);\n\n map.on('moveend', this._updateMapAttribution, this);\n },\n onRemove: function(map){\n if(this._logo){\n map.removeControl(this._logo);\n }\n\n L.TileLayer.prototype.onRemove.call(this, map);\n\n map.off('moveend', this._updateMapAttribution, this);\n },\n getAttribution:function(){\n var attribution = '' + this.options.attribution + ''/* + logo*/;\n return attribution;\n },\n // _initPane: function(){\n // if(!this._map.getPane(this.options.pane)){\n // var pane = this._map.createPane(this.options.pane);\n // pane.style.pointerEvents = 'none';\n // pane.style.zIndex = 5;\n // }\n // },\n _getAttributionData: function(url){\n EsriLeaflet.get(url, {}, function(error, attributions){\n this._attributions = [];\n for (var c = 0; c < attributions.contributors.length; c++) {\n var contributor = attributions.contributors[c];\n for (var i = 0; i < contributor.coverageAreas.length; i++) {\n var coverageArea = contributor.coverageAreas[i];\n var southWest = new L.LatLng(coverageArea.bbox[0], coverageArea.bbox[1]);\n var northEast = new L.LatLng(coverageArea.bbox[2], coverageArea.bbox[3]);\n this._attributions.push({\n attribution: contributor.attribution,\n score: coverageArea.score,\n bounds: new L.LatLngBounds(southWest, northEast),\n minZoom: coverageArea.zoomMin,\n maxZoom: coverageArea.zoomMax\n });\n }\n }\n\n this._attributions.sort(function(a, b){\n return b.score - a.score;\n });\n\n this._updateMapAttribution();\n }, this);\n },\n _updateMapAttribution: function(){\n if(this._map && this._map.attributionControl && this._attributions){\n var newAttributions = '';\n var bounds = this._map.getBounds();\n var zoom = this._map.getZoom();\n\n for (var i = 0; i < this._attributions.length; i++) {\n var attribution = this._attributions[i];\n var text = attribution.attribution;\n if(!newAttributions.match(text) && bounds.intersects(attribution.bounds) && zoom >= attribution.minZoom && zoom <= attribution.maxZoom) {\n newAttributions += (', ' + text);\n }\n }\n newAttributions = newAttributions.substr(2);\n var attributionElement = this._map.attributionControl._container.querySelector('.esri-attributions');\n attributionElement.innerHTML = newAttributions;\n attributionElement.style.maxWidth = (this._map.getSize().x * 0.65) + 'px';\n this.fire('attributionupdated', {\n attribution: newAttributions\n });\n }\n }\n });\n\n EsriLeaflet.BasemapLayer = EsriLeaflet.Layers.BasemapLayer;\n\n EsriLeaflet.Layers.basemapLayer = function(key, options){\n return new EsriLeaflet.Layers.BasemapLayer(key, options);\n };\n\n EsriLeaflet.basemapLayer = function(key, options){\n return new EsriLeaflet.Layers.BasemapLayer(key, options);\n };\n\n})(EsriLeaflet);","EsriLeaflet.Controls.Logo = L.Control.extend({\n options: {\n position: 'bottomright',\n marginTop: 0,\n marginLeft: 0,\n marginBottom: 0,\n marginRight: 0\n },\n onAdd: function () {\n var div = L.DomUtil.create('div', 'esri-leaflet-logo');\n div.style.marginTop = this.options.marginTop;\n div.style.marginLeft = this.options.marginLeft;\n div.style.marginBottom = this.options.marginBottom;\n div.style.marginRight = this.options.marginRight;\n div.innerHTML = '';\n return div;\n }\n});\n\nEsriLeaflet.Controls.logo = function(options){\n return new L.esri.Controls.Logo(options);\n};\n"]} \ No newline at end of file diff --git a/dist/builds/basemaps/esri-leaflet-basemaps.js b/dist/builds/basemaps/esri-leaflet-basemaps.js new file mode 100644 index 000000000..03358b642 --- /dev/null +++ b/dist/builds/basemaps/esri-leaflet-basemaps.js @@ -0,0 +1,24 @@ +/*! esri-leaflet - v1.0.0-rc.3 - 2014-11-04 +* Copyright (c) 2014 Environmental Systems Research Institute, Inc. +* Apache License*/ +(function (factory) { + //define an AMD module that relies on 'leaflet' + if (typeof define === 'function' && define.amd) { + define(['leaflet'], function (L) { + return factory(L); + }); + //define a common js module that relies on 'leaflet' + } else if (typeof module === 'object' && typeof module.exports === 'object') { + module.exports = factory(require('leaflet')); + } + + if(typeof window !== 'undefined' && window.L){ + factory(window.L); + } +}(function (L) { + +var EsriLeaflet={VERSION:"1.0.0-rc.2",Layers:{},Services:{},Controls:{},Tasks:{},Util:{},Support:{CORS:!!(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),pointerEvents:""===document.documentElement.style.pointerEvents}};"undefined"!=typeof window&&window.L&&(window.L.esri=EsriLeaflet),function(a){function b(a){var b="";a.f="json";for(var c in a)if(a.hasOwnProperty(c)){var d,e=a[c],f=Object.prototype.toString.call(e);b.length&&(b+="&"),d="[object Array]"===f||"[object Object]"===f?JSON.stringify(e):"[object Date]"===f?e.valueOf():e,b+=encodeURIComponent(c)+"="+encodeURIComponent(d)}return b}function c(a,b){var c=new XMLHttpRequest;return c.onerror=function(){a.call(b,{error:{code:500,message:"XMLHttpRequest error"}},null)},c.onreadystatechange=function(){var d,e;if(4===c.readyState){try{d=JSON.parse(c.responseText)}catch(f){d=null,e={code:500,message:"Could not parse response as JSON."}}!e&&d.error&&(e=d.error,d=null),a.call(b,e,d)}},c}var d=0;window._EsriLeafletCallbacks={},a.Request={request:function(a,d,e,f){var g=b(d),h=c(e,f),i=(a+"?"+g).length;if(2e3>=i&&L.esri.Support.CORS)h.open("GET",a+"?"+g),h.send(null);else if(i>2e3&&L.esri.Support.CORS)h.open("POST",a),h.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),h.send(g);else{if(2e3>=i&&!L.esri.Support.CORS)return L.esri.Request.get.JSONP(a,d,e,f);if(console&&console.warn)return void console.warn("a request to "+a+" 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")}return h},post:{XMLHTTP:function(a,d,e,f){var g=c(e,f);return g.open("POST",a),g.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),g.send(b(d)),g}},get:{CORS:function(a,d,e,f){var g=c(e,f);return g.open("GET",a+"?"+b(d),!0),g.send(null),g},JSONP:function(a,c,e,f){var g="c"+d;c.callback="window._EsriLeafletCallbacks."+g;var h=L.DomUtil.create("script",null,document.body);return h.type="text/javascript",h.src=a+"?"+b(c),h.id=g,window._EsriLeafletCallbacks[g]=function(a){if(window._EsriLeafletCallbacks[g]!==!0){var b,c=Object.prototype.toString.call(a);"[object Object]"!==c&&"[object Array]"!==c&&(b={error:{code:500,message:"Expected array or object as JSONP response"}},a=null),!b&&a.error&&(b=a,a=null),e.call(f,b,a),window._EsriLeafletCallbacks[g]=!0}},d++,{id:g,url:h.src,abort:function(){window._EsriLeafletCallbacks._callback[g]({code:0,message:"Request aborted."})}}}}},a.get=a.Support.CORS?a.Request.get.CORS:a.Request.get.JSONP,a.post=a.Request.post.XMLHTTP,a.request=a.Request.request}(EsriLeaflet),function(a){var b="https:"!==window.location.protocol?"http:":"https:";a.Layers.BasemapLayer=L.TileLayer.extend({statics:{TILES:{Streets:{urlTemplate:b+"//{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:b+"//{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:b+"//{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:b+"//{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"]}},NationalGeographic:{urlTemplate:b+"//{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:"Esri"}},DarkGray:{urlTemplate:b+"//tiles{s}.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Dark_Gray_Base_Beta/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:10,subdomains:["1","2"],attribution:"Esri, DeLorme, HERE"}},DarkGrayLabels:{urlTemplate:b+"//tiles{s}.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Dark_Gray_Reference_Beta/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:10,subdomains:["1","2"]}},Gray:{urlTemplate:b+"//{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, NAVTEQ, DeLorme"}},GrayLabels:{urlTemplate:b+"//{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"]}},Imagery:{urlTemplate:b+"//{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:b+"//{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"]}},ImageryTransportation:{urlTemplate:b+"//{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"]}},ShadedRelief:{urlTemplate:b+"//{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, NAVTEQ, DeLorme"}},ShadedReliefLabels:{urlTemplate:b+"//{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"]}},Terrain:{urlTemplate:b+"//{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:b+"//{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"]}}}},initialize:function(b,c){var d;if("object"==typeof b&&b.urlTemplate&&b.options)d=b;else{if("string"!=typeof b||!a.BasemapLayer.TILES[b])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"');d=a.BasemapLayer.TILES[b]}var e=L.Util.extend(d.options,c);L.TileLayer.prototype.initialize.call(this,d.urlTemplate,L.Util.setOptions(this,e)),d.attributionUrl&&this._getAttributionData(d.attributionUrl)},onAdd:function(b){this.options.hideLogo||(this._logo=new a.Controls.Logo({position:this.options.logoPosition}).addTo(b)),L.TileLayer.prototype.onAdd.call(this,b),b.on("moveend",this._updateMapAttribution,this)},onRemove:function(a){this._logo&&a.removeControl(this._logo),L.TileLayer.prototype.onRemove.call(this,a),a.off("moveend",this._updateMapAttribution,this)},getAttribution:function(){var a=''+this.options.attribution+"";return a},_getAttributionData:function(b){a.get(b,{},function(a,b){this._attributions=[];for(var c=0;c=e.minZoom&&c<=e.maxZoom&&(a+=", "+f)}a=a.substr(2);var g=this._map.attributionControl._container.querySelector(".esri-attributions");g.innerHTML=a,g.style.maxWidth=.65*this._map.getSize().x+"px",this.fire("attributionupdated",{attribution:a})}}}),a.BasemapLayer=a.Layers.BasemapLayer,a.Layers.basemapLayer=function(b,c){return new a.Layers.BasemapLayer(b,c)},a.basemapLayer=function(b,c){return new a.Layers.BasemapLayer(b,c)}}(EsriLeaflet),EsriLeaflet.Controls.Logo=L.Control.extend({options:{position:"bottomright",marginTop:0,marginLeft:0,marginBottom:0,marginRight:0},onAdd:function(){var a=L.DomUtil.create("div","esri-leaflet-logo");return a.style.marginTop=this.options.marginTop,a.style.marginLeft=this.options.marginLeft,a.style.marginBottom=this.options.marginBottom,a.style.marginRight=this.options.marginRight,a.innerHTML='',a}}),EsriLeaflet.Controls.logo=function(a){return new L.esri.Controls.Logo(a)}; +//# sourceMappingURL=esri-leaflet-basemaps.js.map + + return EsriLeaflet; +})); \ No newline at end of file diff --git a/dist/builds/basemaps/esri-leaflet-basemaps.js.map b/dist/builds/basemaps/esri-leaflet-basemaps.js.map new file mode 100644 index 000000000..01d28be0a --- /dev/null +++ b/dist/builds/basemaps/esri-leaflet-basemaps.js.map @@ -0,0 +1 @@ +{"version":3,"file":"esri-leaflet-basemaps.js","sources":["../../../src/EsriLeaflet.js","../../../src/Request.js","../../../src/Layers/BasemapLayer.js","../../../src/Controls/Logo.js"],"names":["EsriLeaflet","VERSION","Layers","Services","Controls","Tasks","Util","Support","CORS","window","XMLHttpRequest","pointerEvents","document","documentElement","style","L","esri","serialize","params","data","f","key","hasOwnProperty","value","param","type","Object","prototype","toString","call","length","JSON","stringify","valueOf","encodeURIComponent","createRequest","callback","context","httpRequest","onerror","error","code","message","onreadystatechange","response","readyState","parse","responseText","e","callbacks","_EsriLeafletCallbacks","Request","request","url","paramString","requestLength","open","send","setRequestHeader","get","JSONP","console","warn","post","XMLHTTP","callbackId","script","DomUtil","create","body","src","id","responseType","abort","_callback","tileProtocol","location","protocol","BasemapLayer","TileLayer","extend","statics","TILES","Streets","urlTemplate","attributionUrl","options","hideLogo","logoPosition","minZoom","maxZoom","subdomains","attribution","Topographic","Oceans","OceansLabels","NationalGeographic","DarkGray","DarkGrayLabels","Gray","GrayLabels","Imagery","ImageryLabels","ImageryTransportation","ShadedRelief","ShadedReliefLabels","Terrain","TerrainLabels","initialize","config","Error","tileOptions","this","setOptions","_getAttributionData","onAdd","map","_logo","Logo","position","addTo","on","_updateMapAttribution","onRemove","removeControl","off","getAttribution","attributions","_attributions","c","contributors","contributor","i","coverageAreas","coverageArea","southWest","LatLng","bbox","northEast","push","score","bounds","LatLngBounds","zoomMin","zoomMax","sort","a","b","_map","attributionControl","newAttributions","getBounds","zoom","getZoom","text","match","intersects","substr","attributionElement","_container","querySelector","innerHTML","maxWidth","getSize","x","fire","basemapLayer","Control","marginTop","marginLeft","marginBottom","marginRight","div","logo"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,GAAIA,cACFC,QAAS,aACTC,UACAC,YACAC,YACAC,SACAC,QACAC,SACEC,QAASC,OAAOC,gBAAkB,mBAAqB,IAAIA,iBAC3DC,cAAgE,KAAjDC,SAASC,gBAAgBC,MAAMH,eAI7B,oBAAXF,SAA0BA,OAAOM,IACzCN,OAAOM,EAAEC,KAAOhB,aCdlB,SAAUA,GAMR,QAASiB,GAAUC,GACjB,GAAIC,GAAO,EAEXD,GAAOE,EAAI,MAEX,KAAK,GAAIC,KAAOH,GACd,GAAGA,EAAOI,eAAeD,GAAK,CAC5B,GAEIE,GAFAC,EAAQN,EAAOG,GACfI,EAAOC,OAAOC,UAAUC,SAASC,KAAKL,EAGvCL,GAAKW,SACNX,GAAQ,KAIRI,EADU,mBAATE,GAAsC,oBAATA,EACtBM,KAAKC,UAAUR,GACL,kBAATC,EACDD,EAAMS,UAENT,EAGVL,GAAQe,mBAAmBb,GAAO,IAAMa,mBAAmBX,GAI/D,MAAOJ,GAGT,QAASgB,GAAcC,EAAUC,GAC/B,GAAIC,GAAc,GAAI5B,eAmCtB,OAjCA4B,GAAYC,QAAU,WACpBH,EAASP,KAAKQ,GACZG,OACEC,KAAM,IACNC,QAAS,yBAEV,OAGLJ,EAAYK,mBAAqB,WAC/B,GAAIC,GACAJ,CAEJ,IAA+B,IAA3BF,EAAYO,WAAkB,CAChC,IACED,EAAWb,KAAKe,MAAMR,EAAYS,cAClC,MAAMC,GACNJ,EAAW,KACXJ,GACEC,KAAM,IACNC,QAAS,sCAIRF,GAASI,EAASJ,QACrBA,EAAQI,EAASJ,MACjBI,EAAW,MAGbR,EAASP,KAAKQ,EAASG,EAAOI,KAI3BN,EAtET,GAAIW,GAAY,CAEhBxC,QAAOyC,yBAwEPlD,EAAYmD,SACVC,QAAS,SAASC,EAAKnC,EAAQkB,EA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EpD,KAAKqD,KAAK,sBACRzE,YAAa0D,QAMrBtJ,EAAY8E,aAAe9E,EAAYE,OAAO4E,aAE9C9E,EAAYE,OAAOoK,aAAe,SAASjJ,EAAKiE,GAC9C,MAAO,IAAItF,GAAYE,OAAO4E,aAAazD,EAAKiE,IAGlDtF,EAAYsK,aAAe,SAASjJ,EAAKiE,GACvC,MAAO,IAAItF,GAAYE,OAAO4E,aAAazD,EAAKiE,KAGjDtF,aClTHA,YAAYI,SAASkH,KAAOvG,EAAEwJ,QAAQvF,QACpCM,SACEiC,SAAU,cACViD,UAAW,EACXC,WAAY,EACZC,aAAc,EACdC,YAAa,GAEfxD,MAAO,WACL,GAAIyD,GAAM7J,EAAEoD,QAAQC,OAAO,MAAO,oBAMlC,OALAwG,GAAI9J,MAAM0J,UAAYxD,KAAK1B,QAAQkF,UACnCI,EAAI9J,MAAM2J,WAAazD,KAAK1B,QAAQmF,WACpCG,EAAI9J,MAAM4J,aAAe1D,KAAK1B,QAAQoF,aACtCE,EAAI9J,MAAM6J,YAAc3D,KAAK1B,QAAQqF,YACrCC,EAAIX,UAAY,iKACTW,KAIX5K,YAAYI,SAASyK,KAAO,SAASvF,GACnC,MAAO,IAAIvE,GAAEC,KAAKZ,SAASkH,KAAKhC","sourcesContent":["var EsriLeaflet = { //jshint ignore:line\n VERSION: '1.0.0-rc.2',\n Layers: {},\n Services: {},\n Controls: {},\n Tasks: {},\n Util: {},\n Support: {\n CORS: !!(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()),\n pointerEvents: document.documentElement.style.pointerEvents === ''\n }\n};\n\nif(typeof window !== 'undefined' && window.L){\n window.L.esri = EsriLeaflet;\n}","(function(EsriLeaflet){\n\n var callbacks = 0;\n\n window._EsriLeafletCallbacks = {};\n\n function serialize(params){\n var data = '';\n\n params.f = 'json';\n\n for (var key in params){\n if(params.hasOwnProperty(key)){\n var param = params[key];\n var type = Object.prototype.toString.call(param);\n var value;\n\n if(data.length){\n data += '&';\n }\n\n if(type === '[object Array]' || type === '[object Object]'){\n value = JSON.stringify(param);\n } else if (type === '[object Date]'){\n value = param.valueOf();\n } else {\n value = param;\n }\n\n data += encodeURIComponent(key) + '=' + encodeURIComponent(value);\n }\n }\n\n return data;\n }\n\n function createRequest(callback, context){\n var httpRequest = new XMLHttpRequest();\n\n httpRequest.onerror = function(e) {\n callback.call(context, {\n error: {\n code: 500,\n message: 'XMLHttpRequest error'\n }\n }, null);\n };\n\n httpRequest.onreadystatechange = function(){\n var response;\n var error;\n\n if (httpRequest.readyState === 4) {\n try {\n response = JSON.parse(httpRequest.responseText);\n } catch(e) {\n response = null;\n error = {\n code: 500,\n message: 'Could not parse response as JSON.'\n };\n }\n\n if (!error && response.error) {\n error = response.error;\n response = null;\n }\n\n callback.call(context, error, response);\n }\n };\n\n return httpRequest;\n }\n\n // AJAX handlers for CORS (modern browsers) or JSONP (older browsers)\n EsriLeaflet.Request = {\n request: function(url, params, callback, context){\n var paramString = serialize(params);\n var httpRequest = createRequest(callback, context);\n var requestLength = (url + '?' + paramString).length;\n\n // request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest\n if(requestLength <= 2000 && L.esri.Support.CORS){\n httpRequest.open('GET', url + '?' + paramString);\n httpRequest.send(null);\n\n // request is less more then 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest\n } else if (requestLength > 2000 && L.esri.Support.CORS){\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(paramString);\n\n // request is less more then 2000 characters and the browser does not support CORS, make a JSONP request\n } else if(requestLength <= 2000 && !L.esri.Support.CORS){\n return L.esri.Request.get.JSONP(url, params, callback, context);\n\n // request is longer then 2000 characters and the browser does not support CORS, log a warning\n } else {\n if(console && console.warn){\n console.warn('a request to ' + url + ' 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');\n return;\n }\n }\n\n return httpRequest;\n },\n post: {\n XMLHTTP: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(serialize(params));\n\n return httpRequest;\n }\n },\n\n get: {\n CORS: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n\n httpRequest.open('GET', url + '?' + serialize(params), true);\n httpRequest.send(null);\n\n return httpRequest;\n },\n JSONP: function(url, params, callback, context){\n var callbackId = 'c' + callbacks;\n\n params.callback = 'window._EsriLeafletCallbacks.' + callbackId;\n\n var script = L.DomUtil.create('script', null, document.body);\n script.type = 'text/javascript';\n script.src = url + '?' + serialize(params);\n script.id = callbackId;\n\n window._EsriLeafletCallbacks[callbackId] = function(response){\n if(window._EsriLeafletCallbacks[callbackId] !== true){\n var error;\n var responseType = Object.prototype.toString.call(response);\n\n if(!(responseType === '[object Object]' || responseType === '[object Array]')){\n error = {\n error: {\n code: 500,\n message: 'Expected array or object as JSONP response'\n }\n };\n response = null;\n }\n\n if (!error && response.error) {\n error = response;\n response = null;\n }\n\n callback.call(context, error, response);\n window._EsriLeafletCallbacks[callbackId] = true;\n }\n };\n\n callbacks++;\n\n return {\n id: callbackId,\n url: script.src,\n abort: function(){\n window._EsriLeafletCallbacks._callback[callbackId]({\n code: 0,\n message: 'Request aborted.'\n });\n }\n };\n }\n }\n };\n\n // Choose the correct AJAX handler depending on CORS support\n EsriLeaflet.get = (EsriLeaflet.Support.CORS) ? EsriLeaflet.Request.get.CORS : EsriLeaflet.Request.get.JSONP;\n\n // Always use XMLHttpRequest for posts\n EsriLeaflet.post = EsriLeaflet.Request.post.XMLHTTP;\n\n // expose a common request method the uses GET\\POST based on request length\n EsriLeaflet.request = EsriLeaflet.Request.request;\n\n})(EsriLeaflet);","(function(EsriLeaflet){\n\n var tileProtocol = (window.location.protocol !== 'https:') ? 'http:' : 'https:';\n\n EsriLeaflet.Layers.BasemapLayer = L.TileLayer.extend({\n statics: {\n TILES: {\n Streets: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}',\n attributionUrl: 'https://static.arcgis.com/attribution/World_Street_Map',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services'],\n attribution: 'Esri'\n }\n },\n Topographic: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}',\n attributionUrl: 'https://static.arcgis.com/attribution/World_Topo_Map',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services'],\n attribution: 'Esri'\n }\n },\n Oceans: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}',\n attributionUrl: 'https://static.arcgis.com/attribution/Ocean_Basemap',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services'],\n attribution: 'Esri'\n }\n },\n OceansLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services']\n }\n },\n NationalGeographic: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services'],\n attribution: 'Esri'\n }\n },\n DarkGray: {\n urlTemplate: tileProtocol + '//tiles{s}.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Dark_Gray_Base_Beta/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 10,\n subdomains: ['1', '2'],\n attribution: 'Esri, DeLorme, HERE'\n }\n },\n DarkGrayLabels: {\n urlTemplate: tileProtocol + '//tiles{s}.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Dark_Gray_Reference_Beta/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 10,\n subdomains: ['1', '2']\n }\n },\n Gray: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services'],\n attribution: 'Esri, NAVTEQ, DeLorme'\n }\n },\n GrayLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services']\n }\n },\n Imagery: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services'],\n attribution: 'Esri, DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community'\n }\n },\n ImageryLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services']\n }\n },\n ImageryTransportation: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}',\n //pane: 'esri-label',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services']\n }\n },\n ShadedRelief: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 13,\n subdomains: ['server', 'services'],\n attribution: 'ESRI, NAVTEQ, DeLorme'\n }\n },\n ShadedReliefLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 12,\n subdomains: ['server', 'services']\n }\n },\n Terrain: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 13,\n subdomains: ['server', 'services'],\n attribution: 'Esri, USGS, NOAA'\n }\n },\n TerrainLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 13,\n subdomains: ['server', 'services']\n }\n }\n }\n },\n initialize: function(key, options){\n var config;\n\n // set the config variable with the appropriate config object\n if (typeof key === 'object' && key.urlTemplate && key.options){\n config = key;\n } else if(typeof key === 'string' && EsriLeaflet.BasemapLayer.TILES[key]){\n config = EsriLeaflet.BasemapLayer.TILES[key];\n } else {\n 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\"');\n }\n\n // merge passed options into the config options\n var tileOptions = L.Util.extend(config.options, options);\n\n // call the initialize method on L.TileLayer to set everything up\n L.TileLayer.prototype.initialize.call(this, config.urlTemplate, L.Util.setOptions(this, tileOptions));\n\n // if this basemap requires dynamic attribution set it up\n if(config.attributionUrl){\n this._getAttributionData(config.attributionUrl);\n }\n },\n onAdd: function(map){\n if(!this.options.hideLogo){\n this._logo = new EsriLeaflet.Controls.Logo({\n position: this.options.logoPosition\n }).addTo(map);\n }\n\n // if(this.options.pane && EsriLeaflet.Support.pointerEvents){\n // this._initPane();\n // }\n\n L.TileLayer.prototype.onAdd.call(this, map);\n\n map.on('moveend', this._updateMapAttribution, this);\n },\n onRemove: function(map){\n if(this._logo){\n map.removeControl(this._logo);\n }\n\n L.TileLayer.prototype.onRemove.call(this, map);\n\n map.off('moveend', this._updateMapAttribution, this);\n },\n getAttribution:function(){\n var attribution = '' + this.options.attribution + ''/* + logo*/;\n return attribution;\n },\n // _initPane: function(){\n // if(!this._map.getPane(this.options.pane)){\n // var pane = this._map.createPane(this.options.pane);\n // pane.style.pointerEvents = 'none';\n // pane.style.zIndex = 5;\n // }\n // },\n _getAttributionData: function(url){\n EsriLeaflet.get(url, {}, function(error, attributions){\n this._attributions = [];\n for (var c = 0; c < attributions.contributors.length; c++) {\n var contributor = attributions.contributors[c];\n for (var i = 0; i < contributor.coverageAreas.length; i++) {\n var coverageArea = contributor.coverageAreas[i];\n var southWest = new L.LatLng(coverageArea.bbox[0], coverageArea.bbox[1]);\n var northEast = new L.LatLng(coverageArea.bbox[2], coverageArea.bbox[3]);\n this._attributions.push({\n attribution: contributor.attribution,\n score: coverageArea.score,\n bounds: new L.LatLngBounds(southWest, northEast),\n minZoom: coverageArea.zoomMin,\n maxZoom: coverageArea.zoomMax\n });\n }\n }\n\n this._attributions.sort(function(a, b){\n return b.score - a.score;\n });\n\n this._updateMapAttribution();\n }, this);\n },\n _updateMapAttribution: function(){\n if(this._map && this._map.attributionControl && this._attributions){\n var newAttributions = '';\n var bounds = this._map.getBounds();\n var zoom = this._map.getZoom();\n\n for (var i = 0; i < this._attributions.length; i++) {\n var attribution = this._attributions[i];\n var text = attribution.attribution;\n if(!newAttributions.match(text) && bounds.intersects(attribution.bounds) && zoom >= attribution.minZoom && zoom <= attribution.maxZoom) {\n newAttributions += (', ' + text);\n }\n }\n newAttributions = newAttributions.substr(2);\n var attributionElement = this._map.attributionControl._container.querySelector('.esri-attributions');\n attributionElement.innerHTML = newAttributions;\n attributionElement.style.maxWidth = (this._map.getSize().x * 0.65) + 'px';\n this.fire('attributionupdated', {\n attribution: newAttributions\n });\n }\n }\n });\n\n EsriLeaflet.BasemapLayer = EsriLeaflet.Layers.BasemapLayer;\n\n EsriLeaflet.Layers.basemapLayer = function(key, options){\n return new EsriLeaflet.Layers.BasemapLayer(key, options);\n };\n\n EsriLeaflet.basemapLayer = function(key, options){\n return new EsriLeaflet.Layers.BasemapLayer(key, options);\n };\n\n})(EsriLeaflet);","EsriLeaflet.Controls.Logo = L.Control.extend({\n options: {\n position: 'bottomright',\n marginTop: 0,\n marginLeft: 0,\n marginBottom: 0,\n marginRight: 0\n },\n onAdd: function () {\n var div = L.DomUtil.create('div', 'esri-leaflet-logo');\n div.style.marginTop = this.options.marginTop;\n div.style.marginLeft = this.options.marginLeft;\n div.style.marginBottom = this.options.marginBottom;\n div.style.marginRight = this.options.marginRight;\n div.innerHTML = '';\n return div;\n }\n});\n\nEsriLeaflet.Controls.logo = function(options){\n return new L.esri.Controls.Logo(options);\n};\n"]} \ No newline at end of file diff --git a/dist/builds/core/esri-leaflet-core-src.js b/dist/builds/core/esri-leaflet-core-src.js new file mode 100644 index 000000000..dc23f31f5 --- /dev/null +++ b/dist/builds/core/esri-leaflet-core-src.js @@ -0,0 +1,851 @@ +/*! esri-leaflet - v1.0.0-rc.3 - 2014-11-04 +* Copyright (c) 2014 Environmental Systems Research Institute, Inc. +* Apache License*/ +(function (factory) { + //define an AMD module that relies on 'leaflet' + if (typeof define === 'function' && define.amd) { + define(['leaflet'], function (L) { + return factory(L); + }); + //define a common js module that relies on 'leaflet' + } else if (typeof module === 'object' && typeof module.exports === 'object') { + module.exports = factory(require('leaflet')); + } + + if(typeof window !== 'undefined' && window.L){ + factory(window.L); + } +}(function (L) { +var EsriLeaflet = { //jshint ignore:line + VERSION: '1.0.0-rc.2', + Layers: {}, + Services: {}, + Controls: {}, + Tasks: {}, + Util: {}, + Support: { + CORS: !!(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()), + pointerEvents: document.documentElement.style.pointerEvents === '' + } +}; + +if(typeof window !== 'undefined' && window.L){ + window.L.esri = EsriLeaflet; +} + +(function(EsriLeaflet){ + + // shallow object clone for feature properties and attributes + // from http://jsperf.com/cloning-an-object/2 + function clone(obj) { + var target = {}; + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + target[i] = obj[i]; + } + } + return target; + } + + // checks if 2 x,y points are equal + function pointsEqual(a, b) { + for (var i = 0; i < a.length; i++) { + if (a[i] !== b[i]) { + return false; + } + } + return true; + } + + // checks if the first and last points of a ring are equal and closes the ring + function closeRing(coordinates) { + if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) { + coordinates.push(coordinates[0]); + } + return coordinates; + } + + // determine if polygon ring coordinates are clockwise. clockwise signifies outer ring, counter-clockwise an inner ring + // or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon- + // points-are-in-clockwise-order + function ringIsClockwise(ringToTest) { + var total = 0,i = 0; + var rLength = ringToTest.length; + var pt1 = ringToTest[i]; + var pt2; + for (i; i < rLength - 1; i++) { + pt2 = ringToTest[i + 1]; + total += (pt2[0] - pt1[0]) * (pt2[1] + pt1[1]); + pt1 = pt2; + } + return (total >= 0); + } + + // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L504-L519 + function vertexIntersectsVertex(a1, a2, b1, b2) { + var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]); + var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]); + var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]); + + if ( uB !== 0 ) { + var ua = uaT / uB; + var ub = ubT / uB; + + if ( 0 <= ua && ua <= 1 && 0 <= ub && ub <= 1 ) { + return true; + } + } + + return false; + } + + // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L521-L531 + function arrayIntersectsArray(a, b) { + for (var i = 0; i < a.length - 1; i++) { + for (var j = 0; j < b.length - 1; j++) { + if (vertexIntersectsVertex(a[i], a[i + 1], b[j], b[j + 1])) { + return true; + } + } + } + + return false; + } + + // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L470-L480 + function coordinatesContainPoint(coordinates, point) { + var contains = false; + for(var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) { + if (((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1]) || + (coordinates[j][1] <= point[1] && point[1] < coordinates[i][1])) && + (point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0])) { + contains = !contains; + } + } + return contains; + } + + // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L106-L113 + function coordinatesContainCoordinates(outer, inner){ + var intersects = arrayIntersectsArray(outer, inner); + var contains = coordinatesContainPoint(outer, inner[0]); + if(!intersects && contains){ + return true; + } + return false; + } + + // do any polygons in this array contain any other polygons in this array? + // used for checking for holes in arcgis rings + // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L117-L172 + function convertRingsToGeoJSON(rings){ + var outerRings = []; + var holes = []; + var x; // iterator + var outerRing; // current outer ring being evaluated + var hole; // current hole being evaluated + + // for each ring + for (var r = 0; r < rings.length; r++) { + var ring = closeRing(rings[r].slice(0)); + if(ring.length < 4){ + continue; + } + // is this ring an outer ring? is it clockwise? + if(ringIsClockwise(ring)){ + var polygon = [ ring ]; + outerRings.push(polygon); // push to outer rings + } else { + holes.push(ring); // counterclockwise push to holes + } + } + + var uncontainedHoles = []; + + // while there are holes left... + while(holes.length){ + // pop a hole off out stack + hole = holes.pop(); + + // loop over all outer rings and see if they contain our hole. + var contained = false; + for (x = outerRings.length - 1; x >= 0; x--) { + outerRing = outerRings[x][0]; + if(coordinatesContainCoordinates(outerRing, hole)){ + // the hole is contained push it into our polygon + outerRings[x].push(hole); + contained = true; + break; + } + } + + // ring is not contained in any outer ring + // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320 + if(!contained){ + uncontainedHoles.push(hole); + } + } + + // if we couldn't match any holes using contains we can try intersects... + while(uncontainedHoles.length){ + // pop a hole off out stack + hole = uncontainedHoles.pop(); + + // loop over all outer rings and see if any intersect our hole. + var intersects = false; + for (x = outerRings.length - 1; x >= 0; x--) { + outerRing = outerRings[x][0]; + if(arrayIntersectsArray(outerRing, hole)){ + // the hole is contained push it into our polygon + outerRings[x].push(hole); + intersects = true; + break; + } + } + + if(!intersects) { + outerRings.push([hole.reverse()]); + } + } + + if(outerRings.length === 1){ + return { + type: 'Polygon', + coordinates: outerRings[0] + }; + } else { + return { + type: 'MultiPolygon', + coordinates: outerRings + }; + } + } + + // This function ensures that rings are oriented in the right directions + // outer rings are clockwise, holes are counterclockwise + // used for converting GeoJSON Polygons to ArcGIS Polygons + function orientRings(poly){ + var output = []; + var polygon = poly.slice(0); + var outerRing = closeRing(polygon.shift().slice(0)); + if(outerRing.length >= 4){ + if(!ringIsClockwise(outerRing)){ + outerRing.reverse(); + } + + output.push(outerRing); + + for (var i = 0; i < polygon.length; i++) { + var hole = closeRing(polygon[i].slice(0)); + if(hole.length >= 4){ + if(ringIsClockwise(hole)){ + hole.reverse(); + } + output.push(hole); + } + } + } + + return output; + } + + // This function flattens holes in multipolygons to one array of polygons + // used for converting GeoJSON Polygons to ArcGIS Polygons + function flattenMultiPolygonRings(rings){ + var output = []; + for (var i = 0; i < rings.length; i++) { + var polygon = orientRings(rings[i]); + for (var x = polygon.length - 1; x >= 0; x--) { + var ring = polygon[x].slice(0); + output.push(ring); + } + } + return output; + } + + // convert an extent (ArcGIS) to LatLngBounds (Leaflet) + EsriLeaflet.Util.extentToBounds = function(extent){ + var sw = new L.LatLng(extent.ymin, extent.xmin); + var ne = new L.LatLng(extent.ymax, extent.xmax); + return new L.LatLngBounds(sw, ne); + }; + + // convert an LatLngBounds (Leaflet) to extent (ArcGIS) + EsriLeaflet.Util.boundsToExtent = function(bounds) { + bounds = L.latLngBounds(bounds); + return { + 'xmin': bounds.getSouthWest().lng, + 'ymin': bounds.getSouthWest().lat, + 'xmax': bounds.getNorthEast().lng, + 'ymax': bounds.getNorthEast().lat, + 'spatialReference': { + 'wkid' : 4326 + } + }; + }; + + EsriLeaflet.Util.arcgisToGeojson = function (arcgis, idAttribute){ + var geojson = {}; + + if(typeof arcgis.x === 'number' && typeof arcgis.y === 'number'){ + geojson.type = 'Point'; + geojson.coordinates = [arcgis.x, arcgis.y]; + } + + if(arcgis.points){ + geojson.type = 'MultiPoint'; + geojson.coordinates = arcgis.points.slice(0); + } + + if(arcgis.paths) { + if(arcgis.paths.length === 1){ + geojson.type = 'LineString'; + geojson.coordinates = arcgis.paths[0].slice(0); + } else { + geojson.type = 'MultiLineString'; + geojson.coordinates = arcgis.paths.slice(0); + } + } + + if(arcgis.rings) { + geojson = convertRingsToGeoJSON(arcgis.rings.slice(0)); + } + + if(arcgis.geometry || arcgis.attributes) { + geojson.type = 'Feature'; + geojson.geometry = (arcgis.geometry) ? EsriLeaflet.Util.arcgisToGeojson(arcgis.geometry) : null; + geojson.properties = (arcgis.attributes) ? clone(arcgis.attributes) : null; + if(arcgis.attributes) { + geojson.id = arcgis.attributes[idAttribute] || arcgis.attributes.OBJECTID || arcgis.attributes.FID; + } + } + + return geojson; + }; + + // GeoJSON -> ArcGIS + EsriLeaflet.Util.geojsonToArcGIS = function(geojson, idAttribute){ + idAttribute = idAttribute || 'OBJECTID'; + var spatialReference = { wkid: 4326 }; + var result = {}; + var i; + + switch(geojson.type){ + case 'Point': + result.x = geojson.coordinates[0]; + result.y = geojson.coordinates[1]; + result.spatialReference = spatialReference; + break; + case 'MultiPoint': + result.points = geojson.coordinates.slice(0); + result.spatialReference = spatialReference; + break; + case 'LineString': + result.paths = [geojson.coordinates.slice(0)]; + result.spatialReference = spatialReference; + break; + case 'MultiLineString': + result.paths = geojson.coordinates.slice(0); + result.spatialReference = spatialReference; + break; + case 'Polygon': + result.rings = orientRings(geojson.coordinates.slice(0)); + result.spatialReference = spatialReference; + break; + case 'MultiPolygon': + result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0)); + result.spatialReference = spatialReference; + break; + case 'Feature': + if(geojson.geometry) { + result.geometry = EsriLeaflet.Util.geojsonToArcGIS(geojson.geometry, idAttribute); + } + result.attributes = (geojson.properties) ? clone(geojson.properties) : {}; + if(geojson.id){ + result.attributes[idAttribute] = geojson.id; + } + break; + case 'FeatureCollection': + result = []; + for (i = 0; i < geojson.features.length; i++){ + result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.features[i], idAttribute)); + } + break; + case 'GeometryCollection': + result = []; + for (i = 0; i < geojson.geometries.length; i++){ + result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.geometries[i], idAttribute)); + } + break; + } + + return result; + }; + + EsriLeaflet.Util.responseToFeatureCollection = function(response, idAttribute){ + var objectIdField; + + if(idAttribute){ + objectIdField = idAttribute; + } else if(response.objectIdFieldName){ + objectIdField = response.objectIdFieldName; + } else if(response.fields) { + for (var j = 0; j <= response.fields.length - 1; j++) { + if(response.fields[j].type === 'esriFieldTypeOID') { + objectIdField = response.fields[j].name; + break; + } + } + } else { + objectIdField = 'OBJECTID'; + } + + var featureCollection = { + type: 'FeatureCollection', + features: [] + }; + var features = response.features || response.results; + if(features.length){ + for (var i = features.length - 1; i >= 0; i--) { + featureCollection.features.push(EsriLeaflet.Util.arcgisToGeojson(features[i], objectIdField)); + } + } + + return featureCollection; + }; + + // trim whitespace and add a tailing slash is needed to a url + EsriLeaflet.Util.cleanUrl = function(url){ + url = url.replace(/\s\s*/g, ''); + + //add a trailing slash to the url if the user omitted it + if(url[url.length-1] !== '/'){ + url += '/'; + } + + return url; + }; + + EsriLeaflet.Util.geojsonTypeToArcGIS = function (geoJsonType) { + var arcgisGeometryType; + switch (geoJsonType) { + case 'Point': + arcgisGeometryType = 'esriGeometryPoint'; + break; + case 'MultiPoint': + arcgisGeometryType = 'esriGeometryMultipoint'; + break; + case 'LineString': + arcgisGeometryType = 'esriGeometryPolyline'; + break; + case 'MultiLineString': + arcgisGeometryType = 'esriGeometryPolyline'; + break; + case 'Polygon': + arcgisGeometryType = 'esriGeometryPolygon'; + break; + case 'MultiPolygon': + arcgisGeometryType = 'esriGeometryPolygon'; + break; + } + return arcgisGeometryType; + }; + +})(EsriLeaflet); + +(function(EsriLeaflet){ + + var callbacks = 0; + + window._EsriLeafletCallbacks = {}; + + function serialize(params){ + var data = ''; + + params.f = 'json'; + + for (var key in params){ + if(params.hasOwnProperty(key)){ + var param = params[key]; + var type = Object.prototype.toString.call(param); + var value; + + if(data.length){ + data += '&'; + } + + if(type === '[object Array]' || type === '[object Object]'){ + value = JSON.stringify(param); + } else if (type === '[object Date]'){ + value = param.valueOf(); + } else { + value = param; + } + + data += encodeURIComponent(key) + '=' + encodeURIComponent(value); + } + } + + return data; + } + + function createRequest(callback, context){ + var httpRequest = new XMLHttpRequest(); + + httpRequest.onerror = function(e) { + callback.call(context, { + error: { + code: 500, + message: 'XMLHttpRequest error' + } + }, null); + }; + + httpRequest.onreadystatechange = function(){ + var response; + var error; + + if (httpRequest.readyState === 4) { + try { + response = JSON.parse(httpRequest.responseText); + } catch(e) { + response = null; + error = { + code: 500, + message: 'Could not parse response as JSON.' + }; + } + + if (!error && response.error) { + error = response.error; + response = null; + } + + callback.call(context, error, response); + } + }; + + return httpRequest; + } + + // AJAX handlers for CORS (modern browsers) or JSONP (older browsers) + EsriLeaflet.Request = { + request: function(url, params, callback, context){ + var paramString = serialize(params); + var httpRequest = createRequest(callback, context); + var requestLength = (url + '?' + paramString).length; + + // request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest + if(requestLength <= 2000 && L.esri.Support.CORS){ + httpRequest.open('GET', url + '?' + paramString); + httpRequest.send(null); + + // request is less more then 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest + } else if (requestLength > 2000 && L.esri.Support.CORS){ + httpRequest.open('POST', url); + httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + httpRequest.send(paramString); + + // request is less more then 2000 characters and the browser does not support CORS, make a JSONP request + } else if(requestLength <= 2000 && !L.esri.Support.CORS){ + return L.esri.Request.get.JSONP(url, params, callback, context); + + // request is longer then 2000 characters and the browser does not support CORS, log a warning + } else { + if(console && console.warn){ + console.warn('a request to ' + url + ' 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'); + return; + } + } + + return httpRequest; + }, + post: { + XMLHTTP: function (url, params, callback, context) { + var httpRequest = createRequest(callback, context); + httpRequest.open('POST', url); + httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + httpRequest.send(serialize(params)); + + return httpRequest; + } + }, + + get: { + CORS: function (url, params, callback, context) { + var httpRequest = createRequest(callback, context); + + httpRequest.open('GET', url + '?' + serialize(params), true); + httpRequest.send(null); + + return httpRequest; + }, + JSONP: function(url, params, callback, context){ + 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){ + if(window._EsriLeafletCallbacks[callbackId] !== true){ + var error; + var responseType = Object.prototype.toString.call(response); + + if(!(responseType === '[object Object]' || responseType === '[object Array]')){ + error = { + error: { + code: 500, + message: 'Expected array or object as JSONP response' + } + }; + response = null; + } + + if (!error && response.error) { + error = response; + response = null; + } + + callback.call(context, error, response); + window._EsriLeafletCallbacks[callbackId] = true; + } + }; + + callbacks++; + + return { + id: callbackId, + url: script.src, + abort: function(){ + window._EsriLeafletCallbacks._callback[callbackId]({ + code: 0, + message: 'Request aborted.' + }); + } + }; + } + } + }; + + // Choose the correct AJAX handler depending on CORS support + EsriLeaflet.get = (EsriLeaflet.Support.CORS) ? EsriLeaflet.Request.get.CORS : EsriLeaflet.Request.get.JSONP; + + // Always use XMLHttpRequest for posts + EsriLeaflet.post = EsriLeaflet.Request.post.XMLHTTP; + + // expose a common request method the uses GET\POST based on request length + EsriLeaflet.request = EsriLeaflet.Request.request; + +})(EsriLeaflet); + +EsriLeaflet.Tasks.Task = L.Class.extend({ + + options: { + proxy: false, + useCors: EsriLeaflet.Support.CORS + }, + + //Generate a method for each methodName:paramName in the setters for this task. + generateSetter: function(param, context){ + var isArray = param.match(/([a-zA-Z]+)\[\]/); + + param = (isArray) ? isArray[1] : param; + + if(isArray){ + return L.Util.bind(function(value){ + // this.params[param] = (this.params[param]) ? this.params[param] + ',' : ''; + if (L.Util.isArray(value)) { + this.params[param] = value.join(','); + } else { + this.params[param] = value; + } + return this; + }, context); + } else { + return L.Util.bind(function(value){ + this.params[param] = value; + return this; + }, context); + } + }, + + initialize: function(endpoint, options){ + // endpoint can be either a url to an ArcGIS Rest Service or an instance of EsriLeaflet.Service + if(endpoint.url && endpoint.request){ + this._service = endpoint; + this.url = endpoint.url; + } else { + this.url = EsriLeaflet.Util.cleanUrl(endpoint); + } + + // clone default params into this object + this.params = L.Util.extend({}, this.params || {}); + + // generate setter methods based on the setters object implimented a child class + if(this.setters){ + for (var setter in this.setters){ + var param = this.setters[setter]; + this[setter] = this.generateSetter(param, this); + } + } + + L.Util.setOptions(this, options); + }, + + token: function(token){ + if(this._service){ + this._service.authenticate(token); + } else { + this.params.token = token; + } + return this; + }, + + request: function(callback, context){ + if(this._service){ + return this._service.request(this.path, this.params, callback, context); + } else { + return this._request('request', this.path, this.params, callback, context); + } + }, + + _request: function(method, path, params, callback, context){ + var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path; + if((method === 'get' || method === 'request') && !this.options.useCors){ + return EsriLeaflet.Request.get.JSONP(url, params, callback, context); + } else{ + return EsriLeaflet[method](url, params, callback, context); + } + } +}); + +EsriLeaflet.Services.Service = L.Class.extend({ + + includes: L.Mixin.Events, + + options: { + proxy: false, + useCors: EsriLeaflet.Support.CORS + }, + + initialize: function (url, options) { + this.url = EsriLeaflet.Util.cleanUrl(url); + this._requestQueue = []; + this._authenticating = false; + L.Util.setOptions(this, options); + }, + + get: function (path, params, callback, context) { + return this._request('get', path, params, callback, context); + }, + + post: function (path, params, callback, context) { + return this._request('post', path, params, callback, context); + }, + + request: function (path, params, callback, context) { + return this._request('request', path, params, callback, context); + }, + + metadata: function (callback, context) { + return this._request('get', '', {}, callback, context); + }, + + authenticate: function(token){ + this._authenticating = false; + this.options.token = token; + this._runQueue(); + return this; + }, + + _request: function(method, path, params, callback, context){ + this.fire('requeststart', { + url: this.url + path, + params: params, + method: method + }); + + var wrappedCallback = this._createServiceCallback(method, path, params, callback, context); + + if (this.options.token) { + params.token = this.options.token; + } + + if (this._authenticating) { + this._requestQueue.push([method, path, params, callback, context]); + return; + } else { + var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path; + + if((method === 'get' || method === 'request') && !this.options.useCors){ + return EsriLeaflet.Request.get.JSONP(url, params, wrappedCallback); + } else { + return EsriLeaflet[method](url, params, wrappedCallback); + } + } + }, + + _createServiceCallback: function(method, path, params, callback, context){ + var request = [method, path, params, callback, context]; + + return L.Util.bind(function(error, response){ + + if (error && (error.code === 499 || error.code === 498)) { + this._authenticating = true; + + this._requestQueue.push(request); + + this.fire('authenticationrequired', { + authenticate: L.Util.bind(this.authenticate, this) + }); + } else { + callback.call(context, error, response); + + if(error) { + this.fire('requesterror', { + url: this.url + path, + params: params, + message: error.message, + code: error.code, + method: method + }); + } else { + this.fire('requestsuccess', { + url: this.url + path, + params: params, + response: response, + method: method + }); + } + + this.fire('requestend', { + url: this.url + path, + params: params, + method: method + }); + } + }, this); + }, + + _runQueue: function(){ + for (var i = this._requestQueue.length - 1; i >= 0; i--) { + var request = this._requestQueue[i]; + var method = request.shift(); + this[method].apply(this, request); + } + this._requestQueue = []; + } + +}); + +EsriLeaflet.Services.service = function(url, params){ + return new EsriLeaflet.Services.Service(url, params); +}; + + return EsriLeaflet; +})); +//# sourceMappingURL=esri-leaflet-core-src.js.map \ No newline at end of file diff --git a/dist/builds/core/esri-leaflet-core-src.js.map b/dist/builds/core/esri-leaflet-core-src.js.map new file mode 100644 index 000000000..f5a1843aa --- /dev/null +++ b/dist/builds/core/esri-leaflet-core-src.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/EsriLeaflet.js","../../../src/Util.js","../../../src/Request.js","../../../src/Tasks/Task.js","../../../src/Services/Service.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,GAAG,CAAC,WAAW,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI;AAAA,EACtC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAAA,EACpB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR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sourcesContent":["var EsriLeaflet = { //jshint ignore:line\n VERSION: '1.0.0-rc.2',\n Layers: {},\n Services: {},\n Controls: {},\n Tasks: {},\n Util: {},\n Support: {\n CORS: !!(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()),\n pointerEvents: document.documentElement.style.pointerEvents === ''\n }\n};\n\nif(typeof window !== 'undefined' && window.L){\n window.L.esri = EsriLeaflet;\n}","(function(EsriLeaflet){\n\n // shallow object clone for feature properties and attributes\n // from http://jsperf.com/cloning-an-object/2\n function clone(obj) {\n var target = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n target[i] = obj[i];\n }\n }\n return target;\n }\n\n // checks if 2 x,y points are equal\n function pointsEqual(a, b) {\n for (var i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n }\n\n // checks if the first and last points of a ring are equal and closes the ring\n function closeRing(coordinates) {\n if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) {\n coordinates.push(coordinates[0]);\n }\n return coordinates;\n }\n\n // determine if polygon ring coordinates are clockwise. clockwise signifies outer ring, counter-clockwise an inner ring\n // or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-\n // points-are-in-clockwise-order\n function ringIsClockwise(ringToTest) {\n var total = 0,i = 0;\n var rLength = ringToTest.length;\n var pt1 = ringToTest[i];\n var pt2;\n for (i; i < rLength - 1; i++) {\n pt2 = ringToTest[i + 1];\n total += (pt2[0] - pt1[0]) * (pt2[1] + pt1[1]);\n pt1 = pt2;\n }\n return (total >= 0);\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L504-L519\n function vertexIntersectsVertex(a1, a2, b1, b2) {\n var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]);\n var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]);\n var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]);\n\n if ( uB !== 0 ) {\n var ua = uaT / uB;\n var ub = ubT / uB;\n\n if ( 0 <= ua && ua <= 1 && 0 <= ub && ub <= 1 ) {\n return true;\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L521-L531\n function arrayIntersectsArray(a, b) {\n for (var i = 0; i < a.length - 1; i++) {\n for (var j = 0; j < b.length - 1; j++) {\n if (vertexIntersectsVertex(a[i], a[i + 1], b[j], b[j + 1])) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L470-L480\n function coordinatesContainPoint(coordinates, point) {\n var contains = false;\n for(var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) {\n if (((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1]) ||\n (coordinates[j][1] <= point[1] && point[1] < coordinates[i][1])) &&\n (point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0])) {\n contains = !contains;\n }\n }\n return contains;\n }\n\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L106-L113\n function coordinatesContainCoordinates(outer, inner){\n var intersects = arrayIntersectsArray(outer, inner);\n var contains = coordinatesContainPoint(outer, inner[0]);\n if(!intersects && contains){\n return true;\n }\n return false;\n }\n\n // do any polygons in this array contain any other polygons in this array?\n // used for checking for holes in arcgis rings\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L117-L172\n function convertRingsToGeoJSON(rings){\n var outerRings = [];\n var holes = [];\n var x; // iterator\n var outerRing; // current outer ring being evaluated\n var hole; // current hole being evaluated\n\n // for each ring\n for (var r = 0; r < rings.length; r++) {\n var ring = closeRing(rings[r].slice(0));\n if(ring.length < 4){\n continue;\n }\n // is this ring an outer ring? is it clockwise?\n if(ringIsClockwise(ring)){\n var polygon = [ ring ];\n outerRings.push(polygon); // push to outer rings\n } else {\n holes.push(ring); // counterclockwise push to holes\n }\n }\n\n var uncontainedHoles = [];\n\n // while there are holes left...\n while(holes.length){\n // pop a hole off out stack\n hole = holes.pop();\n\n // loop over all outer rings and see if they contain our hole.\n var contained = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(coordinatesContainCoordinates(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n contained = true;\n break;\n }\n }\n\n // ring is not contained in any outer ring\n // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320\n if(!contained){\n uncontainedHoles.push(hole);\n }\n }\n\n // if we couldn't match any holes using contains we can try intersects...\n while(uncontainedHoles.length){\n // pop a hole off out stack\n hole = uncontainedHoles.pop();\n\n // loop over all outer rings and see if any intersect our hole.\n var intersects = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(arrayIntersectsArray(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n intersects = true;\n break;\n }\n }\n\n if(!intersects) {\n outerRings.push([hole.reverse()]);\n }\n }\n\n if(outerRings.length === 1){\n return {\n type: 'Polygon',\n coordinates: outerRings[0]\n };\n } else {\n return {\n type: 'MultiPolygon',\n coordinates: outerRings\n };\n }\n }\n\n // This function ensures that rings are oriented in the right directions\n // outer rings are clockwise, holes are counterclockwise\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function orientRings(poly){\n var output = [];\n var polygon = poly.slice(0);\n var outerRing = closeRing(polygon.shift().slice(0));\n if(outerRing.length >= 4){\n if(!ringIsClockwise(outerRing)){\n outerRing.reverse();\n }\n\n output.push(outerRing);\n\n for (var i = 0; i < polygon.length; i++) {\n var hole = closeRing(polygon[i].slice(0));\n if(hole.length >= 4){\n if(ringIsClockwise(hole)){\n hole.reverse();\n }\n output.push(hole);\n }\n }\n }\n\n return output;\n }\n\n // This function flattens holes in multipolygons to one array of polygons\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function flattenMultiPolygonRings(rings){\n var output = [];\n for (var i = 0; i < rings.length; i++) {\n var polygon = orientRings(rings[i]);\n for (var x = polygon.length - 1; x >= 0; x--) {\n var ring = polygon[x].slice(0);\n output.push(ring);\n }\n }\n return output;\n }\n\n // convert an extent (ArcGIS) to LatLngBounds (Leaflet)\n EsriLeaflet.Util.extentToBounds = function(extent){\n var sw = new L.LatLng(extent.ymin, extent.xmin);\n var ne = new L.LatLng(extent.ymax, extent.xmax);\n return new L.LatLngBounds(sw, ne);\n };\n\n // convert an LatLngBounds (Leaflet) to extent (ArcGIS)\n EsriLeaflet.Util.boundsToExtent = function(bounds) {\n bounds = L.latLngBounds(bounds);\n return {\n 'xmin': bounds.getSouthWest().lng,\n 'ymin': bounds.getSouthWest().lat,\n 'xmax': bounds.getNorthEast().lng,\n 'ymax': bounds.getNorthEast().lat,\n 'spatialReference': {\n 'wkid' : 4326\n }\n };\n };\n\n EsriLeaflet.Util.arcgisToGeojson = function (arcgis, idAttribute){\n var geojson = {};\n\n if(typeof arcgis.x === 'number' && typeof arcgis.y === 'number'){\n geojson.type = 'Point';\n geojson.coordinates = [arcgis.x, arcgis.y];\n }\n\n if(arcgis.points){\n geojson.type = 'MultiPoint';\n geojson.coordinates = arcgis.points.slice(0);\n }\n\n if(arcgis.paths) {\n if(arcgis.paths.length === 1){\n geojson.type = 'LineString';\n geojson.coordinates = arcgis.paths[0].slice(0);\n } else {\n geojson.type = 'MultiLineString';\n geojson.coordinates = arcgis.paths.slice(0);\n }\n }\n\n if(arcgis.rings) {\n geojson = convertRingsToGeoJSON(arcgis.rings.slice(0));\n }\n\n if(arcgis.geometry || arcgis.attributes) {\n geojson.type = 'Feature';\n geojson.geometry = (arcgis.geometry) ? EsriLeaflet.Util.arcgisToGeojson(arcgis.geometry) : null;\n geojson.properties = (arcgis.attributes) ? clone(arcgis.attributes) : null;\n if(arcgis.attributes) {\n geojson.id = arcgis.attributes[idAttribute] || arcgis.attributes.OBJECTID || arcgis.attributes.FID;\n }\n }\n\n return geojson;\n };\n\n // GeoJSON -> ArcGIS\n EsriLeaflet.Util.geojsonToArcGIS = function(geojson, idAttribute){\n idAttribute = idAttribute || 'OBJECTID';\n var spatialReference = { wkid: 4326 };\n var result = {};\n var i;\n\n switch(geojson.type){\n case 'Point':\n result.x = geojson.coordinates[0];\n result.y = geojson.coordinates[1];\n result.spatialReference = spatialReference;\n break;\n case 'MultiPoint':\n result.points = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'LineString':\n result.paths = [geojson.coordinates.slice(0)];\n result.spatialReference = spatialReference;\n break;\n case 'MultiLineString':\n result.paths = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'Polygon':\n result.rings = orientRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'MultiPolygon':\n result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'Feature':\n if(geojson.geometry) {\n result.geometry = EsriLeaflet.Util.geojsonToArcGIS(geojson.geometry, idAttribute);\n }\n result.attributes = (geojson.properties) ? clone(geojson.properties) : {};\n if(geojson.id){\n result.attributes[idAttribute] = geojson.id;\n }\n break;\n case 'FeatureCollection':\n result = [];\n for (i = 0; i < geojson.features.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.features[i], idAttribute));\n }\n break;\n case 'GeometryCollection':\n result = [];\n for (i = 0; i < geojson.geometries.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.geometries[i], idAttribute));\n }\n break;\n }\n\n return result;\n };\n\n EsriLeaflet.Util.responseToFeatureCollection = function(response, idAttribute){\n var objectIdField;\n\n if(idAttribute){\n objectIdField = idAttribute;\n } else if(response.objectIdFieldName){\n objectIdField = response.objectIdFieldName;\n } else if(response.fields) {\n for (var j = 0; j <= response.fields.length - 1; j++) {\n if(response.fields[j].type === 'esriFieldTypeOID') {\n objectIdField = response.fields[j].name;\n break;\n }\n }\n } else {\n objectIdField = 'OBJECTID';\n }\n\n var featureCollection = {\n type: 'FeatureCollection',\n features: []\n };\n var features = response.features || response.results;\n if(features.length){\n for (var i = features.length - 1; i >= 0; i--) {\n featureCollection.features.push(EsriLeaflet.Util.arcgisToGeojson(features[i], objectIdField));\n }\n }\n\n return featureCollection;\n };\n\n // trim whitespace and add a tailing slash is needed to a url\n EsriLeaflet.Util.cleanUrl = function(url){\n url = url.replace(/\\s\\s*/g, '');\n\n //add a trailing slash to the url if the user omitted it\n if(url[url.length-1] !== '/'){\n url += '/';\n }\n\n return url;\n };\n\n EsriLeaflet.Util.geojsonTypeToArcGIS = function (geoJsonType) {\n var arcgisGeometryType;\n switch (geoJsonType) {\n case 'Point':\n arcgisGeometryType = 'esriGeometryPoint';\n break;\n case 'MultiPoint':\n arcgisGeometryType = 'esriGeometryMultipoint';\n break;\n case 'LineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'MultiLineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'Polygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n case 'MultiPolygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n }\n return arcgisGeometryType;\n };\n\n})(EsriLeaflet);","(function(EsriLeaflet){\n\n var callbacks = 0;\n\n window._EsriLeafletCallbacks = {};\n\n function serialize(params){\n var data = '';\n\n params.f = 'json';\n\n for (var key in params){\n if(params.hasOwnProperty(key)){\n var param = params[key];\n var type = Object.prototype.toString.call(param);\n var value;\n\n if(data.length){\n data += '&';\n }\n\n if(type === '[object Array]' || type === '[object Object]'){\n value = JSON.stringify(param);\n } else if (type === '[object Date]'){\n value = param.valueOf();\n } else {\n value = param;\n }\n\n data += encodeURIComponent(key) + '=' + encodeURIComponent(value);\n }\n }\n\n return data;\n }\n\n function createRequest(callback, context){\n var httpRequest = new XMLHttpRequest();\n\n httpRequest.onerror = function(e) {\n callback.call(context, {\n error: {\n code: 500,\n message: 'XMLHttpRequest error'\n }\n }, null);\n };\n\n httpRequest.onreadystatechange = function(){\n var response;\n var error;\n\n if (httpRequest.readyState === 4) {\n try {\n response = JSON.parse(httpRequest.responseText);\n } catch(e) {\n response = null;\n error = {\n code: 500,\n message: 'Could not parse response as JSON.'\n };\n }\n\n if (!error && response.error) {\n error = response.error;\n response = null;\n }\n\n callback.call(context, error, response);\n }\n };\n\n return httpRequest;\n }\n\n // AJAX handlers for CORS (modern browsers) or JSONP (older browsers)\n EsriLeaflet.Request = {\n request: function(url, params, callback, context){\n var paramString = serialize(params);\n var httpRequest = createRequest(callback, context);\n var requestLength = (url + '?' + paramString).length;\n\n // request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest\n if(requestLength <= 2000 && L.esri.Support.CORS){\n httpRequest.open('GET', url + '?' + paramString);\n httpRequest.send(null);\n\n // request is less more then 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest\n } else if (requestLength > 2000 && L.esri.Support.CORS){\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(paramString);\n\n // request is less more then 2000 characters and the browser does not support CORS, make a JSONP request\n } else if(requestLength <= 2000 && !L.esri.Support.CORS){\n return L.esri.Request.get.JSONP(url, params, callback, context);\n\n // request is longer then 2000 characters and the browser does not support CORS, log a warning\n } else {\n if(console && console.warn){\n console.warn('a request to ' + url + ' 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');\n return;\n }\n }\n\n return httpRequest;\n },\n post: {\n XMLHTTP: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(serialize(params));\n\n return httpRequest;\n }\n },\n\n get: {\n CORS: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n\n httpRequest.open('GET', url + '?' + serialize(params), true);\n httpRequest.send(null);\n\n return httpRequest;\n },\n JSONP: function(url, params, callback, context){\n var callbackId = 'c' + callbacks;\n\n params.callback = 'window._EsriLeafletCallbacks.' + callbackId;\n\n var script = L.DomUtil.create('script', null, document.body);\n script.type = 'text/javascript';\n script.src = url + '?' + serialize(params);\n script.id = callbackId;\n\n window._EsriLeafletCallbacks[callbackId] = function(response){\n if(window._EsriLeafletCallbacks[callbackId] !== true){\n var error;\n var responseType = Object.prototype.toString.call(response);\n\n if(!(responseType === '[object Object]' || responseType === '[object Array]')){\n error = {\n error: {\n code: 500,\n message: 'Expected array or object as JSONP response'\n }\n };\n response = null;\n }\n\n if (!error && response.error) {\n error = response;\n response = null;\n }\n\n callback.call(context, error, response);\n window._EsriLeafletCallbacks[callbackId] = true;\n }\n };\n\n callbacks++;\n\n return {\n id: callbackId,\n url: script.src,\n abort: function(){\n window._EsriLeafletCallbacks._callback[callbackId]({\n code: 0,\n message: 'Request aborted.'\n });\n }\n };\n }\n }\n };\n\n // Choose the correct AJAX handler depending on CORS support\n EsriLeaflet.get = (EsriLeaflet.Support.CORS) ? EsriLeaflet.Request.get.CORS : EsriLeaflet.Request.get.JSONP;\n\n // Always use XMLHttpRequest for posts\n EsriLeaflet.post = EsriLeaflet.Request.post.XMLHTTP;\n\n // expose a common request method the uses GET\\POST based on request length\n EsriLeaflet.request = EsriLeaflet.Request.request;\n\n})(EsriLeaflet);","EsriLeaflet.Tasks.Task = L.Class.extend({\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n //Generate a method for each methodName:paramName in the setters for this task.\n generateSetter: function(param, context){\n var isArray = param.match(/([a-zA-Z]+)\\[\\]/);\n\n param = (isArray) ? isArray[1] : param;\n\n if(isArray){\n return L.Util.bind(function(value){\n // this.params[param] = (this.params[param]) ? this.params[param] + ',' : '';\n if (L.Util.isArray(value)) {\n this.params[param] = value.join(',');\n } else {\n this.params[param] = value;\n }\n return this;\n }, context);\n } else {\n return L.Util.bind(function(value){\n this.params[param] = value;\n return this;\n }, context);\n }\n },\n\n initialize: function(endpoint, options){\n // endpoint can be either a url to an ArcGIS Rest Service or an instance of EsriLeaflet.Service\n if(endpoint.url && endpoint.request){\n this._service = endpoint;\n this.url = endpoint.url;\n } else {\n this.url = EsriLeaflet.Util.cleanUrl(endpoint);\n }\n\n // clone default params into this object\n this.params = L.Util.extend({}, this.params || {});\n\n // generate setter methods based on the setters object implimented a child class\n if(this.setters){\n for (var setter in this.setters){\n var param = this.setters[setter];\n this[setter] = this.generateSetter(param, this);\n }\n }\n\n L.Util.setOptions(this, options);\n },\n\n token: function(token){\n if(this._service){\n this._service.authenticate(token);\n } else {\n this.params.token = token;\n }\n return this;\n },\n\n request: function(callback, context){\n if(this._service){\n return this._service.request(this.path, this.params, callback, context);\n } else {\n return this._request('request', this.path, this.params, callback, context);\n }\n },\n\n _request: function(method, path, params, callback, context){\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, callback, context);\n } else{\n return EsriLeaflet[method](url, params, callback, context);\n }\n }\n});","EsriLeaflet.Services.Service = L.Class.extend({\n\n includes: L.Mixin.Events,\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n initialize: function (url, options) {\n this.url = EsriLeaflet.Util.cleanUrl(url);\n this._requestQueue = [];\n this._authenticating = false;\n L.Util.setOptions(this, options);\n },\n\n get: function (path, params, callback, context) {\n return this._request('get', path, params, callback, context);\n },\n\n post: function (path, params, callback, context) {\n return this._request('post', path, params, callback, context);\n },\n\n request: function (path, params, callback, context) {\n return this._request('request', path, params, callback, context);\n },\n\n metadata: function (callback, context) {\n return this._request('get', '', {}, callback, context);\n },\n\n authenticate: function(token){\n this._authenticating = false;\n this.options.token = token;\n this._runQueue();\n return this;\n },\n\n _request: function(method, path, params, callback, context){\n this.fire('requeststart', {\n url: this.url + path,\n params: params,\n method: method\n });\n\n var wrappedCallback = this._createServiceCallback(method, path, params, callback, context);\n\n if (this.options.token) {\n params.token = this.options.token;\n }\n\n if (this._authenticating) {\n this._requestQueue.push([method, path, params, callback, context]);\n return;\n } else {\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, wrappedCallback);\n } else {\n return EsriLeaflet[method](url, params, wrappedCallback);\n }\n }\n },\n\n _createServiceCallback: function(method, path, params, callback, context){\n var request = [method, path, params, callback, context];\n\n return L.Util.bind(function(error, response){\n\n if (error && (error.code === 499 || error.code === 498)) {\n this._authenticating = true;\n\n this._requestQueue.push(request);\n\n this.fire('authenticationrequired', {\n authenticate: L.Util.bind(this.authenticate, this)\n });\n } else {\n callback.call(context, error, response);\n\n if(error) {\n this.fire('requesterror', {\n url: this.url + path,\n params: params,\n message: error.message,\n code: error.code,\n method: method\n });\n } else {\n this.fire('requestsuccess', {\n url: this.url + path,\n params: params,\n response: response,\n method: method\n });\n }\n\n this.fire('requestend', {\n url: this.url + path,\n params: params,\n method: method\n });\n }\n }, this);\n },\n\n _runQueue: function(){\n for (var i = this._requestQueue.length - 1; i >= 0; i--) {\n var request = this._requestQueue[i];\n var method = request.shift();\n this[method].apply(this, request);\n }\n this._requestQueue = [];\n }\n\n});\n\nEsriLeaflet.Services.service = function(url, params){\n return new EsriLeaflet.Services.Service(url, params);\n};"]} \ No newline at end of file diff --git a/dist/builds/core/esri-leaflet-core.js b/dist/builds/core/esri-leaflet-core.js new file mode 100644 index 000000000..0ddd7e910 --- /dev/null +++ b/dist/builds/core/esri-leaflet-core.js @@ -0,0 +1,24 @@ +/*! esri-leaflet - v1.0.0-rc.3 - 2014-11-04 +* Copyright (c) 2014 Environmental Systems Research Institute, Inc. +* Apache License*/ +(function (factory) { + //define an AMD module that relies on 'leaflet' + if (typeof define === 'function' && define.amd) { + define(['leaflet'], function (L) { + return factory(L); + }); + //define a common js module that relies on 'leaflet' + } else if (typeof module === 'object' && typeof module.exports === 'object') { + module.exports = factory(require('leaflet')); + } + + if(typeof window !== 'undefined' && window.L){ + factory(window.L); + } +}(function (L) { + +var EsriLeaflet={VERSION:"1.0.0-rc.2",Layers:{},Services:{},Controls:{},Tasks:{},Util:{},Support:{CORS:!!(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),pointerEvents:""===document.documentElement.style.pointerEvents}};"undefined"!=typeof window&&window.L&&(window.L.esri=EsriLeaflet),function(a){function b(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function c(a,b){for(var c=0;cd;d++)b=a[d+1],c+=(b[0]-f[0])*(b[1]+f[1]),f=b;return c>=0}function f(a,b,c,d){var e=(d[0]-c[0])*(a[1]-c[1])-(d[1]-c[1])*(a[0]-c[0]),f=(b[0]-a[0])*(a[1]-c[1])-(b[1]-a[1])*(a[0]-c[0]),g=(d[1]-c[1])*(b[0]-a[0])-(d[0]-c[0])*(b[1]-a[1]);if(0!==g){var h=e/g,i=f/g;if(h>=0&&1>=h&&i>=0&&1>=i)return!0}return!1}function g(a,b){for(var c=0;c=0;b--)if(c=h[b][0],i(c,f)){h[b].push(f),o=!0;break}o||n.push(f)}for(;n.length;){f=n.pop();var p=!1;for(b=h.length-1;b>=0;b--)if(c=h[b][0],g(c,f)){h[b].push(f),p=!0;break}p||h.push([f.reverse()])}return 1===h.length?{type:"Polygon",coordinates:h[0]}:{type:"MultiPolygon",coordinates:h}}function k(a){var b=[],c=a.slice(0),f=d(c.shift().slice(0));if(f.length>=4){e(f)||f.reverse(),b.push(f);for(var g=0;g=4&&(e(h)&&h.reverse(),b.push(h))}}return b}function l(a){for(var b=[],c=0;c=0;e--){var f=d[e].slice(0);b.push(f)}return b}a.Util.extentToBounds=function(a){var b=new L.LatLng(a.ymin,a.xmin),c=new L.LatLng(a.ymax,a.xmax);return new L.LatLngBounds(b,c)},a.Util.boundsToExtent=function(a){return a=L.latLngBounds(a),{xmin:a.getSouthWest().lng,ymin:a.getSouthWest().lat,xmax:a.getNorthEast().lng,ymax:a.getNorthEast().lat,spatialReference:{wkid:4326}}},a.Util.arcgisToGeojson=function(c,d){var e={};return"number"==typeof c.x&&"number"==typeof c.y&&(e.type="Point",e.coordinates=[c.x,c.y]),c.points&&(e.type="MultiPoint",e.coordinates=c.points.slice(0)),c.paths&&(1===c.paths.length?(e.type="LineString",e.coordinates=c.paths[0].slice(0)):(e.type="MultiLineString",e.coordinates=c.paths.slice(0))),c.rings&&(e=j(c.rings.slice(0))),(c.geometry||c.attributes)&&(e.type="Feature",e.geometry=c.geometry?a.Util.arcgisToGeojson(c.geometry):null,e.properties=c.attributes?b(c.attributes):null,c.attributes&&(e.id=c.attributes[d]||c.attributes.OBJECTID||c.attributes.FID)),e},a.Util.geojsonToArcGIS=function(c,d){d=d||"OBJECTID";var e,f={wkid:4326},g={};switch(c.type){case"Point":g.x=c.coordinates[0],g.y=c.coordinates[1],g.spatialReference=f;break;case"MultiPoint":g.points=c.coordinates.slice(0),g.spatialReference=f;break;case"LineString":g.paths=[c.coordinates.slice(0)],g.spatialReference=f;break;case"MultiLineString":g.paths=c.coordinates.slice(0),g.spatialReference=f;break;case"Polygon":g.rings=k(c.coordinates.slice(0)),g.spatialReference=f;break;case"MultiPolygon":g.rings=l(c.coordinates.slice(0)),g.spatialReference=f;break;case"Feature":c.geometry&&(g.geometry=a.Util.geojsonToArcGIS(c.geometry,d)),g.attributes=c.properties?b(c.properties):{},c.id&&(g.attributes[d]=c.id);break;case"FeatureCollection":for(g=[],e=0;e=0;h--)f.features.push(a.Util.arcgisToGeojson(g[h],d));return f},a.Util.cleanUrl=function(a){return a=a.replace(/\s\s*/g,""),"/"!==a[a.length-1]&&(a+="/"),a},a.Util.geojsonTypeToArcGIS=function(a){var b;switch(a){case"Point":b="esriGeometryPoint";break;case"MultiPoint":b="esriGeometryMultipoint";break;case"LineString":b="esriGeometryPolyline";break;case"MultiLineString":b="esriGeometryPolyline";break;case"Polygon":b="esriGeometryPolygon";break;case"MultiPolygon":b="esriGeometryPolygon"}return b}}(EsriLeaflet),function(a){function b(a){var b="";a.f="json";for(var c in a)if(a.hasOwnProperty(c)){var d,e=a[c],f=Object.prototype.toString.call(e);b.length&&(b+="&"),d="[object Array]"===f||"[object Object]"===f?JSON.stringify(e):"[object Date]"===f?e.valueOf():e,b+=encodeURIComponent(c)+"="+encodeURIComponent(d)}return b}function c(a,b){var c=new XMLHttpRequest;return c.onerror=function(){a.call(b,{error:{code:500,message:"XMLHttpRequest error"}},null)},c.onreadystatechange=function(){var d,e;if(4===c.readyState){try{d=JSON.parse(c.responseText)}catch(f){d=null,e={code:500,message:"Could not parse response as JSON."}}!e&&d.error&&(e=d.error,d=null),a.call(b,e,d)}},c}var d=0;window._EsriLeafletCallbacks={},a.Request={request:function(a,d,e,f){var g=b(d),h=c(e,f),i=(a+"?"+g).length;if(2e3>=i&&L.esri.Support.CORS)h.open("GET",a+"?"+g),h.send(null);else if(i>2e3&&L.esri.Support.CORS)h.open("POST",a),h.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),h.send(g);else{if(2e3>=i&&!L.esri.Support.CORS)return L.esri.Request.get.JSONP(a,d,e,f);if(console&&console.warn)return void console.warn("a request to "+a+" 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")}return h},post:{XMLHTTP:function(a,d,e,f){var g=c(e,f);return g.open("POST",a),g.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),g.send(b(d)),g}},get:{CORS:function(a,d,e,f){var g=c(e,f);return g.open("GET",a+"?"+b(d),!0),g.send(null),g},JSONP:function(a,c,e,f){var g="c"+d;c.callback="window._EsriLeafletCallbacks."+g;var h=L.DomUtil.create("script",null,document.body);return h.type="text/javascript",h.src=a+"?"+b(c),h.id=g,window._EsriLeafletCallbacks[g]=function(a){if(window._EsriLeafletCallbacks[g]!==!0){var b,c=Object.prototype.toString.call(a);"[object Object]"!==c&&"[object Array]"!==c&&(b={error:{code:500,message:"Expected array or object as JSONP response"}},a=null),!b&&a.error&&(b=a,a=null),e.call(f,b,a),window._EsriLeafletCallbacks[g]=!0}},d++,{id:g,url:h.src,abort:function(){window._EsriLeafletCallbacks._callback[g]({code:0,message:"Request aborted."})}}}}},a.get=a.Support.CORS?a.Request.get.CORS:a.Request.get.JSONP,a.post=a.Request.post.XMLHTTP,a.request=a.Request.request}(EsriLeaflet),EsriLeaflet.Tasks.Task=L.Class.extend({options:{proxy:!1,useCors:EsriLeaflet.Support.CORS},generateSetter:function(a,b){var c=a.match(/([a-zA-Z]+)\[\]/);return a=c?c[1]:a,c?L.Util.bind(function(b){return this.params[a]=L.Util.isArray(b)?b.join(","):b,this},b):L.Util.bind(function(b){return this.params[a]=b,this},b)},initialize:function(a,b){if(a.url&&a.request?(this._service=a,this.url=a.url):this.url=EsriLeaflet.Util.cleanUrl(a),this.params=L.Util.extend({},this.params||{}),this.setters)for(var c in this.setters){var d=this.setters[c];this[c]=this.generateSetter(d,this)}L.Util.setOptions(this,b)},token:function(a){return this._service?this._service.authenticate(a):this.params.token=a,this},request:function(a,b){return this._service?this._service.request(this.path,this.params,a,b):this._request("request",this.path,this.params,a,b)},_request:function(a,b,c,d,e){var f=this.options.proxy?this.options.proxy+"?"+this.url+b:this.url+b;return"get"!==a&&"request"!==a||this.options.useCors?EsriLeaflet[a](f,c,d,e):EsriLeaflet.Request.get.JSONP(f,c,d,e)}}),EsriLeaflet.Services.Service=L.Class.extend({includes:L.Mixin.Events,options:{proxy:!1,useCors:EsriLeaflet.Support.CORS},initialize:function(a,b){this.url=EsriLeaflet.Util.cleanUrl(a),this._requestQueue=[],this._authenticating=!1,L.Util.setOptions(this,b)},get:function(a,b,c,d){return this._request("get",a,b,c,d)},post:function(a,b,c,d){return this._request("post",a,b,c,d)},request:function(a,b,c,d){return this._request("request",a,b,c,d)},metadata:function(a,b){return this._request("get","",{},a,b)},authenticate:function(a){return this._authenticating=!1,this.options.token=a,this._runQueue(),this},_request:function(a,b,c,d,e){this.fire("requeststart",{url:this.url+b,params:c,method:a});var f=this._createServiceCallback(a,b,c,d,e);if(this.options.token&&(c.token=this.options.token),this._authenticating)return void this._requestQueue.push([a,b,c,d,e]);var g=this.options.proxy?this.options.proxy+"?"+this.url+b:this.url+b;return"get"!==a&&"request"!==a||this.options.useCors?EsriLeaflet[a](g,c,f):EsriLeaflet.Request.get.JSONP(g,c,f)},_createServiceCallback:function(a,b,c,d,e){var f=[a,b,c,d,e];return L.Util.bind(function(g,h){!g||499!==g.code&&498!==g.code?(d.call(e,g,h),g?this.fire("requesterror",{url:this.url+b,params:c,message:g.message,code:g.code,method:a}):this.fire("requestsuccess",{url:this.url+b,params:c,response:h,method:a}),this.fire("requestend",{url:this.url+b,params:c,method:a})):(this._authenticating=!0,this._requestQueue.push(f),this.fire("authenticationrequired",{authenticate:L.Util.bind(this.authenticate,this)}))},this)},_runQueue:function(){for(var a=this._requestQueue.length-1;a>=0;a--){var b=this._requestQueue[a],c=b.shift();this[c].apply(this,b)}this._requestQueue=[]}}),EsriLeaflet.Services.service=function(a,b){return new EsriLeaflet.Services.Service(a,b)}; +//# sourceMappingURL=esri-leaflet-core.js.map + + return EsriLeaflet; +})); \ No newline at end of file diff --git a/dist/builds/core/esri-leaflet-core.js.map b/dist/builds/core/esri-leaflet-core.js.map new file mode 100644 index 000000000..18d2d3ed2 --- /dev/null +++ b/dist/builds/core/esri-leaflet-core.js.map @@ -0,0 +1 @@ +{"version":3,"file":"esri-leaflet-core.js","sources":["../../../src/EsriLeaflet.js","../../../src/Util.js","../../../src/Request.js","../../../src/Tasks/Task.js","../../../src/Services/Service.js"],"names":["EsriLeaflet","VERSION","Layers","Services","Controls","Tasks","Util","Support","CORS","window","XMLHttpRequest","pointerEvents","document","documentElement","style","L","esri","clone","obj","target","i","hasOwnProperty","pointsEqual","a","b","length","closeRing","coordinates","push","ringIsClockwise","ringToTest","pt2","total","rLength","pt1","vertexIntersectsVertex","a1","a2","b1","b2","uaT","ubT","uB","ua","ub","arrayIntersectsArray","j","coordinatesContainPoint","point","contains","l","coordinatesContainCoordinates","outer","inner","intersects","convertRingsToGeoJSON","rings","x","outerRing","hole","outerRings","holes","r","ring","slice","polygon","uncontainedHoles","pop","contained","reverse","type","orientRings","poly","output","shift","flattenMultiPolygonRings","extentToBounds","extent","sw","LatLng","ymin","xmin","ne","ymax","xmax","LatLngBounds","boundsToExtent","bounds","latLngBounds","getSouthWest","lng","lat","getNorthEast","spatialReference","wkid","arcgisToGeojson","arcgis","idAttribute","geojson","y","points","paths","geometry","attributes","properties","id","OBJECTID","FID","geojsonToArcGIS","result","features","geometries","responseToFeatureCollection","response","objectIdField","objectIdFieldName","fields","name","featureCollection","results","cleanUrl","url","replace","geojsonTypeToArcGIS","geoJsonType","arcgisGeometryType","serialize","params","data","f","key","value","param","Object","prototype","toString","call","JSON","stringify","valueOf","encodeURIComponent","createRequest","callback","context","httpRequest","onerror","error","code","message","onreadystatechange","readyState","parse","responseText","e","callbacks","_EsriLeafletCallbacks","Request","request","paramString","requestLength","open","send","setRequestHeader","get","JSONP","console","warn","post","XMLHTTP","callbackId","script","DomUtil","create","body","src","responseType","abort","_callback","Task","Class","extend","options","proxy","useCors","generateSetter","isArray","match","bind","this","join","initialize","endpoint","_service","setters","setter","setOptions","token","authenticate","path","_request","method","Service","includes","Mixin","Events","_requestQueue","_authenticating","metadata","_runQueue","fire","wrappedCallback","_createServiceCallback","apply","service"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,GAAIA,cACFC,QAAS,aACTC,UACAC,YACAC,YACAC,SACAC,QACAC,SACEC,QAASC,OAAOC,gBAAkB,mBAAqB,IAAIA,iBAC3DC,cAAgE,KAAjDC,SAASC,gBAAgBC,MAAMH,eAI7B,oBAAXF,SAA0BA,OAAOM,IACzCN,OAAOM,EAAEC,KAAO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EvBlB,KAAKiB,cAAcjL,KAAKiI,GAExB+B,KAAKqB,KAAK,0BACRZ,aAActL,EAAET,KAAKqL,KAAKC,KAAKS,aAAcT,UA4BhDA,OAGLoB,UAAW,WACT,IAAK,GAAI5L,GAAIwK,KAAKiB,cAAcpL,OAAS,EAAGL,GAAK,EAAGA,IAAK,CACvD,GAAIyI,GAAU+B,KAAKiB,cAAczL,GAC7BoL,EAAS3C,EAAQnF,OACrBkH,MAAKY,GAAQY,MAAMxB,KAAM/B,GAE3B+B,KAAKiB,oBAKT7M,YAAYG,SAASkN,QAAU,SAAS5F,EAAKM,GAC3C,MAAO,IAAI/H,aAAYG,SAASsM,QAAQhF,EAAKM","sourcesContent":["var EsriLeaflet = { //jshint ignore:line\n VERSION: '1.0.0-rc.2',\n Layers: {},\n Services: {},\n Controls: {},\n Tasks: {},\n Util: {},\n Support: {\n CORS: !!(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()),\n pointerEvents: document.documentElement.style.pointerEvents === ''\n }\n};\n\nif(typeof window !== 'undefined' && window.L){\n window.L.esri = EsriLeaflet;\n}","(function(EsriLeaflet){\n\n // shallow object clone for feature properties and attributes\n // from http://jsperf.com/cloning-an-object/2\n function clone(obj) {\n var target = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n target[i] = obj[i];\n }\n }\n return target;\n }\n\n // checks if 2 x,y points are equal\n function pointsEqual(a, b) {\n for (var i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n }\n\n // checks if the first and last points of a ring are equal and closes the ring\n function closeRing(coordinates) {\n if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) {\n coordinates.push(coordinates[0]);\n }\n return coordinates;\n }\n\n // determine if polygon ring coordinates are clockwise. clockwise signifies outer ring, counter-clockwise an inner ring\n // or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-\n // points-are-in-clockwise-order\n function ringIsClockwise(ringToTest) {\n var total = 0,i = 0;\n var rLength = ringToTest.length;\n var pt1 = ringToTest[i];\n var pt2;\n for (i; i < rLength - 1; i++) {\n pt2 = ringToTest[i + 1];\n total += (pt2[0] - pt1[0]) * (pt2[1] + pt1[1]);\n pt1 = pt2;\n }\n return (total >= 0);\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L504-L519\n function vertexIntersectsVertex(a1, a2, b1, b2) {\n var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]);\n var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]);\n var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]);\n\n if ( uB !== 0 ) {\n var ua = uaT / uB;\n var ub = ubT / uB;\n\n if ( 0 <= ua && ua <= 1 && 0 <= ub && ub <= 1 ) {\n return true;\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L521-L531\n function arrayIntersectsArray(a, b) {\n for (var i = 0; i < a.length - 1; i++) {\n for (var j = 0; j < b.length - 1; j++) {\n if (vertexIntersectsVertex(a[i], a[i + 1], b[j], b[j + 1])) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L470-L480\n function coordinatesContainPoint(coordinates, point) {\n var contains = false;\n for(var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) {\n if (((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1]) ||\n (coordinates[j][1] <= point[1] && point[1] < coordinates[i][1])) &&\n (point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0])) {\n contains = !contains;\n }\n }\n return contains;\n }\n\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L106-L113\n function coordinatesContainCoordinates(outer, inner){\n var intersects = arrayIntersectsArray(outer, inner);\n var contains = coordinatesContainPoint(outer, inner[0]);\n if(!intersects && contains){\n return true;\n }\n return false;\n }\n\n // do any polygons in this array contain any other polygons in this array?\n // used for checking for holes in arcgis rings\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L117-L172\n function convertRingsToGeoJSON(rings){\n var outerRings = [];\n var holes = [];\n var x; // iterator\n var outerRing; // current outer ring being evaluated\n var hole; // current hole being evaluated\n\n // for each ring\n for (var r = 0; r < rings.length; r++) {\n var ring = closeRing(rings[r].slice(0));\n if(ring.length < 4){\n continue;\n }\n // is this ring an outer ring? is it clockwise?\n if(ringIsClockwise(ring)){\n var polygon = [ ring ];\n outerRings.push(polygon); // push to outer rings\n } else {\n holes.push(ring); // counterclockwise push to holes\n }\n }\n\n var uncontainedHoles = [];\n\n // while there are holes left...\n while(holes.length){\n // pop a hole off out stack\n hole = holes.pop();\n\n // loop over all outer rings and see if they contain our hole.\n var contained = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(coordinatesContainCoordinates(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n contained = true;\n break;\n }\n }\n\n // ring is not contained in any outer ring\n // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320\n if(!contained){\n uncontainedHoles.push(hole);\n }\n }\n\n // if we couldn't match any holes using contains we can try intersects...\n while(uncontainedHoles.length){\n // pop a hole off out stack\n hole = uncontainedHoles.pop();\n\n // loop over all outer rings and see if any intersect our hole.\n var intersects = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(arrayIntersectsArray(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n intersects = true;\n break;\n }\n }\n\n if(!intersects) {\n outerRings.push([hole.reverse()]);\n }\n }\n\n if(outerRings.length === 1){\n return {\n type: 'Polygon',\n coordinates: outerRings[0]\n };\n } else {\n return {\n type: 'MultiPolygon',\n coordinates: outerRings\n };\n }\n }\n\n // This function ensures that rings are oriented in the right directions\n // outer rings are clockwise, holes are counterclockwise\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function orientRings(poly){\n var output = [];\n var polygon = poly.slice(0);\n var outerRing = closeRing(polygon.shift().slice(0));\n if(outerRing.length >= 4){\n if(!ringIsClockwise(outerRing)){\n outerRing.reverse();\n }\n\n output.push(outerRing);\n\n for (var i = 0; i < polygon.length; i++) {\n var hole = closeRing(polygon[i].slice(0));\n if(hole.length >= 4){\n if(ringIsClockwise(hole)){\n hole.reverse();\n }\n output.push(hole);\n }\n }\n }\n\n return output;\n }\n\n // This function flattens holes in multipolygons to one array of polygons\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function flattenMultiPolygonRings(rings){\n var output = [];\n for (var i = 0; i < rings.length; i++) {\n var polygon = orientRings(rings[i]);\n for (var x = polygon.length - 1; x >= 0; x--) {\n var ring = polygon[x].slice(0);\n output.push(ring);\n }\n }\n return output;\n }\n\n // convert an extent (ArcGIS) to LatLngBounds (Leaflet)\n EsriLeaflet.Util.extentToBounds = function(extent){\n var sw = new L.LatLng(extent.ymin, extent.xmin);\n var ne = new L.LatLng(extent.ymax, extent.xmax);\n return new L.LatLngBounds(sw, ne);\n };\n\n // convert an LatLngBounds (Leaflet) to extent (ArcGIS)\n EsriLeaflet.Util.boundsToExtent = function(bounds) {\n bounds = L.latLngBounds(bounds);\n return {\n 'xmin': bounds.getSouthWest().lng,\n 'ymin': bounds.getSouthWest().lat,\n 'xmax': bounds.getNorthEast().lng,\n 'ymax': bounds.getNorthEast().lat,\n 'spatialReference': {\n 'wkid' : 4326\n }\n };\n };\n\n EsriLeaflet.Util.arcgisToGeojson = function (arcgis, idAttribute){\n var geojson = {};\n\n if(typeof arcgis.x === 'number' && typeof arcgis.y === 'number'){\n geojson.type = 'Point';\n geojson.coordinates = [arcgis.x, arcgis.y];\n }\n\n if(arcgis.points){\n geojson.type = 'MultiPoint';\n geojson.coordinates = arcgis.points.slice(0);\n }\n\n if(arcgis.paths) {\n if(arcgis.paths.length === 1){\n geojson.type = 'LineString';\n geojson.coordinates = arcgis.paths[0].slice(0);\n } else {\n geojson.type = 'MultiLineString';\n geojson.coordinates = arcgis.paths.slice(0);\n }\n }\n\n if(arcgis.rings) {\n geojson = convertRingsToGeoJSON(arcgis.rings.slice(0));\n }\n\n if(arcgis.geometry || arcgis.attributes) {\n geojson.type = 'Feature';\n geojson.geometry = (arcgis.geometry) ? EsriLeaflet.Util.arcgisToGeojson(arcgis.geometry) : null;\n geojson.properties = (arcgis.attributes) ? clone(arcgis.attributes) : null;\n if(arcgis.attributes) {\n geojson.id = arcgis.attributes[idAttribute] || arcgis.attributes.OBJECTID || arcgis.attributes.FID;\n }\n }\n\n return geojson;\n };\n\n // GeoJSON -> ArcGIS\n EsriLeaflet.Util.geojsonToArcGIS = function(geojson, idAttribute){\n idAttribute = idAttribute || 'OBJECTID';\n var spatialReference = { wkid: 4326 };\n var result = {};\n var i;\n\n switch(geojson.type){\n case 'Point':\n result.x = geojson.coordinates[0];\n result.y = geojson.coordinates[1];\n result.spatialReference = spatialReference;\n break;\n case 'MultiPoint':\n result.points = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'LineString':\n result.paths = [geojson.coordinates.slice(0)];\n result.spatialReference = spatialReference;\n break;\n case 'MultiLineString':\n result.paths = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'Polygon':\n result.rings = orientRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'MultiPolygon':\n result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'Feature':\n if(geojson.geometry) {\n result.geometry = EsriLeaflet.Util.geojsonToArcGIS(geojson.geometry, idAttribute);\n }\n result.attributes = (geojson.properties) ? clone(geojson.properties) : {};\n if(geojson.id){\n result.attributes[idAttribute] = geojson.id;\n }\n break;\n case 'FeatureCollection':\n result = [];\n for (i = 0; i < geojson.features.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.features[i], idAttribute));\n }\n break;\n case 'GeometryCollection':\n result = [];\n for (i = 0; i < geojson.geometries.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.geometries[i], idAttribute));\n }\n break;\n }\n\n return result;\n };\n\n EsriLeaflet.Util.responseToFeatureCollection = function(response, idAttribute){\n var objectIdField;\n\n if(idAttribute){\n objectIdField = idAttribute;\n } else if(response.objectIdFieldName){\n objectIdField = response.objectIdFieldName;\n } else if(response.fields) {\n for (var j = 0; j <= response.fields.length - 1; j++) {\n if(response.fields[j].type === 'esriFieldTypeOID') {\n objectIdField = response.fields[j].name;\n break;\n }\n }\n } else {\n objectIdField = 'OBJECTID';\n }\n\n var featureCollection = {\n type: 'FeatureCollection',\n features: []\n };\n var features = response.features || response.results;\n if(features.length){\n for (var i = features.length - 1; i >= 0; i--) {\n featureCollection.features.push(EsriLeaflet.Util.arcgisToGeojson(features[i], objectIdField));\n }\n }\n\n return featureCollection;\n };\n\n // trim whitespace and add a tailing slash is needed to a url\n EsriLeaflet.Util.cleanUrl = function(url){\n url = url.replace(/\\s\\s*/g, '');\n\n //add a trailing slash to the url if the user omitted it\n if(url[url.length-1] !== '/'){\n url += '/';\n }\n\n return url;\n };\n\n EsriLeaflet.Util.geojsonTypeToArcGIS = function (geoJsonType) {\n var arcgisGeometryType;\n switch (geoJsonType) {\n case 'Point':\n arcgisGeometryType = 'esriGeometryPoint';\n break;\n case 'MultiPoint':\n arcgisGeometryType = 'esriGeometryMultipoint';\n break;\n case 'LineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'MultiLineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'Polygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n case 'MultiPolygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n }\n return arcgisGeometryType;\n };\n\n})(EsriLeaflet);","(function(EsriLeaflet){\n\n var callbacks = 0;\n\n window._EsriLeafletCallbacks = {};\n\n function serialize(params){\n var data = '';\n\n params.f = 'json';\n\n for (var key in params){\n if(params.hasOwnProperty(key)){\n var param = params[key];\n var type = Object.prototype.toString.call(param);\n var value;\n\n if(data.length){\n data += '&';\n }\n\n if(type === '[object Array]' || type === '[object Object]'){\n value = JSON.stringify(param);\n } else if (type === '[object Date]'){\n value = param.valueOf();\n } else {\n value = param;\n }\n\n data += encodeURIComponent(key) + '=' + encodeURIComponent(value);\n }\n }\n\n return data;\n }\n\n function createRequest(callback, context){\n var httpRequest = new XMLHttpRequest();\n\n httpRequest.onerror = function(e) {\n callback.call(context, {\n error: {\n code: 500,\n message: 'XMLHttpRequest error'\n }\n }, null);\n };\n\n httpRequest.onreadystatechange = function(){\n var response;\n var error;\n\n if (httpRequest.readyState === 4) {\n try {\n response = JSON.parse(httpRequest.responseText);\n } catch(e) {\n response = null;\n error = {\n code: 500,\n message: 'Could not parse response as JSON.'\n };\n }\n\n if (!error && response.error) {\n error = response.error;\n response = null;\n }\n\n callback.call(context, error, response);\n }\n };\n\n return httpRequest;\n }\n\n // AJAX handlers for CORS (modern browsers) or JSONP (older browsers)\n EsriLeaflet.Request = {\n request: function(url, params, callback, context){\n var paramString = serialize(params);\n var httpRequest = createRequest(callback, context);\n var requestLength = (url + '?' + paramString).length;\n\n // request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest\n if(requestLength <= 2000 && L.esri.Support.CORS){\n httpRequest.open('GET', url + '?' + paramString);\n httpRequest.send(null);\n\n // request is less more then 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest\n } else if (requestLength > 2000 && L.esri.Support.CORS){\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(paramString);\n\n // request is less more then 2000 characters and the browser does not support CORS, make a JSONP request\n } else if(requestLength <= 2000 && !L.esri.Support.CORS){\n return L.esri.Request.get.JSONP(url, params, callback, context);\n\n // request is longer then 2000 characters and the browser does not support CORS, log a warning\n } else {\n if(console && console.warn){\n console.warn('a request to ' + url + ' 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');\n return;\n }\n }\n\n return httpRequest;\n },\n post: {\n XMLHTTP: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(serialize(params));\n\n return httpRequest;\n }\n },\n\n get: {\n CORS: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n\n httpRequest.open('GET', url + '?' + serialize(params), true);\n httpRequest.send(null);\n\n return httpRequest;\n },\n JSONP: function(url, params, callback, context){\n var callbackId = 'c' + callbacks;\n\n params.callback = 'window._EsriLeafletCallbacks.' + callbackId;\n\n var script = L.DomUtil.create('script', null, document.body);\n script.type = 'text/javascript';\n script.src = url + '?' + serialize(params);\n script.id = callbackId;\n\n window._EsriLeafletCallbacks[callbackId] = function(response){\n if(window._EsriLeafletCallbacks[callbackId] !== true){\n var error;\n var responseType = Object.prototype.toString.call(response);\n\n if(!(responseType === '[object Object]' || responseType === '[object Array]')){\n error = {\n error: {\n code: 500,\n message: 'Expected array or object as JSONP response'\n }\n };\n response = null;\n }\n\n if (!error && response.error) {\n error = response;\n response = null;\n }\n\n callback.call(context, error, response);\n window._EsriLeafletCallbacks[callbackId] = true;\n }\n };\n\n callbacks++;\n\n return {\n id: callbackId,\n url: script.src,\n abort: function(){\n window._EsriLeafletCallbacks._callback[callbackId]({\n code: 0,\n message: 'Request aborted.'\n });\n }\n };\n }\n }\n };\n\n // Choose the correct AJAX handler depending on CORS support\n EsriLeaflet.get = (EsriLeaflet.Support.CORS) ? EsriLeaflet.Request.get.CORS : EsriLeaflet.Request.get.JSONP;\n\n // Always use XMLHttpRequest for posts\n EsriLeaflet.post = EsriLeaflet.Request.post.XMLHTTP;\n\n // expose a common request method the uses GET\\POST based on request length\n EsriLeaflet.request = EsriLeaflet.Request.request;\n\n})(EsriLeaflet);","EsriLeaflet.Tasks.Task = L.Class.extend({\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n //Generate a method for each methodName:paramName in the setters for this task.\n generateSetter: function(param, context){\n var isArray = param.match(/([a-zA-Z]+)\\[\\]/);\n\n param = (isArray) ? isArray[1] : param;\n\n if(isArray){\n return L.Util.bind(function(value){\n // this.params[param] = (this.params[param]) ? this.params[param] + ',' : '';\n if (L.Util.isArray(value)) {\n this.params[param] = value.join(',');\n } else {\n this.params[param] = value;\n }\n return this;\n }, context);\n } else {\n return L.Util.bind(function(value){\n this.params[param] = value;\n return this;\n }, context);\n }\n },\n\n initialize: function(endpoint, options){\n // endpoint can be either a url to an ArcGIS Rest Service or an instance of EsriLeaflet.Service\n if(endpoint.url && endpoint.request){\n this._service = endpoint;\n this.url = endpoint.url;\n } else {\n this.url = EsriLeaflet.Util.cleanUrl(endpoint);\n }\n\n // clone default params into this object\n this.params = L.Util.extend({}, this.params || {});\n\n // generate setter methods based on the setters object implimented a child class\n if(this.setters){\n for (var setter in this.setters){\n var param = this.setters[setter];\n this[setter] = this.generateSetter(param, this);\n }\n }\n\n L.Util.setOptions(this, options);\n },\n\n token: function(token){\n if(this._service){\n this._service.authenticate(token);\n } else {\n this.params.token = token;\n }\n return this;\n },\n\n request: function(callback, context){\n if(this._service){\n return this._service.request(this.path, this.params, callback, context);\n } else {\n return this._request('request', this.path, this.params, callback, context);\n }\n },\n\n _request: function(method, path, params, callback, context){\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, callback, context);\n } else{\n return EsriLeaflet[method](url, params, callback, context);\n }\n }\n});","EsriLeaflet.Services.Service = L.Class.extend({\n\n includes: L.Mixin.Events,\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n initialize: function (url, options) {\n this.url = EsriLeaflet.Util.cleanUrl(url);\n this._requestQueue = [];\n this._authenticating = false;\n L.Util.setOptions(this, options);\n },\n\n get: function (path, params, callback, context) {\n return this._request('get', path, params, callback, context);\n },\n\n post: function (path, params, callback, context) {\n return this._request('post', path, params, callback, context);\n },\n\n request: function (path, params, callback, context) {\n return this._request('request', path, params, callback, context);\n },\n\n metadata: function (callback, context) {\n return this._request('get', '', {}, callback, context);\n },\n\n authenticate: function(token){\n this._authenticating = false;\n this.options.token = token;\n this._runQueue();\n return this;\n },\n\n _request: function(method, path, params, callback, context){\n this.fire('requeststart', {\n url: this.url + path,\n params: params,\n method: method\n });\n\n var wrappedCallback = this._createServiceCallback(method, path, params, callback, context);\n\n if (this.options.token) {\n params.token = this.options.token;\n }\n\n if (this._authenticating) {\n this._requestQueue.push([method, path, params, callback, context]);\n return;\n } else {\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, wrappedCallback);\n } else {\n return EsriLeaflet[method](url, params, wrappedCallback);\n }\n }\n },\n\n _createServiceCallback: function(method, path, params, callback, context){\n var request = [method, path, params, callback, context];\n\n return L.Util.bind(function(error, response){\n\n if (error && (error.code === 499 || error.code === 498)) {\n this._authenticating = true;\n\n this._requestQueue.push(request);\n\n this.fire('authenticationrequired', {\n authenticate: L.Util.bind(this.authenticate, this)\n });\n } else {\n callback.call(context, error, response);\n\n if(error) {\n this.fire('requesterror', {\n url: this.url + path,\n params: params,\n message: error.message,\n code: error.code,\n method: method\n });\n } else {\n this.fire('requestsuccess', {\n url: this.url + path,\n params: params,\n response: response,\n method: method\n });\n }\n\n this.fire('requestend', {\n url: this.url + path,\n params: params,\n method: method\n });\n }\n }, this);\n },\n\n _runQueue: function(){\n for (var i = this._requestQueue.length - 1; i >= 0; i--) {\n var request = this._requestQueue[i];\n var method = request.shift();\n this[method].apply(this, request);\n }\n this._requestQueue = [];\n }\n\n});\n\nEsriLeaflet.Services.service = function(url, params){\n return new EsriLeaflet.Services.Service(url, params);\n};"]} \ No newline at end of file diff --git a/dist/builds/feature-layer/esri-leaflet-feature-layer-src.js b/dist/builds/feature-layer/esri-leaflet-feature-layer-src.js new file mode 100644 index 000000000..e49b53399 --- /dev/null +++ b/dist/builds/feature-layer/esri-leaflet-feature-layer-src.js @@ -0,0 +1,2132 @@ +/*! esri-leaflet - v1.0.0-rc.3 - 2014-11-04 +* Copyright (c) 2014 Environmental Systems Research Institute, Inc. +* Apache License*/ +(function (factory) { + //define an AMD module that relies on 'leaflet' + if (typeof define === 'function' && define.amd) { + define(['leaflet'], function (L) { + return factory(L); + }); + //define a common js module that relies on 'leaflet' + } else if (typeof module === 'object' && typeof module.exports === 'object') { + module.exports = factory(require('leaflet')); + } + + if(typeof window !== 'undefined' && window.L){ + factory(window.L); + } +}(function (L) { +var EsriLeaflet = { //jshint ignore:line + VERSION: '1.0.0-rc.2', + Layers: {}, + Services: {}, + Controls: {}, + Tasks: {}, + Util: {}, + Support: { + CORS: !!(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()), + pointerEvents: document.documentElement.style.pointerEvents === '' + } +}; + +if(typeof window !== 'undefined' && window.L){ + window.L.esri = EsriLeaflet; +} + +(function(EsriLeaflet){ + + // shallow object clone for feature properties and attributes + // from http://jsperf.com/cloning-an-object/2 + function clone(obj) { + var target = {}; + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + target[i] = obj[i]; + } + } + return target; + } + + // checks if 2 x,y points are equal + function pointsEqual(a, b) { + for (var i = 0; i < a.length; i++) { + if (a[i] !== b[i]) { + return false; + } + } + return true; + } + + // checks if the first and last points of a ring are equal and closes the ring + function closeRing(coordinates) { + if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) { + coordinates.push(coordinates[0]); + } + return coordinates; + } + + // determine if polygon ring coordinates are clockwise. clockwise signifies outer ring, counter-clockwise an inner ring + // or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon- + // points-are-in-clockwise-order + function ringIsClockwise(ringToTest) { + var total = 0,i = 0; + var rLength = ringToTest.length; + var pt1 = ringToTest[i]; + var pt2; + for (i; i < rLength - 1; i++) { + pt2 = ringToTest[i + 1]; + total += (pt2[0] - pt1[0]) * (pt2[1] + pt1[1]); + pt1 = pt2; + } + return (total >= 0); + } + + // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L504-L519 + function vertexIntersectsVertex(a1, a2, b1, b2) { + var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]); + var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]); + var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]); + + if ( uB !== 0 ) { + var ua = uaT / uB; + var ub = ubT / uB; + + if ( 0 <= ua && ua <= 1 && 0 <= ub && ub <= 1 ) { + return true; + } + } + + return false; + } + + // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L521-L531 + function arrayIntersectsArray(a, b) { + for (var i = 0; i < a.length - 1; i++) { + for (var j = 0; j < b.length - 1; j++) { + if (vertexIntersectsVertex(a[i], a[i + 1], b[j], b[j + 1])) { + return true; + } + } + } + + return false; + } + + // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L470-L480 + function coordinatesContainPoint(coordinates, point) { + var contains = false; + for(var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) { + if (((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1]) || + (coordinates[j][1] <= point[1] && point[1] < coordinates[i][1])) && + (point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0])) { + contains = !contains; + } + } + return contains; + } + + // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L106-L113 + function coordinatesContainCoordinates(outer, inner){ + var intersects = arrayIntersectsArray(outer, inner); + var contains = coordinatesContainPoint(outer, inner[0]); + if(!intersects && contains){ + return true; + } + return false; + } + + // do any polygons in this array contain any other polygons in this array? + // used for checking for holes in arcgis rings + // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L117-L172 + function convertRingsToGeoJSON(rings){ + var outerRings = []; + var holes = []; + var x; // iterator + var outerRing; // current outer ring being evaluated + var hole; // current hole being evaluated + + // for each ring + for (var r = 0; r < rings.length; r++) { + var ring = closeRing(rings[r].slice(0)); + if(ring.length < 4){ + continue; + } + // is this ring an outer ring? is it clockwise? + if(ringIsClockwise(ring)){ + var polygon = [ ring ]; + outerRings.push(polygon); // push to outer rings + } else { + holes.push(ring); // counterclockwise push to holes + } + } + + var uncontainedHoles = []; + + // while there are holes left... + while(holes.length){ + // pop a hole off out stack + hole = holes.pop(); + + // loop over all outer rings and see if they contain our hole. + var contained = false; + for (x = outerRings.length - 1; x >= 0; x--) { + outerRing = outerRings[x][0]; + if(coordinatesContainCoordinates(outerRing, hole)){ + // the hole is contained push it into our polygon + outerRings[x].push(hole); + contained = true; + break; + } + } + + // ring is not contained in any outer ring + // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320 + if(!contained){ + uncontainedHoles.push(hole); + } + } + + // if we couldn't match any holes using contains we can try intersects... + while(uncontainedHoles.length){ + // pop a hole off out stack + hole = uncontainedHoles.pop(); + + // loop over all outer rings and see if any intersect our hole. + var intersects = false; + for (x = outerRings.length - 1; x >= 0; x--) { + outerRing = outerRings[x][0]; + if(arrayIntersectsArray(outerRing, hole)){ + // the hole is contained push it into our polygon + outerRings[x].push(hole); + intersects = true; + break; + } + } + + if(!intersects) { + outerRings.push([hole.reverse()]); + } + } + + if(outerRings.length === 1){ + return { + type: 'Polygon', + coordinates: outerRings[0] + }; + } else { + return { + type: 'MultiPolygon', + coordinates: outerRings + }; + } + } + + // This function ensures that rings are oriented in the right directions + // outer rings are clockwise, holes are counterclockwise + // used for converting GeoJSON Polygons to ArcGIS Polygons + function orientRings(poly){ + var output = []; + var polygon = poly.slice(0); + var outerRing = closeRing(polygon.shift().slice(0)); + if(outerRing.length >= 4){ + if(!ringIsClockwise(outerRing)){ + outerRing.reverse(); + } + + output.push(outerRing); + + for (var i = 0; i < polygon.length; i++) { + var hole = closeRing(polygon[i].slice(0)); + if(hole.length >= 4){ + if(ringIsClockwise(hole)){ + hole.reverse(); + } + output.push(hole); + } + } + } + + return output; + } + + // This function flattens holes in multipolygons to one array of polygons + // used for converting GeoJSON Polygons to ArcGIS Polygons + function flattenMultiPolygonRings(rings){ + var output = []; + for (var i = 0; i < rings.length; i++) { + var polygon = orientRings(rings[i]); + for (var x = polygon.length - 1; x >= 0; x--) { + var ring = polygon[x].slice(0); + output.push(ring); + } + } + return output; + } + + // convert an extent (ArcGIS) to LatLngBounds (Leaflet) + EsriLeaflet.Util.extentToBounds = function(extent){ + var sw = new L.LatLng(extent.ymin, extent.xmin); + var ne = new L.LatLng(extent.ymax, extent.xmax); + return new L.LatLngBounds(sw, ne); + }; + + // convert an LatLngBounds (Leaflet) to extent (ArcGIS) + EsriLeaflet.Util.boundsToExtent = function(bounds) { + bounds = L.latLngBounds(bounds); + return { + 'xmin': bounds.getSouthWest().lng, + 'ymin': bounds.getSouthWest().lat, + 'xmax': bounds.getNorthEast().lng, + 'ymax': bounds.getNorthEast().lat, + 'spatialReference': { + 'wkid' : 4326 + } + }; + }; + + EsriLeaflet.Util.arcgisToGeojson = function (arcgis, idAttribute){ + var geojson = {}; + + if(typeof arcgis.x === 'number' && typeof arcgis.y === 'number'){ + geojson.type = 'Point'; + geojson.coordinates = [arcgis.x, arcgis.y]; + } + + if(arcgis.points){ + geojson.type = 'MultiPoint'; + geojson.coordinates = arcgis.points.slice(0); + } + + if(arcgis.paths) { + if(arcgis.paths.length === 1){ + geojson.type = 'LineString'; + geojson.coordinates = arcgis.paths[0].slice(0); + } else { + geojson.type = 'MultiLineString'; + geojson.coordinates = arcgis.paths.slice(0); + } + } + + if(arcgis.rings) { + geojson = convertRingsToGeoJSON(arcgis.rings.slice(0)); + } + + if(arcgis.geometry || arcgis.attributes) { + geojson.type = 'Feature'; + geojson.geometry = (arcgis.geometry) ? EsriLeaflet.Util.arcgisToGeojson(arcgis.geometry) : null; + geojson.properties = (arcgis.attributes) ? clone(arcgis.attributes) : null; + if(arcgis.attributes) { + geojson.id = arcgis.attributes[idAttribute] || arcgis.attributes.OBJECTID || arcgis.attributes.FID; + } + } + + return geojson; + }; + + // GeoJSON -> ArcGIS + EsriLeaflet.Util.geojsonToArcGIS = function(geojson, idAttribute){ + idAttribute = idAttribute || 'OBJECTID'; + var spatialReference = { wkid: 4326 }; + var result = {}; + var i; + + switch(geojson.type){ + case 'Point': + result.x = geojson.coordinates[0]; + result.y = geojson.coordinates[1]; + result.spatialReference = spatialReference; + break; + case 'MultiPoint': + result.points = geojson.coordinates.slice(0); + result.spatialReference = spatialReference; + break; + case 'LineString': + result.paths = [geojson.coordinates.slice(0)]; + result.spatialReference = spatialReference; + break; + case 'MultiLineString': + result.paths = geojson.coordinates.slice(0); + result.spatialReference = spatialReference; + break; + case 'Polygon': + result.rings = orientRings(geojson.coordinates.slice(0)); + result.spatialReference = spatialReference; + break; + case 'MultiPolygon': + result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0)); + result.spatialReference = spatialReference; + break; + case 'Feature': + if(geojson.geometry) { + result.geometry = EsriLeaflet.Util.geojsonToArcGIS(geojson.geometry, idAttribute); + } + result.attributes = (geojson.properties) ? clone(geojson.properties) : {}; + if(geojson.id){ + result.attributes[idAttribute] = geojson.id; + } + break; + case 'FeatureCollection': + result = []; + for (i = 0; i < geojson.features.length; i++){ + result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.features[i], idAttribute)); + } + break; + case 'GeometryCollection': + result = []; + for (i = 0; i < geojson.geometries.length; i++){ + result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.geometries[i], idAttribute)); + } + break; + } + + return result; + }; + + EsriLeaflet.Util.responseToFeatureCollection = function(response, idAttribute){ + var objectIdField; + + if(idAttribute){ + objectIdField = idAttribute; + } else if(response.objectIdFieldName){ + objectIdField = response.objectIdFieldName; + } else if(response.fields) { + for (var j = 0; j <= response.fields.length - 1; j++) { + if(response.fields[j].type === 'esriFieldTypeOID') { + objectIdField = response.fields[j].name; + break; + } + } + } else { + objectIdField = 'OBJECTID'; + } + + var featureCollection = { + type: 'FeatureCollection', + features: [] + }; + var features = response.features || response.results; + if(features.length){ + for (var i = features.length - 1; i >= 0; i--) { + featureCollection.features.push(EsriLeaflet.Util.arcgisToGeojson(features[i], objectIdField)); + } + } + + return featureCollection; + }; + + // trim whitespace and add a tailing slash is needed to a url + EsriLeaflet.Util.cleanUrl = function(url){ + url = url.replace(/\s\s*/g, ''); + + //add a trailing slash to the url if the user omitted it + if(url[url.length-1] !== '/'){ + url += '/'; + } + + return url; + }; + + EsriLeaflet.Util.geojsonTypeToArcGIS = function (geoJsonType) { + var arcgisGeometryType; + switch (geoJsonType) { + case 'Point': + arcgisGeometryType = 'esriGeometryPoint'; + break; + case 'MultiPoint': + arcgisGeometryType = 'esriGeometryMultipoint'; + break; + case 'LineString': + arcgisGeometryType = 'esriGeometryPolyline'; + break; + case 'MultiLineString': + arcgisGeometryType = 'esriGeometryPolyline'; + break; + case 'Polygon': + arcgisGeometryType = 'esriGeometryPolygon'; + break; + case 'MultiPolygon': + arcgisGeometryType = 'esriGeometryPolygon'; + break; + } + return arcgisGeometryType; + }; + +})(EsriLeaflet); + +(function(EsriLeaflet){ + + var callbacks = 0; + + window._EsriLeafletCallbacks = {}; + + function serialize(params){ + var data = ''; + + params.f = 'json'; + + for (var key in params){ + if(params.hasOwnProperty(key)){ + var param = params[key]; + var type = Object.prototype.toString.call(param); + var value; + + if(data.length){ + data += '&'; + } + + if(type === '[object Array]' || type === '[object Object]'){ + value = JSON.stringify(param); + } else if (type === '[object Date]'){ + value = param.valueOf(); + } else { + value = param; + } + + data += encodeURIComponent(key) + '=' + encodeURIComponent(value); + } + } + + return data; + } + + function createRequest(callback, context){ + var httpRequest = new XMLHttpRequest(); + + httpRequest.onerror = function(e) { + callback.call(context, { + error: { + code: 500, + message: 'XMLHttpRequest error' + } + }, null); + }; + + httpRequest.onreadystatechange = function(){ + var response; + var error; + + if (httpRequest.readyState === 4) { + try { + response = JSON.parse(httpRequest.responseText); + } catch(e) { + response = null; + error = { + code: 500, + message: 'Could not parse response as JSON.' + }; + } + + if (!error && response.error) { + error = response.error; + response = null; + } + + callback.call(context, error, response); + } + }; + + return httpRequest; + } + + // AJAX handlers for CORS (modern browsers) or JSONP (older browsers) + EsriLeaflet.Request = { + request: function(url, params, callback, context){ + var paramString = serialize(params); + var httpRequest = createRequest(callback, context); + var requestLength = (url + '?' + paramString).length; + + // request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest + if(requestLength <= 2000 && L.esri.Support.CORS){ + httpRequest.open('GET', url + '?' + paramString); + httpRequest.send(null); + + // request is less more then 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest + } else if (requestLength > 2000 && L.esri.Support.CORS){ + httpRequest.open('POST', url); + httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + httpRequest.send(paramString); + + // request is less more then 2000 characters and the browser does not support CORS, make a JSONP request + } else if(requestLength <= 2000 && !L.esri.Support.CORS){ + return L.esri.Request.get.JSONP(url, params, callback, context); + + // request is longer then 2000 characters and the browser does not support CORS, log a warning + } else { + if(console && console.warn){ + console.warn('a request to ' + url + ' 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'); + return; + } + } + + return httpRequest; + }, + post: { + XMLHTTP: function (url, params, callback, context) { + var httpRequest = createRequest(callback, context); + httpRequest.open('POST', url); + httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + httpRequest.send(serialize(params)); + + return httpRequest; + } + }, + + get: { + CORS: function (url, params, callback, context) { + var httpRequest = createRequest(callback, context); + + httpRequest.open('GET', url + '?' + serialize(params), true); + httpRequest.send(null); + + return httpRequest; + }, + JSONP: function(url, params, callback, context){ + 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){ + if(window._EsriLeafletCallbacks[callbackId] !== true){ + var error; + var responseType = Object.prototype.toString.call(response); + + if(!(responseType === '[object Object]' || responseType === '[object Array]')){ + error = { + error: { + code: 500, + message: 'Expected array or object as JSONP response' + } + }; + response = null; + } + + if (!error && response.error) { + error = response; + response = null; + } + + callback.call(context, error, response); + window._EsriLeafletCallbacks[callbackId] = true; + } + }; + + callbacks++; + + return { + id: callbackId, + url: script.src, + abort: function(){ + window._EsriLeafletCallbacks._callback[callbackId]({ + code: 0, + message: 'Request aborted.' + }); + } + }; + } + } + }; + + // Choose the correct AJAX handler depending on CORS support + EsriLeaflet.get = (EsriLeaflet.Support.CORS) ? EsriLeaflet.Request.get.CORS : EsriLeaflet.Request.get.JSONP; + + // Always use XMLHttpRequest for posts + EsriLeaflet.post = EsriLeaflet.Request.post.XMLHTTP; + + // expose a common request method the uses GET\POST based on request length + EsriLeaflet.request = EsriLeaflet.Request.request; + +})(EsriLeaflet); + +EsriLeaflet.Services.Service = L.Class.extend({ + + includes: L.Mixin.Events, + + options: { + proxy: false, + useCors: EsriLeaflet.Support.CORS + }, + + initialize: function (url, options) { + this.url = EsriLeaflet.Util.cleanUrl(url); + this._requestQueue = []; + this._authenticating = false; + L.Util.setOptions(this, options); + }, + + get: function (path, params, callback, context) { + return this._request('get', path, params, callback, context); + }, + + post: function (path, params, callback, context) { + return this._request('post', path, params, callback, context); + }, + + request: function (path, params, callback, context) { + return this._request('request', path, params, callback, context); + }, + + metadata: function (callback, context) { + return this._request('get', '', {}, callback, context); + }, + + authenticate: function(token){ + this._authenticating = false; + this.options.token = token; + this._runQueue(); + return this; + }, + + _request: function(method, path, params, callback, context){ + this.fire('requeststart', { + url: this.url + path, + params: params, + method: method + }); + + var wrappedCallback = this._createServiceCallback(method, path, params, callback, context); + + if (this.options.token) { + params.token = this.options.token; + } + + if (this._authenticating) { + this._requestQueue.push([method, path, params, callback, context]); + return; + } else { + var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path; + + if((method === 'get' || method === 'request') && !this.options.useCors){ + return EsriLeaflet.Request.get.JSONP(url, params, wrappedCallback); + } else { + return EsriLeaflet[method](url, params, wrappedCallback); + } + } + }, + + _createServiceCallback: function(method, path, params, callback, context){ + var request = [method, path, params, callback, context]; + + return L.Util.bind(function(error, response){ + + if (error && (error.code === 499 || error.code === 498)) { + this._authenticating = true; + + this._requestQueue.push(request); + + this.fire('authenticationrequired', { + authenticate: L.Util.bind(this.authenticate, this) + }); + } else { + callback.call(context, error, response); + + if(error) { + this.fire('requesterror', { + url: this.url + path, + params: params, + message: error.message, + code: error.code, + method: method + }); + } else { + this.fire('requestsuccess', { + url: this.url + path, + params: params, + response: response, + method: method + }); + } + + this.fire('requestend', { + url: this.url + path, + params: params, + method: method + }); + } + }, this); + }, + + _runQueue: function(){ + for (var i = this._requestQueue.length - 1; i >= 0; i--) { + var request = this._requestQueue[i]; + var method = request.shift(); + this[method].apply(this, request); + } + this._requestQueue = []; + } + +}); + +EsriLeaflet.Services.service = function(url, params){ + return new EsriLeaflet.Services.Service(url, params); +}; + +EsriLeaflet.Services.FeatureLayer = EsriLeaflet.Services.Service.extend({ + + options: { + idAttribute: 'OBJECTID' + }, + + query: function(){ + return new EsriLeaflet.Tasks.Query(this); + }, + + addFeature: function(feature, callback, context) { + delete feature.id; + + feature = EsriLeaflet.Util.geojsonToArcGIS(feature); + + return this.post('addFeatures', { + features: [feature] + }, function(error, response){ + var result = (response && response.addResults) ? response.addResults[0] : undefined; + if(callback){ + callback.call(this, error || response.addResults[0].error, result); + } + }, context); + }, + + updateFeature: function(feature, callback, context) { + feature = EsriLeaflet.Util.geojsonToArcGIS(feature, this.options.idAttribute); + + return this.post('updateFeatures', { + features: [feature] + }, function(error, response){ + var result = (response && response.updateResults) ? response.updateResults[0] : undefined; + if(callback){ + callback.call(context, error || response.updateResults[0].error, result); + } + }, context); + }, + + deleteFeature: function(id, callback, context) { + return this.post('deleteFeatures', { + objectIds: id + }, function(error, response){ + var result = (response && response.deleteResults) ? response.deleteResults[0] : undefined; + if(callback){ + callback.call(context, error || response.deleteResults[0].error, result); + } + }, context); + } + +}); + +EsriLeaflet.Services.featureLayer = function(url, options) { + return new EsriLeaflet.Services.FeatureLayer(url, options); +}; + +EsriLeaflet.Tasks.Task = L.Class.extend({ + + options: { + proxy: false, + useCors: EsriLeaflet.Support.CORS + }, + + //Generate a method for each methodName:paramName in the setters for this task. + generateSetter: function(param, context){ + var isArray = param.match(/([a-zA-Z]+)\[\]/); + + param = (isArray) ? isArray[1] : param; + + if(isArray){ + return L.Util.bind(function(value){ + // this.params[param] = (this.params[param]) ? this.params[param] + ',' : ''; + if (L.Util.isArray(value)) { + this.params[param] = value.join(','); + } else { + this.params[param] = value; + } + return this; + }, context); + } else { + return L.Util.bind(function(value){ + this.params[param] = value; + return this; + }, context); + } + }, + + initialize: function(endpoint, options){ + // endpoint can be either a url to an ArcGIS Rest Service or an instance of EsriLeaflet.Service + if(endpoint.url && endpoint.request){ + this._service = endpoint; + this.url = endpoint.url; + } else { + this.url = EsriLeaflet.Util.cleanUrl(endpoint); + } + + // clone default params into this object + this.params = L.Util.extend({}, this.params || {}); + + // generate setter methods based on the setters object implimented a child class + if(this.setters){ + for (var setter in this.setters){ + var param = this.setters[setter]; + this[setter] = this.generateSetter(param, this); + } + } + + L.Util.setOptions(this, options); + }, + + token: function(token){ + if(this._service){ + this._service.authenticate(token); + } else { + this.params.token = token; + } + return this; + }, + + request: function(callback, context){ + if(this._service){ + return this._service.request(this.path, this.params, callback, context); + } else { + return this._request('request', this.path, this.params, callback, context); + } + }, + + _request: function(method, path, params, callback, context){ + var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path; + if((method === 'get' || method === 'request') && !this.options.useCors){ + return EsriLeaflet.Request.get.JSONP(url, params, callback, context); + } else{ + return EsriLeaflet[method](url, params, callback, context); + } + } +}); + +EsriLeaflet.Tasks.Query = EsriLeaflet.Tasks.Task.extend({ + setters: { + 'offset': 'offset', + 'limit': 'limit', + 'outFields': 'fields[]', + 'precision': 'geometryPrecision', + 'featureIds': 'objectIds[]', + 'returnGeometry': 'returnGeometry', + 'token': 'token' + }, + + path: 'query', + + params: { + returnGeometry: true, + where: '1=1', + outSr: 4326, + outFields: '*' + }, + + within: function(geometry){ + this._setGeometry(geometry); + this.params.spatialRel = 'esriSpatialRelContains'; // will make code read layer within geometry, to the api this will reads geometry contains layer + return this; + }, + + intersects: function(geometry){ + this._setGeometry(geometry); + this.params.spatialRel = 'esriSpatialRelIntersects'; + return this; + }, + + contains: function(geometry){ + this._setGeometry(geometry); + this.params.spatialRel = 'esriSpatialRelWithin'; // will make code read layer contains geometry, to the api this will reads geometry within layer + return this; + }, + + // crosses: function(geometry){ + // this._setGeometry(geometry); + // this.params.spatialRel = 'esriSpatialRelCrosses'; + // return this; + // }, + + // touches: function(geometry){ + // this._setGeometry(geometry); + // this.params.spatialRel = 'esriSpatialRelTouches'; + // return this; + // }, + + overlaps: function(geometry){ + this._setGeometry(geometry); + this.params.spatialRel = 'esriSpatialRelOverlaps'; + return this; + }, + + // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online + nearby: function(latlng, radius){ + latlng = L.latLng(latlng); + this.params.geometry = ([latlng.lng,latlng.lat]).join(','); + this.params.geometryType = 'esriGeometryPoint'; + this.params.spatialRel = 'esriSpatialRelIntersects'; + this.params.units = 'esriSRUnit_Meter'; + this.params.distance = radius; + this.params.inSr = 4326; + return this; + }, + + where: function(string){ + this.params.where = string.replace(/"/g, "\'"); // jshint ignore:line + return this; + }, + + between: function(start, end){ + this.params.time = ([start.valueOf(), end.valueOf()]).join(); + return this; + }, + + fields: function (fields) { + if (L.Util.isArray(fields)) { + this.params.outFields = fields.join(','); + } else { + this.params.outFields = fields; + } + return this; + }, + + simplify: function(map, factor){ + var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast()); + this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor; + return this; + }, + + orderBy: function(fieldName, order){ + order = order || 'ASC'; + this.params.orderByFields = (this.params.orderByFields) ? this.params.orderByFields + ',' : ''; + this.params.orderByFields += ([fieldName, order]).join(' '); + return this; + }, + + returnGeometry: function(bool){ + this.params.returnGeometry = bool; + return this; + }, + + run: function(callback, context){ + this._cleanParams(); + return this.request(function(error, response){ + callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response); + }, context); + }, + + count: function(callback, context){ + this._cleanParams(); + this.params.returnCountOnly = true; + return this.request(function(error, response){ + callback.call(this, error, (response && response.count), response); + }, context); + }, + + ids: function(callback, context){ + this._cleanParams(); + this.params.returnIdsOnly = true; + return this.request(function(error, response){ + callback.call(this, error, (response && response.objectIds), response); + }, context); + }, + + // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online + bounds: function(callback, context){ + this._cleanParams(); + this.params.returnExtentOnly = true; + return this.request(function(error, response){ + callback.call(context, error, (response && response.extent && EsriLeaflet.Util.extentToBounds(response.extent)), response); + }, context); + }, + + // only valid for image services + pixelSize: function(point){ + point = L.point(point); + this.params.pixelSize = ([point.x,point.y]).join(','); + return this; + }, + + // only valid for map services + layer: function(layer){ + this.path = layer + '/query'; + return this; + }, + + _cleanParams: function(){ + delete this.params.returnIdsOnly; + delete this.params.returnExtentOnly; + delete this.params.returnCountOnly; + }, + + _setGeometry: function(geometry) { + this.params.inSr = 4326; + + // convert bounds to extent and finish + if ( geometry instanceof L.LatLngBounds ) { + // set geometry + geometryType + this.params.geometry = EsriLeaflet.Util.boundsToExtent(geometry); + this.params.geometryType = 'esriGeometryEnvelope'; + return; + } + + // convert L.Marker > L.LatLng + if(geometry.getLatLng){ + geometry = geometry.getLatLng(); + } + + // convert L.LatLng to a geojson point and continue; + if (geometry instanceof L.LatLng) { + geometry = { + type: 'Point', + coordinates: [geometry.lng, geometry.lat] + }; + } + + // handle L.GeoJSON, pull out the first geometry + if ( geometry instanceof L.GeoJSON ) { + //reassign geometry to the GeoJSON value (we are assuming that only one feature is present) + geometry = geometry.getLayers()[0].feature.geometry; + this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry); + this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type); + } + + // Handle L.Polyline and L.Polygon + if (geometry.toGeoJSON) { + geometry = geometry.toGeoJSON(); + } + + // handle GeoJSON feature by pulling out the geometry + if ( geometry.type === 'Feature' ) { + // get the geometry of the geojson feature + geometry = geometry.geometry; + } + + // confirm that our GeoJSON is a point, line or polygon + if ( geometry.type === 'Point' || geometry.type === 'LineString' || geometry.type === 'Polygon') { + this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry); + this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type); + return; + } + + // warn the user if we havn't found a + /* global console */ + if(console && console.warn) { + console.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'); + } + + return; + } +}); + +EsriLeaflet.Tasks.query = function(url, params){ + return new EsriLeaflet.Tasks.Query(url, params); +}; + +EsriLeaflet.Layers.FeatureGrid = L.Class.extend({ + + includes: L.Mixin.Events, + + options: { + cellSize: 512, + updateInterval: 150 + }, + + initialize: function (options) { + options = L.setOptions(this, options); + }, + + onAdd: function (map) { + this._map = map; + this._update = L.Util.limitExecByInterval(this._update, this.options.updateInterval, this); + + // @TODO remove for leaflet 0.8 + this._map.addEventListener(this.getEvents(), this); + + this._reset(); + this._update(); + }, + + onRemove: function(){ + this._map.removeEventListener(this.getEvents(), this); + this._removeCells(); + }, + + getEvents: function () { + var events = { + viewreset: this._reset, + moveend: this._update + }; + + return events; + }, + + addTo: function(map){ + map.addLayer(this); + return this; + }, + + removeFrom: function(map){ + map.removeLayer(this); + return this; + }, + + _reset: function () { + this._removeCells(); + + this._cells = {}; + this._activeCells = {}; + this._cellsToLoad = 0; + this._cellsTotal = 0; + + // @TODO enable at Leaflet 0.8 + // this._cellNumBounds = this._getCellNumBounds(); + + this._resetWrap(); + }, + + _resetWrap: function () { + var map = this._map, + crs = map.options.crs; + + if (crs.infinite) { return; } + + var cellSize = this._getCellSize(); + + if (crs.wrapLng) { + this._wrapLng = [ + Math.floor(map.project([0, crs.wrapLng[0]]).x / cellSize), + Math.ceil(map.project([0, crs.wrapLng[1]]).x / cellSize) + ]; + } + + if (crs.wrapLat) { + this._wrapLat = [ + Math.floor(map.project([crs.wrapLat[0], 0]).y / cellSize), + Math.ceil(map.project([crs.wrapLat[1], 0]).y / cellSize) + ]; + } + }, + + _getCellSize: function () { + return this.options.cellSize; + }, + + _update: function () { + if (!this._map) { return; } + + var bounds = this._map.getPixelBounds(), + zoom = this._map.getZoom(), + cellSize = this._getCellSize(); + + if (zoom > this.options.maxZoom || + zoom < this.options.minZoom) { return; } + + // cell coordinates range for the current view + var cellBounds = L.bounds( + bounds.min.divideBy(cellSize).floor(), + bounds.max.divideBy(cellSize).floor()); + + this._addCells(cellBounds); + this._removeOtherCells(cellBounds); + }, + + _addCells: function (bounds) { + var queue = [], + center = bounds.getCenter(), + zoom = this._map.getZoom(); + + var j, i, coords; + // create a queue of coordinates to load cells from + for (j = bounds.min.y; j <= bounds.max.y; j++) { + for (i = bounds.min.x; i <= bounds.max.x; i++) { + coords = new L.Point(i, j); + coords.z = zoom; + + // @TODO enable at Leaflet 0.8 + // if (this._isValidCell(coords)) { + // queue.push(coords); + // } + + queue.push(coords); + } + } + var cellsToLoad = queue.length; + + if (cellsToLoad === 0) { return; } + + this._cellsToLoad += cellsToLoad; + this._cellsTotal += cellsToLoad; + + // sort cell queue to load cells in order of their distance to center + queue.sort(function (a, b) { + return a.distanceTo(center) - b.distanceTo(center); + }); + + for (i = 0; i < cellsToLoad; i++) { + this._addCell(queue[i]); + } + }, + + // @TODO enable at Leaflet 0.8 + // _isValidCell: function (coords) { + // var crs = this._map.options.crs; + + // if (!crs.infinite) { + // // don't load cell if it's out of bounds and not wrapped + // var bounds = this._cellNumBounds; + // if ( + // (!crs.wrapLng && (coords.x < bounds.min.x || coords.x > bounds.max.x)) || + // (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y)) + // ) { + // return false; + // } + // } + + // if (!this.options.bounds) { + // return true; + // } + + // // don't load cell if it doesn't intersect the bounds in options + // var cellBounds = this._cellCoordsToBounds(coords); + // return L.latLngBounds(this.options.bounds).intersects(cellBounds); + // }, + + // converts cell coordinates to its geographical bounds + _cellCoordsToBounds: function (coords) { + var map = this._map, + cellSize = this.options.cellSize, + + nwPoint = coords.multiplyBy(cellSize), + sePoint = nwPoint.add([cellSize, cellSize]), + + // @TODO for Leaflet 0.8 + // nw = map.wrapLatLng(map.unproject(nwPoint, coords.z)), + // se = map.wrapLatLng(map.unproject(sePoint, coords.z)); + + nw = map.unproject(nwPoint, coords.z).wrap(), + se = map.unproject(sePoint, coords.z).wrap(); + + return new L.LatLngBounds(nw, se); + }, + + // converts cell coordinates to key for the cell cache + _cellCoordsToKey: function (coords) { + return coords.x + ':' + coords.y; + }, + + // converts cell cache key to coordiantes + _keyToCellCoords: function (key) { + var kArr = key.split(':'), + x = parseInt(kArr[0], 10), + y = parseInt(kArr[1], 10); + + return new L.Point(x, y); + }, + + // remove any present cells that are off the specified bounds + _removeOtherCells: function (bounds) { + for (var key in this._cells) { + if (!bounds.contains(this._keyToCellCoords(key))) { + this._removeCell(key); + } + } + }, + + _removeCell: function (key) { + var cell = this._activeCells[key]; + if(cell){ + delete this._activeCells[key]; + + if (this.cellLeave) { + this.cellLeave(cell.bounds, cell.coords); + } + + this.fire('cellleave', { + bounds: cell.bounds, + coords: cell.coords + }); + } + }, + + _removeCells: function(){ + for (var key in this._cells) { + var bounds = this._cells[key].bounds; + var coords = this._cells[key].coords; + + if (this.cellLeave) { + this.cellLeave(bounds, coords); + } + + this.fire('cellleave', { + bounds: bounds, + coords: coords + }); + } + }, + + _addCell: function (coords) { + + // wrap cell coords if necessary (depending on CRS) + this._wrapCoords(coords); + + // generate the cell key + var key = this._cellCoordsToKey(coords); + + // get the cell from the cache + var cell = this._cells[key]; + // if this cell should be shown as isnt active yet (enter) + + if (cell && !this._activeCells[key]) { + if (this.cellEnter) { + this.cellEnter(cell.bounds, coords); + } + + this.fire('cellenter', { + bounds: cell.bounds, + coords: coords + }); + + this._activeCells[key] = cell; + } + + // if we dont have this cell in the cache yet (create) + if (!cell) { + cell = { + coords: coords, + bounds: this._cellCoordsToBounds(coords) + }; + + this._cells[key] = cell; + this._activeCells[key] = cell; + + if(this.createCell){ + this.createCell(cell.bounds, coords); + } + + this.fire('cellcreate', { + bounds: cell.bounds, + coords: coords + }); + } + }, + + _wrapCoords: function (coords) { + coords.x = this._wrapLng ? L.Util.wrapNum(coords.x, this._wrapLng) : coords.x; + coords.y = this._wrapLat ? L.Util.wrapNum(coords.y, this._wrapLat) : coords.y; + } + + // get the global cell coordinates range for the current zoom + // @TODO enable at Leaflet 0.8 + // _getCellNumBounds: function () { + // // @TODO for Leaflet 0.8 + // // var bounds = this._map.getPixelWorldBounds(), + // // size = this._getCellSize(); + // // + // // return bounds ? L.bounds( + // // bounds.min.divideBy(size).floor(), + // // bounds.max.divideBy(size).ceil().subtract([1, 1])) : null; + // } + +}); + +(function(EsriLeaflet){ + + EsriLeaflet.Layers.FeatureManager = EsriLeaflet.Layers.FeatureGrid.extend({ + + /** + * Options + */ + + options: { + where: '1=1', + fields: ['*'], + from: false, + to: false, + timeField: false, + timeFilterMode: 'server', + simplifyFactor: 0, + precision: 6 + }, + + /** + * Constructor + */ + + initialize: function (url, options) { + EsriLeaflet.Layers.FeatureGrid.prototype.initialize.call(this, options); + + options = L.setOptions(this, options); + + this.url = EsriLeaflet.Util.cleanUrl(url); + + this._service = new EsriLeaflet.Services.FeatureLayer(this.url, options); + + //use case insensitive regex to look for common fieldnames used for indexing + /*global console */ + if (this.options.fields[0] !== '*'){ + var oidCheck = false; + for (var i = 0; i < this.options.fields.length; i++){ + if (this.options.fields[i].match(/^(OBJECTID|FID|OID|ID)$/i)){ + oidCheck = true; + } + } + if (oidCheck === false && console && console.warn){ + console.warn('no known esriFieldTypeOID field detected in fields Array. Please add an attribute field containing unique IDs to ensure the layer can be drawn correctly.'); + } + } + + // Leaflet 0.8 change to new propagation + this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', function (e) { + e = L.extend({ + target: this + }, e); + this.fire(e.type, e); + }, this); + + if(this.options.timeField.start && this.options.timeField.end){ + this._startTimeIndex = new BinarySearchIndex(); + this._endTimeIndex = new BinarySearchIndex(); + } else if(this.options.timeField){ + this._timeIndex = new BinarySearchIndex(); + } + + this._currentSnapshot = []; // cache of what layers should be active + this._activeRequests = 0; + this._pendingRequests = []; + }, + + /** + * Layer Interface + */ + + onAdd: function(map){ + return EsriLeaflet.Layers.FeatureGrid.prototype.onAdd.call(this, map); + }, + + onRemove: function(map){ + return EsriLeaflet.Layers.FeatureGrid.prototype.onRemove.call(this, map); + }, + + getAttribution: function () { + return this.options.attribution; + }, + + /** + * Feature Managment + */ + + createCell: function(bounds, coords){ + this._requestFeatures(bounds, coords); + }, + + _requestFeatures: function(bounds, coords, callback){ + this._activeRequests++; + + // our first active request fires loading + if(this._activeRequests === 1){ + this.fire('loading', { + bounds: bounds + }); + } + + return this._buildQuery(bounds).run(function(error, featureCollection, response){ + if(response && response.exceededTransferLimit){ + this.fire('drawlimitexceeded'); + } + + //deincriment the request counter + this._activeRequests--; + + if(!error && featureCollection.features.length){ + this._addFeatures(featureCollection.features, coords); + } + + if(callback){ + callback.call(this, error, featureCollection); + } + + // if there are no more active requests fire a load event for this view + if(this._activeRequests <= 0){ + this.fire('load', { + bounds: bounds + }); + } + }, this); + }, + + _addFeatures: function(features){ + for (var i = features.length - 1; i >= 0; i--) { + var id = features[i].id; + this._currentSnapshot.push(id); + } + + if(this.options.timeField){ + this._buildTimeIndexes(features); + } + + this.createLayers(features); + }, + + _buildQuery: function(bounds){ + var query = this._service.query().intersects(bounds).where(this.options.where).fields(this.options.fields).precision(this.options.precision); + + if(this.options.simplifyFactor){ + query.simplify(this._map, this.options.simplifyFactor); + } + + if(this.options.timeFilterMode === 'server' && this.options.from && this.options.to){ + query.between(this.options.from, this.options.to); + } + + return query; + }, + + /** + * Where Methods + */ + + setWhere: function(where, callback, context){ + + this.options.where = (where && where.length) ? where : '1=1'; + + var oldSnapshot = []; + var newShapshot = []; + var pendingRequests = 0; + var requestError = null; + var requestCallback = L.Util.bind(function(error, featureCollection){ + if(error){ + requestError = error; + } + + if(featureCollection){ + for (var i = featureCollection.features.length - 1; i >= 0; i--) { + newShapshot.push(featureCollection.features[i].id); + } + } + + pendingRequests--; + + if(pendingRequests <= 0){ + this._currentSnapshot = newShapshot; + this.removeLayers(oldSnapshot); + this.addLayers(newShapshot); + if(callback) { + callback.call(context, requestError); + } + } + }, this); + + for (var i = this._currentSnapshot.length - 1; i >= 0; i--) { + oldSnapshot.push(this._currentSnapshot[i]); + } + + for(var key in this._activeCells){ + pendingRequests++; + var coords = this._keyToCellCoords(key); + var bounds = this._cellCoordsToBounds(coords); + this._requestFeatures(bounds, key, requestCallback); + } + + return this; + }, + + getWhere: function(){ + return this.options.where; + }, + + /** + * Time Range Methods + */ + + getTimeRange: function(){ + return [this.options.from, this.options.to]; + }, + + setTimeRange: function(from, to, callback, context){ + var oldFrom = this.options.from; + var oldTo = this.options.to; + var pendingRequests = 0; + var requestError = null; + var requestCallback = L.Util.bind(function(error){ + if(error){ + requestError = error; + } + this._filterExistingFeatures(oldFrom, oldTo, from, to); + + pendingRequests--; + + if(callback && pendingRequests <= 0){ + callback.call(context, requestError); + } + }, this); + + this.options.from = from; + this.options.to = to; + + this._filterExistingFeatures(oldFrom, oldTo, from, to); + + if(this.options.timeFilterMode === 'server') { + for(var key in this._activeCells){ + pendingRequests++; + var coords = this._keyToCellCoords(key); + var bounds = this._cellCoordsToBounds(coords); + this._requestFeatures(bounds, key, requestCallback); + } + } + }, + + refresh: function(){ + for(var key in this._activeCells){ + var coords = this._keyToCellCoords(key); + var bounds = this._cellCoordsToBounds(coords); + this._requestFeatures(bounds, key); + } + }, + + _filterExistingFeatures: function (oldFrom, oldTo, newFrom, newTo) { + var layersToRemove = (oldFrom && oldTo) ? this._getFeaturesInTimeRange(oldFrom, oldTo) : this._currentSnapshot; + var layersToAdd = this._getFeaturesInTimeRange(newFrom, newTo); + + if(layersToAdd.indexOf){ + for (var i = 0; i < layersToAdd.length; i++) { + var shouldRemoveLayer = layersToRemove.indexOf(layersToAdd[i]); + if(shouldRemoveLayer >= 0){ + layersToRemove.splice(shouldRemoveLayer, 1); + } + } + } + + this.removeLayers(layersToRemove); + this.addLayers(layersToAdd); + }, + + _getFeaturesInTimeRange: function(start, end){ + var ids = []; + var search; + + if(this.options.timeField.start && this.options.timeField.end){ + var startTimes = this._startTimeIndex.between(start, end); + var endTimes = this._endTimeIndex.between(start, end); + search = startTimes.concat(endTimes); + } else { + search = this._timeIndex.between(start, end); + } + + for (var i = search.length - 1; i >= 0; i--) { + ids.push(search[i].id); + } + + return ids; + }, + + _buildTimeIndexes: function(geojson){ + var i; + var feature; + if(this.options.timeField.start && this.options.timeField.end){ + var startTimeEntries = []; + var endTimeEntries = []; + for (i = geojson.length - 1; i >= 0; i--) { + feature = geojson[i]; + startTimeEntries.push( { + id: feature.id, + value: new Date(feature.properties[this.options.timeField.start]) + }); + endTimeEntries.push( { + id: feature.id, + value: new Date(feature.properties[this.options.timeField.end]) + }); + } + this._startTimeIndex.bulkAdd(startTimeEntries); + this._endTimeIndex.bulkAdd(endTimeEntries); + } else { + var timeEntries = []; + for (i = geojson.length - 1; i >= 0; i--) { + feature = geojson[i]; + timeEntries.push( { + id: feature.id, + value: new Date(feature.properties[this.options.timeField]) + }); + } + + this._timeIndex.bulkAdd(timeEntries); + } + }, + + _featureWithinTimeRange: function(feature){ + if(!this.options.from || !this.options.to){ + return true; + } + + var from = +this.options.from.valueOf(); + var to = +this.options.to.valueOf(); + + if(typeof this.options.timeField === 'string'){ + var date = +feature.properties[this.options.timeField]; + return (date >= from) && (date <= to); + } + + if(this.options.timeField.start && this.options.timeField.end){ + var startDate = +feature.properties[this.options.timeField.start]; + var endDate = +feature.properties[this.options.timeField.end]; + return ((startDate >= from) && (startDate <= to)) || ((endDate >= from) && (endDate <= to)); + } + }, + + /** + * Service Methods + */ + + authenticate: function(token){ + this._service.authenticate(token); + return this; + }, + + metadata: function(callback, context){ + this._service.metadata(callback, context); + return this; + }, + + query: function(){ + return this._service.query(); + }, + + addFeature: function(feature, callback, context){ + this._service.addFeature(feature, function(error, response){ + if(!error){ + this.refresh(); + } + if(callback){ + callback.call(context, error, response); + } + }, this); + return this; + }, + + updateFeature: function(feature, callback, context){ + return this._service.updateFeature(feature, function(error, response){ + if(!error){ + this.refresh(); + } + if(callback){ + callback.call(context, error, response); + } + }, this); + }, + + deleteFeature: function(id, callback, context){ + return this._service.deleteFeature(id, function(error, response){ + if(!error && response.objectId){ + this.removeLayers([response.objectId], true); + } + if(callback){ + callback.call(context, error, response); + } + }, this); + } + }); + + /** + * Temporal Binary Search Index + */ + + function BinarySearchIndex(values) { + this.values = values || []; + } + + BinarySearchIndex.prototype._query = function(query){ + var minIndex = 0; + var maxIndex = this.values.length - 1; + var currentIndex; + var currentElement; + var resultIndex; + + while (minIndex <= maxIndex) { + resultIndex = currentIndex = (minIndex + maxIndex) / 2 | 0; + currentElement = this.values[Math.round(currentIndex)]; + if (+currentElement.value < +query) { + minIndex = currentIndex + 1; + } else if (+currentElement.value > +query) { + maxIndex = currentIndex - 1; + } else { + return currentIndex; + } + } + + return ~maxIndex; + }; + + BinarySearchIndex.prototype.sort = function(){ + this.values.sort(function(a, b) { + return +b.value - +a.value; + }).reverse(); + this.dirty = false; + }; + + BinarySearchIndex.prototype.between = function(start, end){ + if(this.dirty){ + this.sort(); + } + + var startIndex = this._query(start); + var endIndex = this._query(end); + + if(startIndex === 0 && endIndex === 0){ + return []; + } + + startIndex = Math.abs(startIndex); + endIndex = (endIndex < 0) ? Math.abs(endIndex): endIndex + 1; + + return this.values.slice(startIndex, endIndex); + }; + + BinarySearchIndex.prototype.bulkAdd = function(items){ + this.dirty = true; + this.values = this.values.concat(items); + }; + +})(EsriLeaflet); + +EsriLeaflet.Layers.FeatureLayer = EsriLeaflet.Layers.FeatureManager.extend({ + + statics: { + EVENTS: 'click dblclick mouseover mouseout mousemove contextmenu popupopen popupclose' + }, + + /** + * Constructor + */ + + initialize: function (url, options) { + EsriLeaflet.Layers.FeatureManager.prototype.initialize.call(this, url, options); + + options = L.setOptions(this, options); + + this._layers = {}; + this._leafletIds = {}; + this._key = 'c'+(Math.random() * 1e9).toString(36).replace('.', '_'); + }, + + /** + * Layer Interface + */ + + onAdd: function(map){ + return EsriLeaflet.Layers.FeatureManager.prototype.onAdd.call(this, map); + }, + + onRemove: function(map){ + + for (var i in this._layers) { + map.removeLayer(this._layers[i]); + } + + return EsriLeaflet.Layers.FeatureManager.prototype.onRemove.call(this, map); + }, + + createNewLayer: function(geojson){ + // @TODO Leaflet 0.8 + //newLayer = L.GeoJSON.geometryToLayer(geojson, this.options); + return L.GeoJSON.geometryToLayer(geojson, this.options.pointToLayer, L.GeoJSON.coordsToLatLng, this.options); + }, + + /** + * Feature Managment Methods + */ + + createLayers: function(features){ + for (var i = features.length - 1; i >= 0; i--) { + + var geojson = features[i]; + + var layer = this._layers[geojson.id]; + var newLayer; + + if(layer && !this._map.hasLayer(layer)){ + this._map.addLayer(layer); + } + + if (layer && layer.setLatLngs) { + // @TODO Leaflet 0.8 + //newLayer = L.GeoJSON.geometryToLayer(geojson, this.options); + + var updateGeo = this.createNewLayer(geojson); + layer.setLatLngs(updateGeo.getLatLngs()); + } + + if(!layer){ + // @TODO Leaflet 0.8 + //newLayer = L.GeoJSON.geometryToLayer(geojson, this.options); + + newLayer = this.createNewLayer(geojson); + newLayer.feature = geojson; + newLayer.defaultOptions = newLayer.options; + newLayer._leaflet_id = this._key + '_' + geojson.id; + + this._leafletIds[newLayer._leaflet_id] = geojson.id; + + // bubble events from layers to this + // @TODO Leaflet 0.8 + // newLayer.addEventParent(this); + + newLayer.on(EsriLeaflet.Layers.FeatureLayer.EVENTS, this._propagateEvent, this); + + // bind a popup if we have one + if(this._popup && newLayer.bindPopup){ + newLayer.bindPopup(this._popup(newLayer.feature, newLayer), this._popupOptions); + } + + if(this.options.onEachFeature){ + this.options.onEachFeature(newLayer.feature, newLayer); + } + + // cache the layer + this._layers[newLayer.feature.id] = newLayer; + + // style the layer + this.resetStyle(newLayer.feature.id); + + this.fire('createfeature', { + feature: newLayer.feature + }); + + // add the layer if it is within the time bounds or our layer is not time enabled + if(!this.options.timeField || (this.options.timeField && this._featureWithinTimeRange(geojson)) ){ + this._map.addLayer(newLayer); + } + } + } + }, + + addLayers: function(ids){ + for (var i = ids.length - 1; i >= 0; i--) { + var layer = this._layers[ids[i]]; + if(layer){ + this.fire('addfeature', { + feature: layer.feature + }); + this._map.addLayer(layer); + } + } + }, + + removeLayers: function(ids, permanent){ + for (var i = ids.length - 1; i >= 0; i--) { + var id = ids[i]; + var layer = this._layers[id]; + if(layer){ + this.fire('removefeature', { + feature: layer.feature, + permanent: permanent + }); + this._map.removeLayer(layer); + } + if(layer && permanent){ + delete this._layers[id]; + } + } + }, + + /** + * Styling Methods + */ + + resetStyle: function (id) { + var layer = this._layers[id]; + + if(layer){ + layer.options = layer.defaultOptions; + this.setFeatureStyle(layer.feature.id, this.options.style); + } + + return this; + }, + + setStyle: function (style) { + this.options.style = style; + this.eachFeature(function (layer) { + this.setFeatureStyle(layer.feature.id, style); + }, this); + return this; + }, + + setFeatureStyle: function (id, style) { + var layer = this._layers[id]; + + if (typeof style === 'function') { + style = style(layer.feature); + } + if (layer.setStyle) { + layer.setStyle(style); + } + }, + + /** + * Popup Methods + */ + + bindPopup: function (fn, options) { + this._popup = fn; + this._popupOptions = options; + for (var i in this._layers) { + var layer = this._layers[i]; + var popupContent = this._popup(layer.feature, layer); + layer.bindPopup(popupContent, options); + } + return this; + }, + + unbindPopup: function () { + this._popup = false; + for (var i in this._layers) { + var layer = this._layers[i]; + if (layer.unbindPopup) { + layer.unbindPopup(); + } else if (layer.getLayers) { + var groupLayers = layer.getLayers(); + for (var j in groupLayers) { + var gLayer = groupLayers[j]; + gLayer.unbindPopup(); + } + } + } + return this; + }, + + /** + * Utility Methods + */ + + eachFeature: function (fn, context) { + for (var i in this._layers) { + fn.call(context, this._layers[i]); + } + return this; + }, + + getFeature: function (id) { + return this._layers[id]; + }, + + // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js + // @TODO remove at Leaflet 0.8 + _propagateEvent: function (e) { + e.layer = this._layers[this._leafletIds[e.target._leaflet_id]]; + e.target = this; + this.fire(e.type, e); + } +}); + +EsriLeaflet.FeatureLayer = EsriLeaflet.Layers.FeatureLayer; + +EsriLeaflet.Layers.featureLayer = function(url, options){ + return new EsriLeaflet.Layers.FeatureLayer(url, options); +}; + +EsriLeaflet.featureLayer = function(url, options){ + return new EsriLeaflet.Layers.FeatureLayer(url, options); +}; + + + return EsriLeaflet; +})); +//# sourceMappingURL=esri-leaflet-feature-layer-src.js.map \ No newline at end of file diff --git a/dist/builds/feature-layer/esri-leaflet-feature-layer-src.js.map b/dist/builds/feature-layer/esri-leaflet-feature-layer-src.js.map new file mode 100644 index 000000000..cf2c6a5a0 --- /dev/null +++ b/dist/builds/feature-layer/esri-leaflet-feature-layer-src.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/EsriLeaflet.js","../../../src/Util.js","../../../src/Request.js","../../../src/Services/Service.js","../../../src/Services/FeatureLayer.js","../../../src/Tasks/Task.js","../../../src/Tasks/Query.js","../../../src/Layers/FeatureLayer/FeatureGrid.js","../../../src/Layers/FeatureLayer/FeatureManager.js","../../../src/Layers/FeatureLayer/FeatureLayer.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,GAAG,CAAC,WAAW,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI;AAAA,EACtC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAAA,EACpB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,IAAI;AAAA,EACJ,OAAO;AAAA,IACL,IAAI,KAAK,MAAM,CAAC,cAAc,KAAK,eAAe,EAAE,EAAE,CAAC,GAAG,CAAC,cAAc;AAAA,IACzE,aAAa,EAAE,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,aAAa;AAAA;AAAA;AAAA;AAI/D,EAAE,CAAC,MAAM,CAAC,MAAM,MAAM,SAAS,KAAK,MAAM,CAAC,CAAC;AAAA,EAC1C,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,WAAW;AAAA,C;;ACd7B,CAAC,QAAQ,CAAC,WAAW;AAAA;AAAA,KAEhB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU;AAAA,KAC1D,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;AAAA,EAC7C,QAAQ,CAAC,KAAK,CAAC,GAAG;AAAA,IAChB,GAAG,CAAC,MAAM;AAAA,IACV,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG;A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,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO;AAAA","file":"esri-leaflet-feature-layer-src.js","sourcesContent":["var EsriLeaflet = { //jshint ignore:line\n VERSION: '1.0.0-rc.2',\n Layers: {},\n Services: {},\n Controls: {},\n Tasks: {},\n Util: {},\n Support: {\n CORS: !!(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()),\n pointerEvents: document.documentElement.style.pointerEvents === ''\n }\n};\n\nif(typeof window !== 'undefined' && window.L){\n window.L.esri = EsriLeaflet;\n}","(function(EsriLeaflet){\n\n // shallow object clone for feature properties and attributes\n // from http://jsperf.com/cloning-an-object/2\n function clone(obj) {\n var target = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n target[i] = obj[i];\n }\n }\n return target;\n }\n\n // checks if 2 x,y points are equal\n function pointsEqual(a, b) {\n for (var i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n }\n\n // checks if the first and last points of a ring are equal and closes the ring\n function closeRing(coordinates) {\n if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) {\n coordinates.push(coordinates[0]);\n }\n return coordinates;\n }\n\n // determine if polygon ring coordinates are clockwise. clockwise signifies outer ring, counter-clockwise an inner ring\n // or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-\n // points-are-in-clockwise-order\n function ringIsClockwise(ringToTest) {\n var total = 0,i = 0;\n var rLength = ringToTest.length;\n var pt1 = ringToTest[i];\n var pt2;\n for (i; i < rLength - 1; i++) {\n pt2 = ringToTest[i + 1];\n total += (pt2[0] - pt1[0]) * (pt2[1] + pt1[1]);\n pt1 = pt2;\n }\n return (total >= 0);\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L504-L519\n function vertexIntersectsVertex(a1, a2, b1, b2) {\n var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]);\n var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]);\n var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]);\n\n if ( uB !== 0 ) {\n var ua = uaT / uB;\n var ub = ubT / uB;\n\n if ( 0 <= ua && ua <= 1 && 0 <= ub && ub <= 1 ) {\n return true;\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L521-L531\n function arrayIntersectsArray(a, b) {\n for (var i = 0; i < a.length - 1; i++) {\n for (var j = 0; j < b.length - 1; j++) {\n if (vertexIntersectsVertex(a[i], a[i + 1], b[j], b[j + 1])) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L470-L480\n function coordinatesContainPoint(coordinates, point) {\n var contains = false;\n for(var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) {\n if (((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1]) ||\n (coordinates[j][1] <= point[1] && point[1] < coordinates[i][1])) &&\n (point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0])) {\n contains = !contains;\n }\n }\n return contains;\n }\n\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L106-L113\n function coordinatesContainCoordinates(outer, inner){\n var intersects = arrayIntersectsArray(outer, inner);\n var contains = coordinatesContainPoint(outer, inner[0]);\n if(!intersects && contains){\n return true;\n }\n return false;\n }\n\n // do any polygons in this array contain any other polygons in this array?\n // used for checking for holes in arcgis rings\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L117-L172\n function convertRingsToGeoJSON(rings){\n var outerRings = [];\n var holes = [];\n var x; // iterator\n var outerRing; // current outer ring being evaluated\n var hole; // current hole being evaluated\n\n // for each ring\n for (var r = 0; r < rings.length; r++) {\n var ring = closeRing(rings[r].slice(0));\n if(ring.length < 4){\n continue;\n }\n // is this ring an outer ring? is it clockwise?\n if(ringIsClockwise(ring)){\n var polygon = [ ring ];\n outerRings.push(polygon); // push to outer rings\n } else {\n holes.push(ring); // counterclockwise push to holes\n }\n }\n\n var uncontainedHoles = [];\n\n // while there are holes left...\n while(holes.length){\n // pop a hole off out stack\n hole = holes.pop();\n\n // loop over all outer rings and see if they contain our hole.\n var contained = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(coordinatesContainCoordinates(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n contained = true;\n break;\n }\n }\n\n // ring is not contained in any outer ring\n // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320\n if(!contained){\n uncontainedHoles.push(hole);\n }\n }\n\n // if we couldn't match any holes using contains we can try intersects...\n while(uncontainedHoles.length){\n // pop a hole off out stack\n hole = uncontainedHoles.pop();\n\n // loop over all outer rings and see if any intersect our hole.\n var intersects = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(arrayIntersectsArray(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n intersects = true;\n break;\n }\n }\n\n if(!intersects) {\n outerRings.push([hole.reverse()]);\n }\n }\n\n if(outerRings.length === 1){\n return {\n type: 'Polygon',\n coordinates: outerRings[0]\n };\n } else {\n return {\n type: 'MultiPolygon',\n coordinates: outerRings\n };\n }\n }\n\n // This function ensures that rings are oriented in the right directions\n // outer rings are clockwise, holes are counterclockwise\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function orientRings(poly){\n var output = [];\n var polygon = poly.slice(0);\n var outerRing = closeRing(polygon.shift().slice(0));\n if(outerRing.length >= 4){\n if(!ringIsClockwise(outerRing)){\n outerRing.reverse();\n }\n\n output.push(outerRing);\n\n for (var i = 0; i < polygon.length; i++) {\n var hole = closeRing(polygon[i].slice(0));\n if(hole.length >= 4){\n if(ringIsClockwise(hole)){\n hole.reverse();\n }\n output.push(hole);\n }\n }\n }\n\n return output;\n }\n\n // This function flattens holes in multipolygons to one array of polygons\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function flattenMultiPolygonRings(rings){\n var output = [];\n for (var i = 0; i < rings.length; i++) {\n var polygon = orientRings(rings[i]);\n for (var x = polygon.length - 1; x >= 0; x--) {\n var ring = polygon[x].slice(0);\n output.push(ring);\n }\n }\n return output;\n }\n\n // convert an extent (ArcGIS) to LatLngBounds (Leaflet)\n EsriLeaflet.Util.extentToBounds = function(extent){\n var sw = new L.LatLng(extent.ymin, extent.xmin);\n var ne = new L.LatLng(extent.ymax, extent.xmax);\n return new L.LatLngBounds(sw, ne);\n };\n\n // convert an LatLngBounds (Leaflet) to extent (ArcGIS)\n EsriLeaflet.Util.boundsToExtent = function(bounds) {\n bounds = L.latLngBounds(bounds);\n return {\n 'xmin': bounds.getSouthWest().lng,\n 'ymin': bounds.getSouthWest().lat,\n 'xmax': bounds.getNorthEast().lng,\n 'ymax': bounds.getNorthEast().lat,\n 'spatialReference': {\n 'wkid' : 4326\n }\n };\n };\n\n EsriLeaflet.Util.arcgisToGeojson = function (arcgis, idAttribute){\n var geojson = {};\n\n if(typeof arcgis.x === 'number' && typeof arcgis.y === 'number'){\n geojson.type = 'Point';\n geojson.coordinates = [arcgis.x, arcgis.y];\n }\n\n if(arcgis.points){\n geojson.type = 'MultiPoint';\n geojson.coordinates = arcgis.points.slice(0);\n }\n\n if(arcgis.paths) {\n if(arcgis.paths.length === 1){\n geojson.type = 'LineString';\n geojson.coordinates = arcgis.paths[0].slice(0);\n } else {\n geojson.type = 'MultiLineString';\n geojson.coordinates = arcgis.paths.slice(0);\n }\n }\n\n if(arcgis.rings) {\n geojson = convertRingsToGeoJSON(arcgis.rings.slice(0));\n }\n\n if(arcgis.geometry || arcgis.attributes) {\n geojson.type = 'Feature';\n geojson.geometry = (arcgis.geometry) ? EsriLeaflet.Util.arcgisToGeojson(arcgis.geometry) : null;\n geojson.properties = (arcgis.attributes) ? clone(arcgis.attributes) : null;\n if(arcgis.attributes) {\n geojson.id = arcgis.attributes[idAttribute] || arcgis.attributes.OBJECTID || arcgis.attributes.FID;\n }\n }\n\n return geojson;\n };\n\n // GeoJSON -> ArcGIS\n EsriLeaflet.Util.geojsonToArcGIS = function(geojson, idAttribute){\n idAttribute = idAttribute || 'OBJECTID';\n var spatialReference = { wkid: 4326 };\n var result = {};\n var i;\n\n switch(geojson.type){\n case 'Point':\n result.x = geojson.coordinates[0];\n result.y = geojson.coordinates[1];\n result.spatialReference = spatialReference;\n break;\n case 'MultiPoint':\n result.points = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'LineString':\n result.paths = [geojson.coordinates.slice(0)];\n result.spatialReference = spatialReference;\n break;\n case 'MultiLineString':\n result.paths = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'Polygon':\n result.rings = orientRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'MultiPolygon':\n result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'Feature':\n if(geojson.geometry) {\n result.geometry = EsriLeaflet.Util.geojsonToArcGIS(geojson.geometry, idAttribute);\n }\n result.attributes = (geojson.properties) ? clone(geojson.properties) : {};\n if(geojson.id){\n result.attributes[idAttribute] = geojson.id;\n }\n break;\n case 'FeatureCollection':\n result = [];\n for (i = 0; i < geojson.features.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.features[i], idAttribute));\n }\n break;\n case 'GeometryCollection':\n result = [];\n for (i = 0; i < geojson.geometries.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.geometries[i], idAttribute));\n }\n break;\n }\n\n return result;\n };\n\n EsriLeaflet.Util.responseToFeatureCollection = function(response, idAttribute){\n var objectIdField;\n\n if(idAttribute){\n objectIdField = idAttribute;\n } else if(response.objectIdFieldName){\n objectIdField = response.objectIdFieldName;\n } else if(response.fields) {\n for (var j = 0; j <= response.fields.length - 1; j++) {\n if(response.fields[j].type === 'esriFieldTypeOID') {\n objectIdField = response.fields[j].name;\n break;\n }\n }\n } else {\n objectIdField = 'OBJECTID';\n }\n\n var featureCollection = {\n type: 'FeatureCollection',\n features: []\n };\n var features = response.features || response.results;\n if(features.length){\n for (var i = features.length - 1; i >= 0; i--) {\n featureCollection.features.push(EsriLeaflet.Util.arcgisToGeojson(features[i], objectIdField));\n }\n }\n\n return featureCollection;\n };\n\n // trim whitespace and add a tailing slash is needed to a url\n EsriLeaflet.Util.cleanUrl = function(url){\n url = url.replace(/\\s\\s*/g, '');\n\n //add a trailing slash to the url if the user omitted it\n if(url[url.length-1] !== '/'){\n url += '/';\n }\n\n return url;\n };\n\n EsriLeaflet.Util.geojsonTypeToArcGIS = function (geoJsonType) {\n var arcgisGeometryType;\n switch (geoJsonType) {\n case 'Point':\n arcgisGeometryType = 'esriGeometryPoint';\n break;\n case 'MultiPoint':\n arcgisGeometryType = 'esriGeometryMultipoint';\n break;\n case 'LineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'MultiLineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'Polygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n case 'MultiPolygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n }\n return arcgisGeometryType;\n };\n\n})(EsriLeaflet);","(function(EsriLeaflet){\n\n var callbacks = 0;\n\n window._EsriLeafletCallbacks = {};\n\n function serialize(params){\n var data = '';\n\n params.f = 'json';\n\n for (var key in params){\n if(params.hasOwnProperty(key)){\n var param = params[key];\n var type = Object.prototype.toString.call(param);\n var value;\n\n if(data.length){\n data += '&';\n }\n\n if(type === '[object Array]' || type === '[object Object]'){\n value = JSON.stringify(param);\n } else if (type === '[object Date]'){\n value = param.valueOf();\n } else {\n value = param;\n }\n\n data += encodeURIComponent(key) + '=' + encodeURIComponent(value);\n }\n }\n\n return data;\n }\n\n function createRequest(callback, context){\n var httpRequest = new XMLHttpRequest();\n\n httpRequest.onerror = function(e) {\n callback.call(context, {\n error: {\n code: 500,\n message: 'XMLHttpRequest error'\n }\n }, null);\n };\n\n httpRequest.onreadystatechange = function(){\n var response;\n var error;\n\n if (httpRequest.readyState === 4) {\n try {\n response = JSON.parse(httpRequest.responseText);\n } catch(e) {\n response = null;\n error = {\n code: 500,\n message: 'Could not parse response as JSON.'\n };\n }\n\n if (!error && response.error) {\n error = response.error;\n response = null;\n }\n\n callback.call(context, error, response);\n }\n };\n\n return httpRequest;\n }\n\n // AJAX handlers for CORS (modern browsers) or JSONP (older browsers)\n EsriLeaflet.Request = {\n request: function(url, params, callback, context){\n var paramString = serialize(params);\n var httpRequest = createRequest(callback, context);\n var requestLength = (url + '?' + paramString).length;\n\n // request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest\n if(requestLength <= 2000 && L.esri.Support.CORS){\n httpRequest.open('GET', url + '?' + paramString);\n httpRequest.send(null);\n\n // request is less more then 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest\n } else if (requestLength > 2000 && L.esri.Support.CORS){\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(paramString);\n\n // request is less more then 2000 characters and the browser does not support CORS, make a JSONP request\n } else if(requestLength <= 2000 && !L.esri.Support.CORS){\n return L.esri.Request.get.JSONP(url, params, callback, context);\n\n // request is longer then 2000 characters and the browser does not support CORS, log a warning\n } else {\n if(console && console.warn){\n console.warn('a request to ' + url + ' 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');\n return;\n }\n }\n\n return httpRequest;\n },\n post: {\n XMLHTTP: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(serialize(params));\n\n return httpRequest;\n }\n },\n\n get: {\n CORS: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n\n httpRequest.open('GET', url + '?' + serialize(params), true);\n httpRequest.send(null);\n\n return httpRequest;\n },\n JSONP: function(url, params, callback, context){\n var callbackId = 'c' + callbacks;\n\n params.callback = 'window._EsriLeafletCallbacks.' + callbackId;\n\n var script = L.DomUtil.create('script', null, document.body);\n script.type = 'text/javascript';\n script.src = url + '?' + serialize(params);\n script.id = callbackId;\n\n window._EsriLeafletCallbacks[callbackId] = function(response){\n if(window._EsriLeafletCallbacks[callbackId] !== true){\n var error;\n var responseType = Object.prototype.toString.call(response);\n\n if(!(responseType === '[object Object]' || responseType === '[object Array]')){\n error = {\n error: {\n code: 500,\n message: 'Expected array or object as JSONP response'\n }\n };\n response = null;\n }\n\n if (!error && response.error) {\n error = response;\n response = null;\n }\n\n callback.call(context, error, response);\n window._EsriLeafletCallbacks[callbackId] = true;\n }\n };\n\n callbacks++;\n\n return {\n id: callbackId,\n url: script.src,\n abort: function(){\n window._EsriLeafletCallbacks._callback[callbackId]({\n code: 0,\n message: 'Request aborted.'\n });\n }\n };\n }\n }\n };\n\n // Choose the correct AJAX handler depending on CORS support\n EsriLeaflet.get = (EsriLeaflet.Support.CORS) ? EsriLeaflet.Request.get.CORS : EsriLeaflet.Request.get.JSONP;\n\n // Always use XMLHttpRequest for posts\n EsriLeaflet.post = EsriLeaflet.Request.post.XMLHTTP;\n\n // expose a common request method the uses GET\\POST based on request length\n EsriLeaflet.request = EsriLeaflet.Request.request;\n\n})(EsriLeaflet);","EsriLeaflet.Services.Service = L.Class.extend({\n\n includes: L.Mixin.Events,\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n initialize: function (url, options) {\n this.url = EsriLeaflet.Util.cleanUrl(url);\n this._requestQueue = [];\n this._authenticating = false;\n L.Util.setOptions(this, options);\n },\n\n get: function (path, params, callback, context) {\n return this._request('get', path, params, callback, context);\n },\n\n post: function (path, params, callback, context) {\n return this._request('post', path, params, callback, context);\n },\n\n request: function (path, params, callback, context) {\n return this._request('request', path, params, callback, context);\n },\n\n metadata: function (callback, context) {\n return this._request('get', '', {}, callback, context);\n },\n\n authenticate: function(token){\n this._authenticating = false;\n this.options.token = token;\n this._runQueue();\n return this;\n },\n\n _request: function(method, path, params, callback, context){\n this.fire('requeststart', {\n url: this.url + path,\n params: params,\n method: method\n });\n\n var wrappedCallback = this._createServiceCallback(method, path, params, callback, context);\n\n if (this.options.token) {\n params.token = this.options.token;\n }\n\n if (this._authenticating) {\n this._requestQueue.push([method, path, params, callback, context]);\n return;\n } else {\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, wrappedCallback);\n } else {\n return EsriLeaflet[method](url, params, wrappedCallback);\n }\n }\n },\n\n _createServiceCallback: function(method, path, params, callback, context){\n var request = [method, path, params, callback, context];\n\n return L.Util.bind(function(error, response){\n\n if (error && (error.code === 499 || error.code === 498)) {\n this._authenticating = true;\n\n this._requestQueue.push(request);\n\n this.fire('authenticationrequired', {\n authenticate: L.Util.bind(this.authenticate, this)\n });\n } else {\n callback.call(context, error, response);\n\n if(error) {\n this.fire('requesterror', {\n url: this.url + path,\n params: params,\n message: error.message,\n code: error.code,\n method: method\n });\n } else {\n this.fire('requestsuccess', {\n url: this.url + path,\n params: params,\n response: response,\n method: method\n });\n }\n\n this.fire('requestend', {\n url: this.url + path,\n params: params,\n method: method\n });\n }\n }, this);\n },\n\n _runQueue: function(){\n for (var i = this._requestQueue.length - 1; i >= 0; i--) {\n var request = this._requestQueue[i];\n var method = request.shift();\n this[method].apply(this, request);\n }\n this._requestQueue = [];\n }\n\n});\n\nEsriLeaflet.Services.service = function(url, params){\n return new EsriLeaflet.Services.Service(url, params);\n};","EsriLeaflet.Services.FeatureLayer = EsriLeaflet.Services.Service.extend({\n\n options: {\n idAttribute: 'OBJECTID'\n },\n\n query: function(){\n return new EsriLeaflet.Tasks.Query(this);\n },\n\n addFeature: function(feature, callback, context) {\n delete feature.id;\n\n feature = EsriLeaflet.Util.geojsonToArcGIS(feature);\n\n return this.post('addFeatures', {\n features: [feature]\n }, function(error, response){\n var result = (response && response.addResults) ? response.addResults[0] : undefined;\n if(callback){\n callback.call(this, error || response.addResults[0].error, result);\n }\n }, context);\n },\n\n updateFeature: function(feature, callback, context) {\n feature = EsriLeaflet.Util.geojsonToArcGIS(feature, this.options.idAttribute);\n\n return this.post('updateFeatures', {\n features: [feature]\n }, function(error, response){\n var result = (response && response.updateResults) ? response.updateResults[0] : undefined;\n if(callback){\n callback.call(context, error || response.updateResults[0].error, result);\n }\n }, context);\n },\n\n deleteFeature: function(id, callback, context) {\n return this.post('deleteFeatures', {\n objectIds: id\n }, function(error, response){\n var result = (response && response.deleteResults) ? response.deleteResults[0] : undefined;\n if(callback){\n callback.call(context, error || response.deleteResults[0].error, result);\n }\n }, context);\n }\n\n});\n\nEsriLeaflet.Services.featureLayer = function(url, options) {\n return new EsriLeaflet.Services.FeatureLayer(url, options);\n};","EsriLeaflet.Tasks.Task = L.Class.extend({\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n //Generate a method for each methodName:paramName in the setters for this task.\n generateSetter: function(param, context){\n var isArray = param.match(/([a-zA-Z]+)\\[\\]/);\n\n param = (isArray) ? isArray[1] : param;\n\n if(isArray){\n return L.Util.bind(function(value){\n // this.params[param] = (this.params[param]) ? this.params[param] + ',' : '';\n if (L.Util.isArray(value)) {\n this.params[param] = value.join(',');\n } else {\n this.params[param] = value;\n }\n return this;\n }, context);\n } else {\n return L.Util.bind(function(value){\n this.params[param] = value;\n return this;\n }, context);\n }\n },\n\n initialize: function(endpoint, options){\n // endpoint can be either a url to an ArcGIS Rest Service or an instance of EsriLeaflet.Service\n if(endpoint.url && endpoint.request){\n this._service = endpoint;\n this.url = endpoint.url;\n } else {\n this.url = EsriLeaflet.Util.cleanUrl(endpoint);\n }\n\n // clone default params into this object\n this.params = L.Util.extend({}, this.params || {});\n\n // generate setter methods based on the setters object implimented a child class\n if(this.setters){\n for (var setter in this.setters){\n var param = this.setters[setter];\n this[setter] = this.generateSetter(param, this);\n }\n }\n\n L.Util.setOptions(this, options);\n },\n\n token: function(token){\n if(this._service){\n this._service.authenticate(token);\n } else {\n this.params.token = token;\n }\n return this;\n },\n\n request: function(callback, context){\n if(this._service){\n return this._service.request(this.path, this.params, callback, context);\n } else {\n return this._request('request', this.path, this.params, callback, context);\n }\n },\n\n _request: function(method, path, params, callback, context){\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, callback, context);\n } else{\n return EsriLeaflet[method](url, params, callback, context);\n }\n }\n});","EsriLeaflet.Tasks.Query = EsriLeaflet.Tasks.Task.extend({\n setters: {\n 'offset': 'offset',\n 'limit': 'limit',\n 'outFields': 'fields[]',\n 'precision': 'geometryPrecision',\n 'featureIds': 'objectIds[]',\n 'returnGeometry': 'returnGeometry',\n 'token': 'token'\n },\n\n path: 'query',\n\n params: {\n returnGeometry: true,\n where: '1=1',\n outSr: 4326,\n outFields: '*'\n },\n\n within: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelContains'; // will make code read layer within geometry, to the api this will reads geometry contains layer\n return this;\n },\n\n intersects: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelIntersects';\n return this;\n },\n\n contains: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelWithin'; // will make code read layer contains geometry, to the api this will reads geometry within layer\n return this;\n },\n\n // crosses: function(geometry){\n // this._setGeometry(geometry);\n // this.params.spatialRel = 'esriSpatialRelCrosses';\n // return this;\n // },\n\n // touches: function(geometry){\n // this._setGeometry(geometry);\n // this.params.spatialRel = 'esriSpatialRelTouches';\n // return this;\n // },\n\n overlaps: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelOverlaps';\n return this;\n },\n\n // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online\n nearby: function(latlng, radius){\n latlng = L.latLng(latlng);\n this.params.geometry = ([latlng.lng,latlng.lat]).join(',');\n this.params.geometryType = 'esriGeometryPoint';\n this.params.spatialRel = 'esriSpatialRelIntersects';\n this.params.units = 'esriSRUnit_Meter';\n this.params.distance = radius;\n this.params.inSr = 4326;\n return this;\n },\n\n where: function(string){\n this.params.where = string.replace(/\"/g, \"\\'\"); // jshint ignore:line\n return this;\n },\n\n between: function(start, end){\n this.params.time = ([start.valueOf(), end.valueOf()]).join();\n return this;\n },\n\n fields: function (fields) {\n if (L.Util.isArray(fields)) {\n this.params.outFields = fields.join(',');\n } else {\n this.params.outFields = fields;\n }\n return this;\n },\n\n simplify: function(map, factor){\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\n return this;\n },\n\n orderBy: function(fieldName, order){\n order = order || 'ASC';\n this.params.orderByFields = (this.params.orderByFields) ? this.params.orderByFields + ',' : '';\n this.params.orderByFields += ([fieldName, order]).join(' ');\n return this;\n },\n\n returnGeometry: function(bool){\n this.params.returnGeometry = bool;\n return this;\n },\n\n run: function(callback, context){\n this._cleanParams();\n return this.request(function(error, response){\n callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response);\n }, context);\n },\n\n count: function(callback, context){\n this._cleanParams();\n this.params.returnCountOnly = true;\n return this.request(function(error, response){\n callback.call(this, error, (response && response.count), response);\n }, context);\n },\n\n ids: function(callback, context){\n this._cleanParams();\n this.params.returnIdsOnly = true;\n return this.request(function(error, response){\n callback.call(this, error, (response && response.objectIds), response);\n }, context);\n },\n\n // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online\n bounds: function(callback, context){\n this._cleanParams();\n this.params.returnExtentOnly = true;\n return this.request(function(error, response){\n callback.call(context, error, (response && response.extent && EsriLeaflet.Util.extentToBounds(response.extent)), response);\n }, context);\n },\n\n // only valid for image services\n pixelSize: function(point){\n point = L.point(point);\n this.params.pixelSize = ([point.x,point.y]).join(',');\n return this;\n },\n\n // only valid for map services\n layer: function(layer){\n this.path = layer + '/query';\n return this;\n },\n\n _cleanParams: function(){\n delete this.params.returnIdsOnly;\n delete this.params.returnExtentOnly;\n delete this.params.returnCountOnly;\n },\n\n _setGeometry: function(geometry) {\n this.params.inSr = 4326;\n\n // convert bounds to extent and finish\n if ( geometry instanceof L.LatLngBounds ) {\n // set geometry + geometryType\n this.params.geometry = EsriLeaflet.Util.boundsToExtent(geometry);\n this.params.geometryType = 'esriGeometryEnvelope';\n return;\n }\n\n // convert L.Marker > L.LatLng\n if(geometry.getLatLng){\n geometry = geometry.getLatLng();\n }\n\n // convert L.LatLng to a geojson point and continue;\n if (geometry instanceof L.LatLng) {\n geometry = {\n type: 'Point',\n coordinates: [geometry.lng, geometry.lat]\n };\n }\n\n // handle L.GeoJSON, pull out the first geometry\n if ( geometry instanceof L.GeoJSON ) {\n //reassign geometry to the GeoJSON value (we are assuming that only one feature is present)\n geometry = geometry.getLayers()[0].feature.geometry;\n this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry);\n this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type);\n }\n\n // Handle L.Polyline and L.Polygon\n if (geometry.toGeoJSON) {\n geometry = geometry.toGeoJSON();\n }\n\n // handle GeoJSON feature by pulling out the geometry\n if ( geometry.type === 'Feature' ) {\n // get the geometry of the geojson feature\n geometry = geometry.geometry;\n }\n\n // confirm that our GeoJSON is a point, line or polygon\n if ( geometry.type === 'Point' || geometry.type === 'LineString' || geometry.type === 'Polygon') {\n this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry);\n this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type);\n return;\n }\n\n // warn the user if we havn't found a\n /* global console */\n if(console && console.warn) {\n console.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');\n }\n\n return;\n }\n});\n\nEsriLeaflet.Tasks.query = function(url, params){\n return new EsriLeaflet.Tasks.Query(url, params);\n};","EsriLeaflet.Layers.FeatureGrid = L.Class.extend({\n\n includes: L.Mixin.Events,\n\n options: {\n cellSize: 512,\n updateInterval: 150\n },\n\n initialize: function (options) {\n options = L.setOptions(this, options);\n },\n\n onAdd: function (map) {\n this._map = map;\n this._update = L.Util.limitExecByInterval(this._update, this.options.updateInterval, this);\n\n // @TODO remove for leaflet 0.8\n this._map.addEventListener(this.getEvents(), this);\n\n this._reset();\n this._update();\n },\n\n onRemove: function(){\n this._map.removeEventListener(this.getEvents(), this);\n this._removeCells();\n },\n\n getEvents: function () {\n var events = {\n viewreset: this._reset,\n moveend: this._update\n };\n\n return events;\n },\n\n addTo: function(map){\n map.addLayer(this);\n return this;\n },\n\n removeFrom: function(map){\n map.removeLayer(this);\n return this;\n },\n\n _reset: function () {\n this._removeCells();\n\n this._cells = {};\n this._activeCells = {};\n this._cellsToLoad = 0;\n this._cellsTotal = 0;\n\n // @TODO enable at Leaflet 0.8\n // this._cellNumBounds = this._getCellNumBounds();\n\n this._resetWrap();\n },\n\n _resetWrap: function () {\n var map = this._map,\n crs = map.options.crs;\n\n if (crs.infinite) { return; }\n\n var cellSize = this._getCellSize();\n\n if (crs.wrapLng) {\n this._wrapLng = [\n Math.floor(map.project([0, crs.wrapLng[0]]).x / cellSize),\n Math.ceil(map.project([0, crs.wrapLng[1]]).x / cellSize)\n ];\n }\n\n if (crs.wrapLat) {\n this._wrapLat = [\n Math.floor(map.project([crs.wrapLat[0], 0]).y / cellSize),\n Math.ceil(map.project([crs.wrapLat[1], 0]).y / cellSize)\n ];\n }\n },\n\n _getCellSize: function () {\n return this.options.cellSize;\n },\n\n _update: function () {\n if (!this._map) { return; }\n\n var bounds = this._map.getPixelBounds(),\n zoom = this._map.getZoom(),\n cellSize = this._getCellSize();\n\n if (zoom > this.options.maxZoom ||\n zoom < this.options.minZoom) { return; }\n\n // cell coordinates range for the current view\n var cellBounds = L.bounds(\n bounds.min.divideBy(cellSize).floor(),\n bounds.max.divideBy(cellSize).floor());\n\n this._addCells(cellBounds);\n this._removeOtherCells(cellBounds);\n },\n\n _addCells: function (bounds) {\n var queue = [],\n center = bounds.getCenter(),\n zoom = this._map.getZoom();\n\n var j, i, coords;\n // create a queue of coordinates to load cells from\n for (j = bounds.min.y; j <= bounds.max.y; j++) {\n for (i = bounds.min.x; i <= bounds.max.x; i++) {\n coords = new L.Point(i, j);\n coords.z = zoom;\n\n // @TODO enable at Leaflet 0.8\n // if (this._isValidCell(coords)) {\n // queue.push(coords);\n // }\n\n queue.push(coords);\n }\n }\n var cellsToLoad = queue.length;\n\n if (cellsToLoad === 0) { return; }\n\n this._cellsToLoad += cellsToLoad;\n this._cellsTotal += cellsToLoad;\n\n // sort cell queue to load cells in order of their distance to center\n queue.sort(function (a, b) {\n return a.distanceTo(center) - b.distanceTo(center);\n });\n\n for (i = 0; i < cellsToLoad; i++) {\n this._addCell(queue[i]);\n }\n },\n\n // @TODO enable at Leaflet 0.8\n // _isValidCell: function (coords) {\n // var crs = this._map.options.crs;\n\n // if (!crs.infinite) {\n // // don't load cell if it's out of bounds and not wrapped\n // var bounds = this._cellNumBounds;\n // if (\n // (!crs.wrapLng && (coords.x < bounds.min.x || coords.x > bounds.max.x)) ||\n // (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y))\n // ) {\n // return false;\n // }\n // }\n\n // if (!this.options.bounds) {\n // return true;\n // }\n\n // // don't load cell if it doesn't intersect the bounds in options\n // var cellBounds = this._cellCoordsToBounds(coords);\n // return L.latLngBounds(this.options.bounds).intersects(cellBounds);\n // },\n\n // converts cell coordinates to its geographical bounds\n _cellCoordsToBounds: function (coords) {\n var map = this._map,\n cellSize = this.options.cellSize,\n\n nwPoint = coords.multiplyBy(cellSize),\n sePoint = nwPoint.add([cellSize, cellSize]),\n\n // @TODO for Leaflet 0.8\n // nw = map.wrapLatLng(map.unproject(nwPoint, coords.z)),\n // se = map.wrapLatLng(map.unproject(sePoint, coords.z));\n\n nw = map.unproject(nwPoint, coords.z).wrap(),\n se = map.unproject(sePoint, coords.z).wrap();\n\n return new L.LatLngBounds(nw, se);\n },\n\n // converts cell coordinates to key for the cell cache\n _cellCoordsToKey: function (coords) {\n return coords.x + ':' + coords.y;\n },\n\n // converts cell cache key to coordiantes\n _keyToCellCoords: function (key) {\n var kArr = key.split(':'),\n x = parseInt(kArr[0], 10),\n y = parseInt(kArr[1], 10);\n\n return new L.Point(x, y);\n },\n\n // remove any present cells that are off the specified bounds\n _removeOtherCells: function (bounds) {\n for (var key in this._cells) {\n if (!bounds.contains(this._keyToCellCoords(key))) {\n this._removeCell(key);\n }\n }\n },\n\n _removeCell: function (key) {\n var cell = this._activeCells[key];\n if(cell){\n delete this._activeCells[key];\n\n if (this.cellLeave) {\n this.cellLeave(cell.bounds, cell.coords);\n }\n\n this.fire('cellleave', {\n bounds: cell.bounds,\n coords: cell.coords\n });\n }\n },\n\n _removeCells: function(){\n for (var key in this._cells) {\n var bounds = this._cells[key].bounds;\n var coords = this._cells[key].coords;\n\n if (this.cellLeave) {\n this.cellLeave(bounds, coords);\n }\n\n this.fire('cellleave', {\n bounds: bounds,\n coords: coords\n });\n }\n },\n\n _addCell: function (coords) {\n\n // wrap cell coords if necessary (depending on CRS)\n this._wrapCoords(coords);\n\n // generate the cell key\n var key = this._cellCoordsToKey(coords);\n\n // get the cell from the cache\n var cell = this._cells[key];\n // if this cell should be shown as isnt active yet (enter)\n\n if (cell && !this._activeCells[key]) {\n if (this.cellEnter) {\n this.cellEnter(cell.bounds, coords);\n }\n\n this.fire('cellenter', {\n bounds: cell.bounds,\n coords: coords\n });\n\n this._activeCells[key] = cell;\n }\n\n // if we dont have this cell in the cache yet (create)\n if (!cell) {\n cell = {\n coords: coords,\n bounds: this._cellCoordsToBounds(coords)\n };\n\n this._cells[key] = cell;\n this._activeCells[key] = cell;\n\n if(this.createCell){\n this.createCell(cell.bounds, coords);\n }\n\n this.fire('cellcreate', {\n bounds: cell.bounds,\n coords: coords\n });\n }\n },\n\n _wrapCoords: function (coords) {\n coords.x = this._wrapLng ? L.Util.wrapNum(coords.x, this._wrapLng) : coords.x;\n coords.y = this._wrapLat ? L.Util.wrapNum(coords.y, this._wrapLat) : coords.y;\n }\n\n // get the global cell coordinates range for the current zoom\n // @TODO enable at Leaflet 0.8\n // _getCellNumBounds: function () {\n // // @TODO for Leaflet 0.8\n // // var bounds = this._map.getPixelWorldBounds(),\n // // size = this._getCellSize();\n // //\n // // return bounds ? L.bounds(\n // // bounds.min.divideBy(size).floor(),\n // // bounds.max.divideBy(size).ceil().subtract([1, 1])) : null;\n // }\n\n});","(function(EsriLeaflet){\n\n EsriLeaflet.Layers.FeatureManager = EsriLeaflet.Layers.FeatureGrid.extend({\n\n /**\n * Options\n */\n\n options: {\n where: '1=1',\n fields: ['*'],\n from: false,\n to: false,\n timeField: false,\n timeFilterMode: 'server',\n simplifyFactor: 0,\n precision: 6\n },\n\n /**\n * Constructor\n */\n\n initialize: function (url, options) {\n EsriLeaflet.Layers.FeatureGrid.prototype.initialize.call(this, options);\n\n options = L.setOptions(this, options);\n\n this.url = EsriLeaflet.Util.cleanUrl(url);\n\n this._service = new EsriLeaflet.Services.FeatureLayer(this.url, options);\n\n //use case insensitive regex to look for common fieldnames used for indexing\n /*global console */\n if (this.options.fields[0] !== '*'){\n var oidCheck = false;\n for (var i = 0; i < this.options.fields.length; i++){\n if (this.options.fields[i].match(/^(OBJECTID|FID|OID|ID)$/i)){\n oidCheck = true;\n }\n }\n if (oidCheck === false && console && console.warn){\n console.warn('no known esriFieldTypeOID field detected in fields Array. Please add an attribute field containing unique IDs to ensure the layer can be drawn correctly.');\n }\n }\n\n // Leaflet 0.8 change to new propagation\n this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', function (e) {\n e = L.extend({\n target: this\n }, e);\n this.fire(e.type, e);\n }, this);\n\n if(this.options.timeField.start && this.options.timeField.end){\n this._startTimeIndex = new BinarySearchIndex();\n this._endTimeIndex = new BinarySearchIndex();\n } else if(this.options.timeField){\n this._timeIndex = new BinarySearchIndex();\n }\n\n this._currentSnapshot = []; // cache of what layers should be active\n this._activeRequests = 0;\n this._pendingRequests = [];\n },\n\n /**\n * Layer Interface\n */\n\n onAdd: function(map){\n return EsriLeaflet.Layers.FeatureGrid.prototype.onAdd.call(this, map);\n },\n\n onRemove: function(map){\n return EsriLeaflet.Layers.FeatureGrid.prototype.onRemove.call(this, map);\n },\n\n getAttribution: function () {\n return this.options.attribution;\n },\n\n /**\n * Feature Managment\n */\n\n createCell: function(bounds, coords){\n this._requestFeatures(bounds, coords);\n },\n\n _requestFeatures: function(bounds, coords, callback){\n this._activeRequests++;\n\n // our first active request fires loading\n if(this._activeRequests === 1){\n this.fire('loading', {\n bounds: bounds\n });\n }\n\n return this._buildQuery(bounds).run(function(error, featureCollection, response){\n if(response && response.exceededTransferLimit){\n this.fire('drawlimitexceeded');\n }\n\n //deincriment the request counter\n this._activeRequests--;\n\n if(!error && featureCollection.features.length){\n this._addFeatures(featureCollection.features, coords);\n }\n\n if(callback){\n callback.call(this, error, featureCollection);\n }\n\n // if there are no more active requests fire a load event for this view\n if(this._activeRequests <= 0){\n this.fire('load', {\n bounds: bounds\n });\n }\n }, this);\n },\n\n _addFeatures: function(features){\n for (var i = features.length - 1; i >= 0; i--) {\n var id = features[i].id;\n this._currentSnapshot.push(id);\n }\n\n if(this.options.timeField){\n this._buildTimeIndexes(features);\n }\n\n this.createLayers(features);\n },\n\n _buildQuery: function(bounds){\n var query = this._service.query().intersects(bounds).where(this.options.where).fields(this.options.fields).precision(this.options.precision);\n\n if(this.options.simplifyFactor){\n query.simplify(this._map, this.options.simplifyFactor);\n }\n\n if(this.options.timeFilterMode === 'server' && this.options.from && this.options.to){\n query.between(this.options.from, this.options.to);\n }\n\n return query;\n },\n\n /**\n * Where Methods\n */\n\n setWhere: function(where, callback, context){\n\n this.options.where = (where && where.length) ? where : '1=1';\n\n var oldSnapshot = [];\n var newShapshot = [];\n var pendingRequests = 0;\n var requestError = null;\n var requestCallback = L.Util.bind(function(error, featureCollection){\n if(error){\n requestError = error;\n }\n\n if(featureCollection){\n for (var i = featureCollection.features.length - 1; i >= 0; i--) {\n newShapshot.push(featureCollection.features[i].id);\n }\n }\n\n pendingRequests--;\n\n if(pendingRequests <= 0){\n this._currentSnapshot = newShapshot;\n this.removeLayers(oldSnapshot);\n this.addLayers(newShapshot);\n if(callback) {\n callback.call(context, requestError);\n }\n }\n }, this);\n\n for (var i = this._currentSnapshot.length - 1; i >= 0; i--) {\n oldSnapshot.push(this._currentSnapshot[i]);\n }\n\n for(var key in this._activeCells){\n pendingRequests++;\n var coords = this._keyToCellCoords(key);\n var bounds = this._cellCoordsToBounds(coords);\n this._requestFeatures(bounds, key, requestCallback);\n }\n\n return this;\n },\n\n getWhere: function(){\n return this.options.where;\n },\n\n /**\n * Time Range Methods\n */\n\n getTimeRange: function(){\n return [this.options.from, this.options.to];\n },\n\n setTimeRange: function(from, to, callback, context){\n var oldFrom = this.options.from;\n var oldTo = this.options.to;\n var pendingRequests = 0;\n var requestError = null;\n var requestCallback = L.Util.bind(function(error){\n if(error){\n requestError = error;\n }\n this._filterExistingFeatures(oldFrom, oldTo, from, to);\n\n pendingRequests--;\n\n if(callback && pendingRequests <= 0){\n callback.call(context, requestError);\n }\n }, this);\n\n this.options.from = from;\n this.options.to = to;\n\n this._filterExistingFeatures(oldFrom, oldTo, from, to);\n\n if(this.options.timeFilterMode === 'server') {\n for(var key in this._activeCells){\n pendingRequests++;\n var coords = this._keyToCellCoords(key);\n var bounds = this._cellCoordsToBounds(coords);\n this._requestFeatures(bounds, key, requestCallback);\n }\n }\n },\n\n refresh: function(){\n for(var key in this._activeCells){\n var coords = this._keyToCellCoords(key);\n var bounds = this._cellCoordsToBounds(coords);\n this._requestFeatures(bounds, key);\n }\n },\n\n _filterExistingFeatures: function (oldFrom, oldTo, newFrom, newTo) {\n var layersToRemove = (oldFrom && oldTo) ? this._getFeaturesInTimeRange(oldFrom, oldTo) : this._currentSnapshot;\n var layersToAdd = this._getFeaturesInTimeRange(newFrom, newTo);\n\n if(layersToAdd.indexOf){\n for (var i = 0; i < layersToAdd.length; i++) {\n var shouldRemoveLayer = layersToRemove.indexOf(layersToAdd[i]);\n if(shouldRemoveLayer >= 0){\n layersToRemove.splice(shouldRemoveLayer, 1);\n }\n }\n }\n\n this.removeLayers(layersToRemove);\n this.addLayers(layersToAdd);\n },\n\n _getFeaturesInTimeRange: function(start, end){\n var ids = [];\n var search;\n\n if(this.options.timeField.start && this.options.timeField.end){\n var startTimes = this._startTimeIndex.between(start, end);\n var endTimes = this._endTimeIndex.between(start, end);\n search = startTimes.concat(endTimes);\n } else {\n search = this._timeIndex.between(start, end);\n }\n\n for (var i = search.length - 1; i >= 0; i--) {\n ids.push(search[i].id);\n }\n\n return ids;\n },\n\n _buildTimeIndexes: function(geojson){\n var i;\n var feature;\n if(this.options.timeField.start && this.options.timeField.end){\n var startTimeEntries = [];\n var endTimeEntries = [];\n for (i = geojson.length - 1; i >= 0; i--) {\n feature = geojson[i];\n startTimeEntries.push( {\n id: feature.id,\n value: new Date(feature.properties[this.options.timeField.start])\n });\n endTimeEntries.push( {\n id: feature.id,\n value: new Date(feature.properties[this.options.timeField.end])\n });\n }\n this._startTimeIndex.bulkAdd(startTimeEntries);\n this._endTimeIndex.bulkAdd(endTimeEntries);\n } else {\n var timeEntries = [];\n for (i = geojson.length - 1; i >= 0; i--) {\n feature = geojson[i];\n timeEntries.push( {\n id: feature.id,\n value: new Date(feature.properties[this.options.timeField])\n });\n }\n\n this._timeIndex.bulkAdd(timeEntries);\n }\n },\n\n _featureWithinTimeRange: function(feature){\n if(!this.options.from || !this.options.to){\n return true;\n }\n\n var from = +this.options.from.valueOf();\n var to = +this.options.to.valueOf();\n\n if(typeof this.options.timeField === 'string'){\n var date = +feature.properties[this.options.timeField];\n return (date >= from) && (date <= to);\n }\n\n if(this.options.timeField.start && this.options.timeField.end){\n var startDate = +feature.properties[this.options.timeField.start];\n var endDate = +feature.properties[this.options.timeField.end];\n return ((startDate >= from) && (startDate <= to)) || ((endDate >= from) && (endDate <= to));\n }\n },\n\n /**\n * Service Methods\n */\n\n authenticate: function(token){\n this._service.authenticate(token);\n return this;\n },\n\n metadata: function(callback, context){\n this._service.metadata(callback, context);\n return this;\n },\n\n query: function(){\n return this._service.query();\n },\n\n addFeature: function(feature, callback, context){\n this._service.addFeature(feature, function(error, response){\n if(!error){\n this.refresh();\n }\n if(callback){\n callback.call(context, error, response);\n }\n }, this);\n return this;\n },\n\n updateFeature: function(feature, callback, context){\n return this._service.updateFeature(feature, function(error, response){\n if(!error){\n this.refresh();\n }\n if(callback){\n callback.call(context, error, response);\n }\n }, this);\n },\n\n deleteFeature: function(id, callback, context){\n return this._service.deleteFeature(id, function(error, response){\n if(!error && response.objectId){\n this.removeLayers([response.objectId], true);\n }\n if(callback){\n callback.call(context, error, response);\n }\n }, this);\n }\n });\n\n /**\n * Temporal Binary Search Index\n */\n\n function BinarySearchIndex(values) {\n this.values = values || [];\n }\n\n BinarySearchIndex.prototype._query = function(query){\n var minIndex = 0;\n var maxIndex = this.values.length - 1;\n var currentIndex;\n var currentElement;\n var resultIndex;\n\n while (minIndex <= maxIndex) {\n resultIndex = currentIndex = (minIndex + maxIndex) / 2 | 0;\n currentElement = this.values[Math.round(currentIndex)];\n if (+currentElement.value < +query) {\n minIndex = currentIndex + 1;\n } else if (+currentElement.value > +query) {\n maxIndex = currentIndex - 1;\n } else {\n return currentIndex;\n }\n }\n\n return ~maxIndex;\n };\n\n BinarySearchIndex.prototype.sort = function(){\n this.values.sort(function(a, b) {\n return +b.value - +a.value;\n }).reverse();\n this.dirty = false;\n };\n\n BinarySearchIndex.prototype.between = function(start, end){\n if(this.dirty){\n this.sort();\n }\n\n var startIndex = this._query(start);\n var endIndex = this._query(end);\n\n if(startIndex === 0 && endIndex === 0){\n return [];\n }\n\n startIndex = Math.abs(startIndex);\n endIndex = (endIndex < 0) ? Math.abs(endIndex): endIndex + 1;\n\n return this.values.slice(startIndex, endIndex);\n };\n\n BinarySearchIndex.prototype.bulkAdd = function(items){\n this.dirty = true;\n this.values = this.values.concat(items);\n };\n\n})(EsriLeaflet);","EsriLeaflet.Layers.FeatureLayer = EsriLeaflet.Layers.FeatureManager.extend({\n\n statics: {\n EVENTS: 'click dblclick mouseover mouseout mousemove contextmenu popupopen popupclose'\n },\n\n /**\n * Constructor\n */\n\n initialize: function (url, options) {\n EsriLeaflet.Layers.FeatureManager.prototype.initialize.call(this, url, options);\n\n options = L.setOptions(this, options);\n\n this._layers = {};\n this._leafletIds = {};\n this._key = 'c'+(Math.random() * 1e9).toString(36).replace('.', '_');\n },\n\n /**\n * Layer Interface\n */\n\n onAdd: function(map){\n return EsriLeaflet.Layers.FeatureManager.prototype.onAdd.call(this, map);\n },\n\n onRemove: function(map){\n\n for (var i in this._layers) {\n map.removeLayer(this._layers[i]);\n }\n\n return EsriLeaflet.Layers.FeatureManager.prototype.onRemove.call(this, map);\n },\n\n createNewLayer: function(geojson){\n // @TODO Leaflet 0.8\n //newLayer = L.GeoJSON.geometryToLayer(geojson, this.options);\n return L.GeoJSON.geometryToLayer(geojson, this.options.pointToLayer, L.GeoJSON.coordsToLatLng, this.options);\n },\n\n /**\n * Feature Managment Methods\n */\n\n createLayers: function(features){\n for (var i = features.length - 1; i >= 0; i--) {\n\n var geojson = features[i];\n\n var layer = this._layers[geojson.id];\n var newLayer;\n\n if(layer && !this._map.hasLayer(layer)){\n this._map.addLayer(layer);\n }\n\n if (layer && layer.setLatLngs) {\n // @TODO Leaflet 0.8\n //newLayer = L.GeoJSON.geometryToLayer(geojson, this.options);\n\n var updateGeo = this.createNewLayer(geojson);\n layer.setLatLngs(updateGeo.getLatLngs());\n }\n\n if(!layer){\n // @TODO Leaflet 0.8\n //newLayer = L.GeoJSON.geometryToLayer(geojson, this.options);\n\n newLayer = this.createNewLayer(geojson);\n newLayer.feature = geojson;\n newLayer.defaultOptions = newLayer.options;\n newLayer._leaflet_id = this._key + '_' + geojson.id;\n\n this._leafletIds[newLayer._leaflet_id] = geojson.id;\n\n // bubble events from layers to this\n // @TODO Leaflet 0.8\n // newLayer.addEventParent(this);\n\n newLayer.on(EsriLeaflet.Layers.FeatureLayer.EVENTS, this._propagateEvent, this);\n\n // bind a popup if we have one\n if(this._popup && newLayer.bindPopup){\n newLayer.bindPopup(this._popup(newLayer.feature, newLayer), this._popupOptions);\n }\n\n if(this.options.onEachFeature){\n this.options.onEachFeature(newLayer.feature, newLayer);\n }\n\n // cache the layer\n this._layers[newLayer.feature.id] = newLayer;\n\n // style the layer\n this.resetStyle(newLayer.feature.id);\n\n this.fire('createfeature', {\n feature: newLayer.feature\n });\n\n // add the layer if it is within the time bounds or our layer is not time enabled\n if(!this.options.timeField || (this.options.timeField && this._featureWithinTimeRange(geojson)) ){\n this._map.addLayer(newLayer);\n }\n }\n }\n },\n\n addLayers: function(ids){\n for (var i = ids.length - 1; i >= 0; i--) {\n var layer = this._layers[ids[i]];\n if(layer){\n this.fire('addfeature', {\n feature: layer.feature\n });\n this._map.addLayer(layer);\n }\n }\n },\n\n removeLayers: function(ids, permanent){\n for (var i = ids.length - 1; i >= 0; i--) {\n var id = ids[i];\n var layer = this._layers[id];\n if(layer){\n this.fire('removefeature', {\n feature: layer.feature,\n permanent: permanent\n });\n this._map.removeLayer(layer);\n }\n if(layer && permanent){\n delete this._layers[id];\n }\n }\n },\n\n /**\n * Styling Methods\n */\n\n resetStyle: function (id) {\n var layer = this._layers[id];\n\n if(layer){\n layer.options = layer.defaultOptions;\n this.setFeatureStyle(layer.feature.id, this.options.style);\n }\n\n return this;\n },\n\n setStyle: function (style) {\n this.options.style = style;\n this.eachFeature(function (layer) {\n this.setFeatureStyle(layer.feature.id, style);\n }, this);\n return this;\n },\n\n setFeatureStyle: function (id, style) {\n var layer = this._layers[id];\n\n if (typeof style === 'function') {\n style = style(layer.feature);\n }\n if (layer.setStyle) {\n layer.setStyle(style);\n }\n },\n\n /**\n * Popup Methods\n */\n\n bindPopup: function (fn, options) {\n this._popup = fn;\n this._popupOptions = options;\n for (var i in this._layers) {\n var layer = this._layers[i];\n var popupContent = this._popup(layer.feature, layer);\n layer.bindPopup(popupContent, options);\n }\n return this;\n },\n\n unbindPopup: function () {\n this._popup = false;\n for (var i in this._layers) {\n var layer = this._layers[i];\n if (layer.unbindPopup) {\n layer.unbindPopup();\n } else if (layer.getLayers) {\n var groupLayers = layer.getLayers();\n for (var j in groupLayers) {\n var gLayer = groupLayers[j];\n gLayer.unbindPopup();\n }\n }\n }\n return this;\n },\n\n /**\n * Utility Methods\n */\n\n eachFeature: function (fn, context) {\n for (var i in this._layers) {\n fn.call(context, this._layers[i]);\n }\n return this;\n },\n\n getFeature: function (id) {\n return this._layers[id];\n },\n\n // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js\n // @TODO remove at Leaflet 0.8\n _propagateEvent: function (e) {\n e.layer = this._layers[this._leafletIds[e.target._leaflet_id]];\n e.target = this;\n this.fire(e.type, e);\n }\n});\n\nEsriLeaflet.FeatureLayer = EsriLeaflet.Layers.FeatureLayer;\n\nEsriLeaflet.Layers.featureLayer = function(url, options){\n return new EsriLeaflet.Layers.FeatureLayer(url, options);\n};\n\nEsriLeaflet.featureLayer = function(url, options){\n return new EsriLeaflet.Layers.FeatureLayer(url, options);\n};\n"]} \ No newline at end of file diff --git a/dist/builds/feature-layer/esri-leaflet-feature-layer.js b/dist/builds/feature-layer/esri-leaflet-feature-layer.js new file mode 100644 index 000000000..b5be2a70d --- /dev/null +++ b/dist/builds/feature-layer/esri-leaflet-feature-layer.js @@ -0,0 +1,24 @@ +/*! esri-leaflet - v1.0.0-rc.3 - 2014-11-04 +* Copyright (c) 2014 Environmental Systems Research Institute, Inc. +* Apache License*/ +(function (factory) { + //define an AMD module that relies on 'leaflet' + if (typeof define === 'function' && define.amd) { + define(['leaflet'], function (L) { + return factory(L); + }); + //define a common js module that relies on 'leaflet' + } else if (typeof module === 'object' && typeof module.exports === 'object') { + module.exports = factory(require('leaflet')); + } + + if(typeof window !== 'undefined' && window.L){ + factory(window.L); + } +}(function (L) { + +var EsriLeaflet={VERSION:"1.0.0-rc.2",Layers:{},Services:{},Controls:{},Tasks:{},Util:{},Support:{CORS:!!(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),pointerEvents:""===document.documentElement.style.pointerEvents}};"undefined"!=typeof window&&window.L&&(window.L.esri=EsriLeaflet),function(a){function b(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function c(a,b){for(var c=0;cd;d++)b=a[d+1],c+=(b[0]-f[0])*(b[1]+f[1]),f=b;return c>=0}function f(a,b,c,d){var e=(d[0]-c[0])*(a[1]-c[1])-(d[1]-c[1])*(a[0]-c[0]),f=(b[0]-a[0])*(a[1]-c[1])-(b[1]-a[1])*(a[0]-c[0]),g=(d[1]-c[1])*(b[0]-a[0])-(d[0]-c[0])*(b[1]-a[1]);if(0!==g){var h=e/g,i=f/g;if(h>=0&&1>=h&&i>=0&&1>=i)return!0}return!1}function g(a,b){for(var c=0;c=0;b--)if(c=h[b][0],i(c,f)){h[b].push(f),o=!0;break}o||n.push(f)}for(;n.length;){f=n.pop();var p=!1;for(b=h.length-1;b>=0;b--)if(c=h[b][0],g(c,f)){h[b].push(f),p=!0;break}p||h.push([f.reverse()])}return 1===h.length?{type:"Polygon",coordinates:h[0]}:{type:"MultiPolygon",coordinates:h}}function k(a){var b=[],c=a.slice(0),f=d(c.shift().slice(0));if(f.length>=4){e(f)||f.reverse(),b.push(f);for(var g=0;g=4&&(e(h)&&h.reverse(),b.push(h))}}return b}function l(a){for(var b=[],c=0;c=0;e--){var f=d[e].slice(0);b.push(f)}return b}a.Util.extentToBounds=function(a){var b=new L.LatLng(a.ymin,a.xmin),c=new L.LatLng(a.ymax,a.xmax);return new L.LatLngBounds(b,c)},a.Util.boundsToExtent=function(a){return a=L.latLngBounds(a),{xmin:a.getSouthWest().lng,ymin:a.getSouthWest().lat,xmax:a.getNorthEast().lng,ymax:a.getNorthEast().lat,spatialReference:{wkid:4326}}},a.Util.arcgisToGeojson=function(c,d){var e={};return"number"==typeof c.x&&"number"==typeof c.y&&(e.type="Point",e.coordinates=[c.x,c.y]),c.points&&(e.type="MultiPoint",e.coordinates=c.points.slice(0)),c.paths&&(1===c.paths.length?(e.type="LineString",e.coordinates=c.paths[0].slice(0)):(e.type="MultiLineString",e.coordinates=c.paths.slice(0))),c.rings&&(e=j(c.rings.slice(0))),(c.geometry||c.attributes)&&(e.type="Feature",e.geometry=c.geometry?a.Util.arcgisToGeojson(c.geometry):null,e.properties=c.attributes?b(c.attributes):null,c.attributes&&(e.id=c.attributes[d]||c.attributes.OBJECTID||c.attributes.FID)),e},a.Util.geojsonToArcGIS=function(c,d){d=d||"OBJECTID";var e,f={wkid:4326},g={};switch(c.type){case"Point":g.x=c.coordinates[0],g.y=c.coordinates[1],g.spatialReference=f;break;case"MultiPoint":g.points=c.coordinates.slice(0),g.spatialReference=f;break;case"LineString":g.paths=[c.coordinates.slice(0)],g.spatialReference=f;break;case"MultiLineString":g.paths=c.coordinates.slice(0),g.spatialReference=f;break;case"Polygon":g.rings=k(c.coordinates.slice(0)),g.spatialReference=f;break;case"MultiPolygon":g.rings=l(c.coordinates.slice(0)),g.spatialReference=f;break;case"Feature":c.geometry&&(g.geometry=a.Util.geojsonToArcGIS(c.geometry,d)),g.attributes=c.properties?b(c.properties):{},c.id&&(g.attributes[d]=c.id);break;case"FeatureCollection":for(g=[],e=0;e=0;h--)f.features.push(a.Util.arcgisToGeojson(g[h],d));return f},a.Util.cleanUrl=function(a){return a=a.replace(/\s\s*/g,""),"/"!==a[a.length-1]&&(a+="/"),a},a.Util.geojsonTypeToArcGIS=function(a){var b;switch(a){case"Point":b="esriGeometryPoint";break;case"MultiPoint":b="esriGeometryMultipoint";break;case"LineString":b="esriGeometryPolyline";break;case"MultiLineString":b="esriGeometryPolyline";break;case"Polygon":b="esriGeometryPolygon";break;case"MultiPolygon":b="esriGeometryPolygon"}return b}}(EsriLeaflet),function(a){function b(a){var b="";a.f="json";for(var c in a)if(a.hasOwnProperty(c)){var d,e=a[c],f=Object.prototype.toString.call(e);b.length&&(b+="&"),d="[object Array]"===f||"[object Object]"===f?JSON.stringify(e):"[object Date]"===f?e.valueOf():e,b+=encodeURIComponent(c)+"="+encodeURIComponent(d)}return b}function c(a,b){var c=new XMLHttpRequest;return c.onerror=function(){a.call(b,{error:{code:500,message:"XMLHttpRequest error"}},null)},c.onreadystatechange=function(){var d,e;if(4===c.readyState){try{d=JSON.parse(c.responseText)}catch(f){d=null,e={code:500,message:"Could not parse response as JSON."}}!e&&d.error&&(e=d.error,d=null),a.call(b,e,d)}},c}var d=0;window._EsriLeafletCallbacks={},a.Request={request:function(a,d,e,f){var g=b(d),h=c(e,f),i=(a+"?"+g).length;if(2e3>=i&&L.esri.Support.CORS)h.open("GET",a+"?"+g),h.send(null);else if(i>2e3&&L.esri.Support.CORS)h.open("POST",a),h.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),h.send(g);else{if(2e3>=i&&!L.esri.Support.CORS)return L.esri.Request.get.JSONP(a,d,e,f);if(console&&console.warn)return void console.warn("a request to "+a+" 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")}return h},post:{XMLHTTP:function(a,d,e,f){var g=c(e,f);return g.open("POST",a),g.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),g.send(b(d)),g}},get:{CORS:function(a,d,e,f){var g=c(e,f);return g.open("GET",a+"?"+b(d),!0),g.send(null),g},JSONP:function(a,c,e,f){var g="c"+d;c.callback="window._EsriLeafletCallbacks."+g;var h=L.DomUtil.create("script",null,document.body);return h.type="text/javascript",h.src=a+"?"+b(c),h.id=g,window._EsriLeafletCallbacks[g]=function(a){if(window._EsriLeafletCallbacks[g]!==!0){var b,c=Object.prototype.toString.call(a);"[object Object]"!==c&&"[object Array]"!==c&&(b={error:{code:500,message:"Expected array or object as JSONP response"}},a=null),!b&&a.error&&(b=a,a=null),e.call(f,b,a),window._EsriLeafletCallbacks[g]=!0}},d++,{id:g,url:h.src,abort:function(){window._EsriLeafletCallbacks._callback[g]({code:0,message:"Request aborted."})}}}}},a.get=a.Support.CORS?a.Request.get.CORS:a.Request.get.JSONP,a.post=a.Request.post.XMLHTTP,a.request=a.Request.request}(EsriLeaflet),EsriLeaflet.Services.Service=L.Class.extend({includes:L.Mixin.Events,options:{proxy:!1,useCors:EsriLeaflet.Support.CORS},initialize:function(a,b){this.url=EsriLeaflet.Util.cleanUrl(a),this._requestQueue=[],this._authenticating=!1,L.Util.setOptions(this,b)},get:function(a,b,c,d){return this._request("get",a,b,c,d)},post:function(a,b,c,d){return this._request("post",a,b,c,d)},request:function(a,b,c,d){return this._request("request",a,b,c,d)},metadata:function(a,b){return this._request("get","",{},a,b)},authenticate:function(a){return this._authenticating=!1,this.options.token=a,this._runQueue(),this},_request:function(a,b,c,d,e){this.fire("requeststart",{url:this.url+b,params:c,method:a});var f=this._createServiceCallback(a,b,c,d,e);if(this.options.token&&(c.token=this.options.token),this._authenticating)return void this._requestQueue.push([a,b,c,d,e]);var g=this.options.proxy?this.options.proxy+"?"+this.url+b:this.url+b;return"get"!==a&&"request"!==a||this.options.useCors?EsriLeaflet[a](g,c,f):EsriLeaflet.Request.get.JSONP(g,c,f)},_createServiceCallback:function(a,b,c,d,e){var f=[a,b,c,d,e];return L.Util.bind(function(g,h){!g||499!==g.code&&498!==g.code?(d.call(e,g,h),g?this.fire("requesterror",{url:this.url+b,params:c,message:g.message,code:g.code,method:a}):this.fire("requestsuccess",{url:this.url+b,params:c,response:h,method:a}),this.fire("requestend",{url:this.url+b,params:c,method:a})):(this._authenticating=!0,this._requestQueue.push(f),this.fire("authenticationrequired",{authenticate:L.Util.bind(this.authenticate,this)}))},this)},_runQueue:function(){for(var a=this._requestQueue.length-1;a>=0;a--){var b=this._requestQueue[a],c=b.shift();this[c].apply(this,b)}this._requestQueue=[]}}),EsriLeaflet.Services.service=function(a,b){return new EsriLeaflet.Services.Service(a,b)},EsriLeaflet.Services.FeatureLayer=EsriLeaflet.Services.Service.extend({options:{idAttribute:"OBJECTID"},query:function(){return new EsriLeaflet.Tasks.Query(this)},addFeature:function(a,b,c){return delete a.id,a=EsriLeaflet.Util.geojsonToArcGIS(a),this.post("addFeatures",{features:[a]},function(a,c){var d=c&&c.addResults?c.addResults[0]:void 0;b&&b.call(this,a||c.addResults[0].error,d)},c)},updateFeature:function(a,b,c){return a=EsriLeaflet.Util.geojsonToArcGIS(a,this.options.idAttribute),this.post("updateFeatures",{features:[a]},function(a,d){var e=d&&d.updateResults?d.updateResults[0]:void 0;b&&b.call(c,a||d.updateResults[0].error,e)},c)},deleteFeature:function(a,b,c){return this.post("deleteFeatures",{objectIds:a},function(a,d){var e=d&&d.deleteResults?d.deleteResults[0]:void 0;b&&b.call(c,a||d.deleteResults[0].error,e)},c)}}),EsriLeaflet.Services.featureLayer=function(a,b){return new EsriLeaflet.Services.FeatureLayer(a,b)},EsriLeaflet.Tasks.Task=L.Class.extend({options:{proxy:!1,useCors:EsriLeaflet.Support.CORS},generateSetter:function(a,b){var c=a.match(/([a-zA-Z]+)\[\]/);return a=c?c[1]:a,c?L.Util.bind(function(b){return this.params[a]=L.Util.isArray(b)?b.join(","):b,this},b):L.Util.bind(function(b){return this.params[a]=b,this},b)},initialize:function(a,b){if(a.url&&a.request?(this._service=a,this.url=a.url):this.url=EsriLeaflet.Util.cleanUrl(a),this.params=L.Util.extend({},this.params||{}),this.setters)for(var c in this.setters){var d=this.setters[c];this[c]=this.generateSetter(d,this)}L.Util.setOptions(this,b)},token:function(a){return this._service?this._service.authenticate(a):this.params.token=a,this},request:function(a,b){return this._service?this._service.request(this.path,this.params,a,b):this._request("request",this.path,this.params,a,b)},_request:function(a,b,c,d,e){var f=this.options.proxy?this.options.proxy+"?"+this.url+b:this.url+b;return"get"!==a&&"request"!==a||this.options.useCors?EsriLeaflet[a](f,c,d,e):EsriLeaflet.Request.get.JSONP(f,c,d,e)}}),EsriLeaflet.Tasks.Query=EsriLeaflet.Tasks.Task.extend({setters:{offset:"offset",limit:"limit",outFields:"fields[]",precision:"geometryPrecision",featureIds:"objectIds[]",returnGeometry:"returnGeometry",token:"token"},path:"query",params:{returnGeometry:!0,where:"1=1",outSr:4326,outFields:"*"},within:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelContains",this},intersects:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelIntersects",this},contains:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelWithin",this},overlaps:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelOverlaps",this},nearby:function(a,b){return a=L.latLng(a),this.params.geometry=[a.lng,a.lat].join(","),this.params.geometryType="esriGeometryPoint",this.params.spatialRel="esriSpatialRelIntersects",this.params.units="esriSRUnit_Meter",this.params.distance=b,this.params.inSr=4326,this},where:function(a){return this.params.where=a.replace(/"/g,"'"),this},between:function(a,b){return this.params.time=[a.valueOf(),b.valueOf()].join(),this},fields:function(a){return this.params.outFields=L.Util.isArray(a)?a.join(","):a,this},simplify:function(a,b){var c=Math.abs(a.getBounds().getWest()-a.getBounds().getEast());return this.params.maxAllowableOffset=c/a.getSize().y*b,this},orderBy:function(a,b){return b=b||"ASC",this.params.orderByFields=this.params.orderByFields?this.params.orderByFields+",":"",this.params.orderByFields+=[a,b].join(" "),this},returnGeometry:function(a){return this.params.returnGeometry=a,this},run:function(a,b){return this._cleanParams(),this.request(function(c,d){a.call(b,c,d&&EsriLeaflet.Util.responseToFeatureCollection(d),d)},b)},count:function(a,b){return this._cleanParams(),this.params.returnCountOnly=!0,this.request(function(b,c){a.call(this,b,c&&c.count,c)},b)},ids:function(a,b){return this._cleanParams(),this.params.returnIdsOnly=!0,this.request(function(b,c){a.call(this,b,c&&c.objectIds,c)},b)},bounds:function(a,b){return this._cleanParams(),this.params.returnExtentOnly=!0,this.request(function(c,d){a.call(b,c,d&&d.extent&&EsriLeaflet.Util.extentToBounds(d.extent),d)},b)},pixelSize:function(a){return a=L.point(a),this.params.pixelSize=[a.x,a.y].join(","),this},layer:function(a){return this.path=a+"/query",this},_cleanParams:function(){delete this.params.returnIdsOnly,delete this.params.returnExtentOnly,delete this.params.returnCountOnly},_setGeometry:function(a){return this.params.inSr=4326,a instanceof L.LatLngBounds?(this.params.geometry=EsriLeaflet.Util.boundsToExtent(a),void(this.params.geometryType="esriGeometryEnvelope")):(a.getLatLng&&(a=a.getLatLng()),a instanceof L.LatLng&&(a={type:"Point",coordinates:[a.lng,a.lat]}),a instanceof L.GeoJSON&&(a=a.getLayers()[0].feature.geometry,this.params.geometry=EsriLeaflet.Util.geojsonToArcGIS(a),this.params.geometryType=EsriLeaflet.Util.geojsonTypeToArcGIS(a.type)),a.toGeoJSON&&(a=a.toGeoJSON()),"Feature"===a.type&&(a=a.geometry),"Point"===a.type||"LineString"===a.type||"Polygon"===a.type?(this.params.geometry=EsriLeaflet.Util.geojsonToArcGIS(a),void(this.params.geometryType=EsriLeaflet.Util.geojsonTypeToArcGIS(a.type))):void(console&&console.warn&&console.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")))}}),EsriLeaflet.Tasks.query=function(a,b){return new EsriLeaflet.Tasks.Query(a,b)},EsriLeaflet.Layers.FeatureGrid=L.Class.extend({includes:L.Mixin.Events,options:{cellSize:512,updateInterval:150},initialize:function(a){a=L.setOptions(this,a)},onAdd:function(a){this._map=a,this._update=L.Util.limitExecByInterval(this._update,this.options.updateInterval,this),this._map.addEventListener(this.getEvents(),this),this._reset(),this._update()},onRemove:function(){this._map.removeEventListener(this.getEvents(),this),this._removeCells()},getEvents:function(){var a={viewreset:this._reset,moveend:this._update};return a},addTo:function(a){return a.addLayer(this),this},removeFrom:function(a){return a.removeLayer(this),this},_reset:function(){this._removeCells(),this._cells={},this._activeCells={},this._cellsToLoad=0,this._cellsTotal=0,this._resetWrap()},_resetWrap:function(){var a=this._map,b=a.options.crs;if(!b.infinite){var c=this._getCellSize();b.wrapLng&&(this._wrapLng=[Math.floor(a.project([0,b.wrapLng[0]]).x/c),Math.ceil(a.project([0,b.wrapLng[1]]).x/c)]),b.wrapLat&&(this._wrapLat=[Math.floor(a.project([b.wrapLat[0],0]).y/c),Math.ceil(a.project([b.wrapLat[1],0]).y/c)])}},_getCellSize:function(){return this.options.cellSize},_update:function(){if(this._map){var a=this._map.getPixelBounds(),b=this._map.getZoom(),c=this._getCellSize();if(!(b>this.options.maxZoom||bc;c++)this._addCell(e[c])},_cellCoordsToBounds:function(a){var b=this._map,c=this.options.cellSize,d=a.multiplyBy(c),e=d.add([c,c]),f=b.unproject(d,a.z).wrap(),g=b.unproject(e,a.z).wrap();return new L.LatLngBounds(f,g)},_cellCoordsToKey:function(a){return a.x+":"+a.y},_keyToCellCoords:function(a){var b=a.split(":"),c=parseInt(b[0],10),d=parseInt(b[1],10);return new L.Point(c,d)},_removeOtherCells:function(a){for(var b in this._cells)a.contains(this._keyToCellCoords(b))||this._removeCell(b)},_removeCell:function(a){var b=this._activeCells[a];b&&(delete this._activeCells[a],this.cellLeave&&this.cellLeave(b.bounds,b.coords),this.fire("cellleave",{bounds:b.bounds,coords:b.coords}))},_removeCells:function(){for(var a in this._cells){var b=this._cells[a].bounds,c=this._cells[a].coords;this.cellLeave&&this.cellLeave(b,c),this.fire("cellleave",{bounds:b,coords:c})}},_addCell:function(a){this._wrapCoords(a);var b=this._cellCoordsToKey(a),c=this._cells[b];c&&!this._activeCells[b]&&(this.cellEnter&&this.cellEnter(c.bounds,a),this.fire("cellenter",{bounds:c.bounds,coords:a}),this._activeCells[b]=c),c||(c={coords:a,bounds:this._cellCoordsToBounds(a)},this._cells[b]=c,this._activeCells[b]=c,this.createCell&&this.createCell(c.bounds,a),this.fire("cellcreate",{bounds:c.bounds,coords:a}))},_wrapCoords:function(a){a.x=this._wrapLng?L.Util.wrapNum(a.x,this._wrapLng):a.x,a.y=this._wrapLat?L.Util.wrapNum(a.y,this._wrapLat):a.y}}),function(a){function b(a){this.values=a||[]}a.Layers.FeatureManager=a.Layers.FeatureGrid.extend({options:{where:"1=1",fields:["*"],from:!1,to:!1,timeField:!1,timeFilterMode:"server",simplifyFactor:0,precision:6},initialize:function(c,d){if(a.Layers.FeatureGrid.prototype.initialize.call(this,d),d=L.setOptions(this,d),this.url=a.Util.cleanUrl(c),this._service=new a.Services.FeatureLayer(this.url,d),"*"!==this.options.fields[0]){for(var e=!1,f=0;f=0;b--){var c=a[b].id;this._currentSnapshot.push(c)}this.options.timeField&&this._buildTimeIndexes(a),this.createLayers(a)},_buildQuery:function(a){var b=this._service.query().intersects(a).where(this.options.where).fields(this.options.fields).precision(this.options.precision);return this.options.simplifyFactor&&b.simplify(this._map,this.options.simplifyFactor),"server"===this.options.timeFilterMode&&this.options.from&&this.options.to&&b.between(this.options.from,this.options.to),b},setWhere:function(a,b,c){this.options.where=a&&a.length?a:"1=1";for(var d=[],e=[],f=0,g=null,h=L.Util.bind(function(a,h){if(a&&(g=a),h)for(var i=h.features.length-1;i>=0;i--)e.push(h.features[i].id);f--,0>=f&&(this._currentSnapshot=e,this.removeLayers(d),this.addLayers(e),b&&b.call(c,g))},this),i=this._currentSnapshot.length-1;i>=0;i--)d.push(this._currentSnapshot[i]);for(var j in this._activeCells){f++;var k=this._keyToCellCoords(j),l=this._cellCoordsToBounds(k);this._requestFeatures(l,j,h)}return this},getWhere:function(){return this.options.where},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(a,b,c,d){var e=this.options.from,f=this.options.to,g=0,h=null,i=L.Util.bind(function(i){i&&(h=i),this._filterExistingFeatures(e,f,a,b),g--,c&&0>=g&&c.call(d,h)},this);if(this.options.from=a,this.options.to=b,this._filterExistingFeatures(e,f,a,b),"server"===this.options.timeFilterMode)for(var j in this._activeCells){g++;var k=this._keyToCellCoords(j),l=this._cellCoordsToBounds(k);this._requestFeatures(l,j,i)}},refresh:function(){for(var a in this._activeCells){var b=this._keyToCellCoords(a),c=this._cellCoordsToBounds(b);this._requestFeatures(c,a)}},_filterExistingFeatures:function(a,b,c,d){var e=a&&b?this._getFeaturesInTimeRange(a,b):this._currentSnapshot,f=this._getFeaturesInTimeRange(c,d);if(f.indexOf)for(var g=0;g=0&&e.splice(h,1)}this.removeLayers(e),this.addLayers(f)},_getFeaturesInTimeRange:function(a,b){var c,d=[];if(this.options.timeField.start&&this.options.timeField.end){var e=this._startTimeIndex.between(a,b),f=this._endTimeIndex.between(a,b);c=e.concat(f)}else c=this._timeIndex.between(a,b);for(var g=c.length-1;g>=0;g--)d.push(c[g].id);return d},_buildTimeIndexes:function(a){var b,c;if(this.options.timeField.start&&this.options.timeField.end){var d=[],e=[];for(b=a.length-1;b>=0;b--)c=a[b],d.push({id:c.id,value:new Date(c.properties[this.options.timeField.start])}),e.push({id:c.id,value:new Date(c.properties[this.options.timeField.end])});this._startTimeIndex.bulkAdd(d),this._endTimeIndex.bulkAdd(e)}else{var f=[];for(b=a.length-1;b>=0;b--)c=a[b],f.push({id:c.id,value:new Date(c.properties[this.options.timeField])});this._timeIndex.bulkAdd(f)}},_featureWithinTimeRange:function(a){if(!this.options.from||!this.options.to)return!0;var b=+this.options.from.valueOf(),c=+this.options.to.valueOf();if("string"==typeof this.options.timeField){var d=+a.properties[this.options.timeField];return d>=b&&c>=d}if(this.options.timeField.start&&this.options.timeField.end){var e=+a.properties[this.options.timeField.start],f=+a.properties[this.options.timeField.end];return e>=b&&c>=e||f>=b&&c>=f}},authenticate:function(a){return this._service.authenticate(a),this},metadata:function(a,b){return this._service.metadata(a,b),this},query:function(){return this._service.query()},addFeature:function(a,b,c){return this._service.addFeature(a,function(a,d){a||this.refresh(),b&&b.call(c,a,d)},this),this},updateFeature:function(a,b,c){return this._service.updateFeature(a,function(a,d){a||this.refresh(),b&&b.call(c,a,d)},this)},deleteFeature:function(a,b,c){return this._service.deleteFeature(a,function(a,d){!a&&d.objectId&&this.removeLayers([d.objectId],!0),b&&b.call(c,a,d)},this)}}),b.prototype._query=function(a){for(var b,c,d,e=0,f=this.values.length-1;f>=e;)if(d=b=(e+f)/2|0,c=this.values[Math.round(b)],+c.value<+a)e=b+1;else{if(!(+c.value>+a))return b;f=b-1}return~f},b.prototype.sort=function(){this.values.sort(function(a,b){return+b.value-+a.value}).reverse(),this.dirty=!1},b.prototype.between=function(a,b){this.dirty&&this.sort();var c=this._query(a),d=this._query(b);return 0===c&&0===d?[]:(c=Math.abs(c),d=0>d?Math.abs(d):d+1,this.values.slice(c,d))},b.prototype.bulkAdd=function(a){this.dirty=!0,this.values=this.values.concat(a)}}(EsriLeaflet),EsriLeaflet.Layers.FeatureLayer=EsriLeaflet.Layers.FeatureManager.extend({statics:{EVENTS:"click dblclick mouseover mouseout mousemove contextmenu popupopen popupclose"},initialize:function(a,b){EsriLeaflet.Layers.FeatureManager.prototype.initialize.call(this,a,b),b=L.setOptions(this,b),this._layers={},this._leafletIds={},this._key="c"+(1e9*Math.random()).toString(36).replace(".","_")},onAdd:function(a){return EsriLeaflet.Layers.FeatureManager.prototype.onAdd.call(this,a)},onRemove:function(a){for(var b in this._layers)a.removeLayer(this._layers[b]);return EsriLeaflet.Layers.FeatureManager.prototype.onRemove.call(this,a)},createNewLayer:function(a){return L.GeoJSON.geometryToLayer(a,this.options.pointToLayer,L.GeoJSON.coordsToLatLng,this.options)},createLayers:function(a){for(var b=a.length-1;b>=0;b--){var c,d=a[b],e=this._layers[d.id];if(e&&!this._map.hasLayer(e)&&this._map.addLayer(e),e&&e.setLatLngs){var f=this.createNewLayer(d);e.setLatLngs(f.getLatLngs())}e||(c=this.createNewLayer(d),c.feature=d,c.defaultOptions=c.options,c._leaflet_id=this._key+"_"+d.id,this._leafletIds[c._leaflet_id]=d.id,c.on(EsriLeaflet.Layers.FeatureLayer.EVENTS,this._propagateEvent,this),this._popup&&c.bindPopup&&c.bindPopup(this._popup(c.feature,c),this._popupOptions),this.options.onEachFeature&&this.options.onEachFeature(c.feature,c),this._layers[c.feature.id]=c,this.resetStyle(c.feature.id),this.fire("createfeature",{feature:c.feature}),(!this.options.timeField||this.options.timeField&&this._featureWithinTimeRange(d))&&this._map.addLayer(c))}},addLayers:function(a){for(var b=a.length-1;b>=0;b--){var c=this._layers[a[b]];c&&(this.fire("addfeature",{feature:c.feature}),this._map.addLayer(c))}},removeLayers:function(a,b){for(var c=a.length-1;c>=0;c--){var d=a[c],e=this._layers[d];e&&(this.fire("removefeature",{feature:e.feature,permanent:b}),this._map.removeLayer(e)),e&&b&&delete this._layers[d]}},resetStyle:function(a){var b=this._layers[a];return b&&(b.options=b.defaultOptions,this.setFeatureStyle(b.feature.id,this.options.style)),this},setStyle:function(a){return this.options.style=a,this.eachFeature(function(b){this.setFeatureStyle(b.feature.id,a)},this),this},setFeatureStyle:function(a,b){var c=this._layers[a];"function"==typeof b&&(b=b(c.feature)),c.setStyle&&c.setStyle(b)},bindPopup:function(a,b){this._popup=a,this._popupOptions=b;for(var c in this._layers){var d=this._layers[c],e=this._popup(d.feature,d);d.bindPopup(e,b)}return this},unbindPopup:function(){this._popup=!1;for(var a in this._layers){var b=this._layers[a];if(b.unbindPopup)b.unbindPopup();else if(b.getLayers){var c=b.getLayers();for(var d in c){var e=c[d];e.unbindPopup()}}}return this},eachFeature:function(a,b){for(var c in this._layers)a.call(b,this._layers[c]);return this},getFeature:function(a){return this._layers[a]},_propagateEvent:function(a){a.layer=this._layers[this._leafletIds[a.target._leaflet_id]],a.target=this,this.fire(a.type,a)}}),EsriLeaflet.FeatureLayer=EsriLeaflet.Layers.FeatureLayer,EsriLeaflet.Layers.featureLayer=function(a,b){return new EsriLeaflet.Layers.FeatureLayer(a,b)},EsriLeaflet.featureLayer=function(a,b){return new EsriLeaflet.Layers.FeatureLayer(a,b)}; +//# sourceMappingURL=esri-leaflet-feature-layer.js.map + + return EsriLeaflet; +})); \ No newline at end of file diff --git a/dist/builds/feature-layer/esri-leaflet-feature-layer.js.map b/dist/builds/feature-layer/esri-leaflet-feature-layer.js.map new file mode 100644 index 000000000..47bc9f5fc --- /dev/null +++ b/dist/builds/feature-layer/esri-leaflet-feature-layer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"esri-leaflet-feature-layer.js","sources":["../../../src/EsriLeaflet.js","../../../src/Util.js","../../../src/Request.js","../../../src/Services/Service.js","../../../src/Services/FeatureLayer.js","../../../src/Tasks/Task.js","../../../src/Tasks/Query.js","../../../src/Layers/FeatureLayer/FeatureGrid.js","../../../src/Layers/FeatureLayer/FeatureManager.js","../../../src/Layers/FeatureLayer/FeatureLayer.js"],"names":["EsriLeaflet","VERSION","Layers","Services","Controls","Tasks","Util","Support","CORS","window","XMLHttpRequest","pointerEvents","document","documentElement","style","L","esri","clone","obj","target","i","hasOwnProperty","pointsEqual","a","b","length","closeRing","coordinates","push","ringIsClockwise","ringToTest","pt2","total","rLength","pt1","vertexIntersectsVertex","a1","a2","b1","b2","uaT","ubT","uB","ua","ub","arrayIntersectsArray","j","coordinatesContainPoint","point","contains","l","coordinatesContainCoordinates","outer","inner","intersects","convertRingsToGeoJSON","rings","x","outerRing","hole","outerRings","holes","r","ring","slice","polygon","uncontainedHoles","pop","contained","reverse","type","orientRings","poly","output","shift","flattenMultiPolygonRings","extentToBounds","extent","sw","LatLng","ymin","xmin","ne","ymax","xmax","LatLngBounds","boundsToExtent","bounds","latLngBounds","getSouthWest","lng","lat","getNorthEast","spatialReference","wkid","arcgisToGeojson","arcgis","idAttribute","geojson","y","points","paths","geometry","attributes","properties","id","OBJECTID","FID","geojsonToArcGIS","result","features","geometries","responseToFeatureCollection","response","objectIdField","objectIdFieldName","fields","name","featureCollection","results","cleanUrl","url","replace","geojsonTypeToArcGIS","geoJsonType","arcgisGeometryType","serialize","params","data","f","key","value","param","Object","prototype","toString","call","JSON","stringify","valueOf","encodeURIComponent","createRequest","callback","context","httpRequest","onerror","error","code","message","onreadystatechange","readyState","parse","responseText","e","callbacks","_EsriLeafletCallbacks","Request","request","paramString","requestLength","open","send","setRequestHeader","get","JSONP","console","warn","post","XMLHTTP","callbackId","script","DomUtil","create","body","src","responseType","abort","_callback","Service","Class","extend","includes","Mixin","Events","options","proxy","useCors","initialize","this","_requestQueue","_authenticating","setOptions","path","_request","metadata","authenticate","token","_runQueue","method","fire","wrappedCallback","_createServiceCallback","bind","apply","service","FeatureLayer","query","Query","addFeature","feature","addResults","undefined","updateFeature","updateResults","deleteFeature","objectIds","deleteResults","featureLayer","Task","generateSetter","isArray","match","join","endpoint","_service","setters","setter","offset","limit","outFields","precision","featureIds","returnGeometry","where","outSr","within","_setGeometry","spatialRel","overlaps","nearby","latlng","radius","latLng","geometryType","units","distance","inSr","string","between","start","end","time","simplify","map","factor","mapWidth","Math","abs","getBounds","getWest","getEast","maxAllowableOffset","getSize","orderBy","fieldName","order","orderByFields","bool","run","_cleanParams","count","returnCountOnly","ids","returnIdsOnly","returnExtentOnly","pixelSize","layer","getLatLng","GeoJSON","getLayers","toGeoJSON","FeatureGrid","cellSize","updateInterval","onAdd","_map","_update","limitExecByInterval","addEventListener","getEvents","_reset","onRemove","removeEventListener","_removeCells","events","viewreset","moveend","addTo","addLayer","removeFrom","removeLayer","_cells","_activeCells","_cellsToLoad","_cellsTotal","_resetWrap","crs","infinite","_getCellSize","wrapLng","_wrapLng","floor","project","ceil","wrapLat","_wrapLat","getPixelBounds","zoom","getZoom","maxZoom","minZoom","cellBounds","min","divideBy","max","_addCells","_removeOtherCells","coords","queue","center","getCenter","Point","z","cellsToLoad","sort","distanceTo","_addCell","_cellCoordsToBounds","nwPoint","multiplyBy","sePoint","add","nw","unproject","wrap","se","_cellCoordsToKey","_keyToCellCoords","kArr","split","parseInt","_removeCell","cell","cellLeave","_wrapCoords","cellEnter","createCell","wrapNum","BinarySearchIndex","values","FeatureManager","from","to","timeField","timeFilterMode","simplifyFactor","oidCheck","on","_startTimeIndex","_endTimeIndex","_timeIndex","_currentSnapshot","_activeRequests","_pendingRequests","getAttribution","attribution","_requestFeatures","_buildQuery","exceededTransferLimit","_addFeatures","_buildTimeIndexes","createLayers","setWhere","oldSnapshot","newShapshot","pendingRequests","requestError","requestCallback","removeLayers","addLayers","getWhere","getTimeRange","setTimeRange","oldFrom","oldTo","_filterExistingFeatures","refresh","newFrom","newTo","layersToRemove","_getFeaturesInTimeRange","layersToAdd","indexOf","shouldRemoveLayer","splice","search","startTimes","endTimes","concat","startTimeEntries","endTimeEntries","Date","bulkAdd","timeEntries","_featureWithinTimeRange","date","startDate","endDate","objectId","_query","currentIndex","currentElement","resultIndex","minIndex","maxIndex","round","dirty","startIndex","endIndex","items","statics","EVENTS","_layers","_leafletIds","_key","random","createNewLayer","geometryToLayer","pointToLayer","coordsToLatLng","newLayer","hasLayer","setLatLngs","updateGeo","getLatLngs","defaultOptions","_leaflet_id","_propagateEvent","_popup","bindPopup","_popupOptions","onEachFeature","resetStyle","permanent","setFeatureStyle","setStyle","eachFeature","fn","popupContent","unbindPopup","groupLayers","gLayer","getFeature"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,GAAIA,cACFC,QAAS,aACTC,UACAC,YACAC,YACAC,SACAC,QACAC,SACEC,QAASC,OAAOC,gBAAkB,mBAAqB,IAAIA,iBAC3DC,cAAgE,KAAjDC,SAASC,gBAAgBC,MAAMH,eAI7B,oBAAXF,SAA0BA,OAAOM,IACzCN,OAAOM,EAAEC,KAAOhB,aCdlB,SAAUA,GAIR,QAASiB,GAAMC,GACb,GAAIC,KACJ,KAAK,GAAIC,KAAKF,GACRA,EAAIG,eAAeD,KACrBD,EAAOC,GAAKF,EAAIE,GAGpB,OAAOD,GAIT,QAASG,GAA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A,GAAM6K,UAAUS,EAAclR,GAEhC,MAAOI,OAGT+Q,YAAa,WACX/Q,KAAKoQ,QAAU,CACf,KAAK,GAAI5a,KAAKwK,MAAKoP,QAAS,CAC1B,GAAI5J,GAAQxF,KAAKoP,QAAQ5Z,EACzB,IAAIgQ,EAAMuL,YACRvL,EAAMuL,kBACD,IAAIvL,EAAMG,UAAW,CAC1B,GAAIqL,GAAcxL,EAAMG,WACxB,KAAK,GAAIzO,KAAK8Z,GAAa,CACzB,GAAIC,GAASD,EAAY9Z,EACzB+Z,GAAOF,gBAIb,MAAO/Q,OAOT4Q,YAAa,SAAUC,EAAI1T,GACzB,IAAK,GAAI3H,KAAKwK,MAAKoP,QACjByB,EAAGjU,KAAKO,EAAS6C,KAAKoP,QAAQ5Z,GAEhC,OAAOwK,OAGTkR,WAAY,SAAUrW,GACpB,MAAOmF,MAAKoP,QAAQvU,IAKtBsV,gBAAiB,SAAUtS,GACzBA,EAAE2H,MAAQxF,KAAKoP,QAAQpP,KAAKqP,YAAYxR,EAAEtI,OAAO2a,cACjDrS,EAAEtI,OAASyK,KACXA,KAAKW,KAAK9C,EAAEnF,KAAMmF,MAItBzJ,YAAY6M,aAAe7M,YAAYE,OAAO2M,aAE9C7M,YAAYE,OAAOuN,aAAe,SAAShG,EAAK+D,GAC9C,MAAO,IAAIxL,aAAYE,OAAO2M,aAAapF,EAAK+D,IAGlDxL,YAAYyN,aAAe,SAAShG,EAAK+D,GACvC,MAAO,IAAIxL,aAAYE,OAAO2M,aAAapF,EAAK+D","sourcesContent":["var EsriLeaflet = { //jshint ignore:line\n VERSION: '1.0.0-rc.2',\n Layers: {},\n Services: {},\n Controls: {},\n Tasks: {},\n Util: {},\n Support: {\n CORS: !!(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()),\n pointerEvents: document.documentElement.style.pointerEvents === ''\n }\n};\n\nif(typeof window !== 'undefined' && window.L){\n window.L.esri = EsriLeaflet;\n}","(function(EsriLeaflet){\n\n // shallow object clone for feature properties and attributes\n // from http://jsperf.com/cloning-an-object/2\n function clone(obj) {\n var target = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n target[i] = obj[i];\n }\n }\n return target;\n }\n\n // checks if 2 x,y points are equal\n function pointsEqual(a, b) {\n for (var i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n }\n\n // checks if the first and last points of a ring are equal and closes the ring\n function closeRing(coordinates) {\n if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) {\n coordinates.push(coordinates[0]);\n }\n return coordinates;\n }\n\n // determine if polygon ring coordinates are clockwise. clockwise signifies outer ring, counter-clockwise an inner ring\n // or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-\n // points-are-in-clockwise-order\n function ringIsClockwise(ringToTest) {\n var total = 0,i = 0;\n var rLength = ringToTest.length;\n var pt1 = ringToTest[i];\n var pt2;\n for (i; i < rLength - 1; i++) {\n pt2 = ringToTest[i + 1];\n total += (pt2[0] - pt1[0]) * (pt2[1] + pt1[1]);\n pt1 = pt2;\n }\n return (total >= 0);\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L504-L519\n function vertexIntersectsVertex(a1, a2, b1, b2) {\n var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]);\n var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]);\n var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]);\n\n if ( uB !== 0 ) {\n var ua = uaT / uB;\n var ub = ubT / uB;\n\n if ( 0 <= ua && ua <= 1 && 0 <= ub && ub <= 1 ) {\n return true;\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L521-L531\n function arrayIntersectsArray(a, b) {\n for (var i = 0; i < a.length - 1; i++) {\n for (var j = 0; j < b.length - 1; j++) {\n if (vertexIntersectsVertex(a[i], a[i + 1], b[j], b[j + 1])) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L470-L480\n function coordinatesContainPoint(coordinates, point) {\n var contains = false;\n for(var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) {\n if (((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1]) ||\n (coordinates[j][1] <= point[1] && point[1] < coordinates[i][1])) &&\n (point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0])) {\n contains = !contains;\n }\n }\n return contains;\n }\n\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L106-L113\n function coordinatesContainCoordinates(outer, inner){\n var intersects = arrayIntersectsArray(outer, inner);\n var contains = coordinatesContainPoint(outer, inner[0]);\n if(!intersects && contains){\n return true;\n }\n return false;\n }\n\n // do any polygons in this array contain any other polygons in this array?\n // used for checking for holes in arcgis rings\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L117-L172\n function convertRingsToGeoJSON(rings){\n var outerRings = [];\n var holes = [];\n var x; // iterator\n var outerRing; // current outer ring being evaluated\n var hole; // current hole being evaluated\n\n // for each ring\n for (var r = 0; r < rings.length; r++) {\n var ring = closeRing(rings[r].slice(0));\n if(ring.length < 4){\n continue;\n }\n // is this ring an outer ring? is it clockwise?\n if(ringIsClockwise(ring)){\n var polygon = [ ring ];\n outerRings.push(polygon); // push to outer rings\n } else {\n holes.push(ring); // counterclockwise push to holes\n }\n }\n\n var uncontainedHoles = [];\n\n // while there are holes left...\n while(holes.length){\n // pop a hole off out stack\n hole = holes.pop();\n\n // loop over all outer rings and see if they contain our hole.\n var contained = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(coordinatesContainCoordinates(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n contained = true;\n break;\n }\n }\n\n // ring is not contained in any outer ring\n // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320\n if(!contained){\n uncontainedHoles.push(hole);\n }\n }\n\n // if we couldn't match any holes using contains we can try intersects...\n while(uncontainedHoles.length){\n // pop a hole off out stack\n hole = uncontainedHoles.pop();\n\n // loop over all outer rings and see if any intersect our hole.\n var intersects = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(arrayIntersectsArray(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n intersects = true;\n break;\n }\n }\n\n if(!intersects) {\n outerRings.push([hole.reverse()]);\n }\n }\n\n if(outerRings.length === 1){\n return {\n type: 'Polygon',\n coordinates: outerRings[0]\n };\n } else {\n return {\n type: 'MultiPolygon',\n coordinates: outerRings\n };\n }\n }\n\n // This function ensures that rings are oriented in the right directions\n // outer rings are clockwise, holes are counterclockwise\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function orientRings(poly){\n var output = [];\n var polygon = poly.slice(0);\n var outerRing = closeRing(polygon.shift().slice(0));\n if(outerRing.length >= 4){\n if(!ringIsClockwise(outerRing)){\n outerRing.reverse();\n }\n\n output.push(outerRing);\n\n for (var i = 0; i < polygon.length; i++) {\n var hole = closeRing(polygon[i].slice(0));\n if(hole.length >= 4){\n if(ringIsClockwise(hole)){\n hole.reverse();\n }\n output.push(hole);\n }\n }\n }\n\n return output;\n }\n\n // This function flattens holes in multipolygons to one array of polygons\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function flattenMultiPolygonRings(rings){\n var output = [];\n for (var i = 0; i < rings.length; i++) {\n var polygon = orientRings(rings[i]);\n for (var x = polygon.length - 1; x >= 0; x--) {\n var ring = polygon[x].slice(0);\n output.push(ring);\n }\n }\n return output;\n }\n\n // convert an extent (ArcGIS) to LatLngBounds (Leaflet)\n EsriLeaflet.Util.extentToBounds = function(extent){\n var sw = new L.LatLng(extent.ymin, extent.xmin);\n var ne = new L.LatLng(extent.ymax, extent.xmax);\n return new L.LatLngBounds(sw, ne);\n };\n\n // convert an LatLngBounds (Leaflet) to extent (ArcGIS)\n EsriLeaflet.Util.boundsToExtent = function(bounds) {\n bounds = L.latLngBounds(bounds);\n return {\n 'xmin': bounds.getSouthWest().lng,\n 'ymin': bounds.getSouthWest().lat,\n 'xmax': bounds.getNorthEast().lng,\n 'ymax': bounds.getNorthEast().lat,\n 'spatialReference': {\n 'wkid' : 4326\n }\n };\n };\n\n EsriLeaflet.Util.arcgisToGeojson = function (arcgis, idAttribute){\n var geojson = {};\n\n if(typeof arcgis.x === 'number' && typeof arcgis.y === 'number'){\n geojson.type = 'Point';\n geojson.coordinates = [arcgis.x, arcgis.y];\n }\n\n if(arcgis.points){\n geojson.type = 'MultiPoint';\n geojson.coordinates = arcgis.points.slice(0);\n }\n\n if(arcgis.paths) {\n if(arcgis.paths.length === 1){\n geojson.type = 'LineString';\n geojson.coordinates = arcgis.paths[0].slice(0);\n } else {\n geojson.type = 'MultiLineString';\n geojson.coordinates = arcgis.paths.slice(0);\n }\n }\n\n if(arcgis.rings) {\n geojson = convertRingsToGeoJSON(arcgis.rings.slice(0));\n }\n\n if(arcgis.geometry || arcgis.attributes) {\n geojson.type = 'Feature';\n geojson.geometry = (arcgis.geometry) ? EsriLeaflet.Util.arcgisToGeojson(arcgis.geometry) : null;\n geojson.properties = (arcgis.attributes) ? clone(arcgis.attributes) : null;\n if(arcgis.attributes) {\n geojson.id = arcgis.attributes[idAttribute] || arcgis.attributes.OBJECTID || arcgis.attributes.FID;\n }\n }\n\n return geojson;\n };\n\n // GeoJSON -> ArcGIS\n EsriLeaflet.Util.geojsonToArcGIS = function(geojson, idAttribute){\n idAttribute = idAttribute || 'OBJECTID';\n var spatialReference = { wkid: 4326 };\n var result = {};\n var i;\n\n switch(geojson.type){\n case 'Point':\n result.x = geojson.coordinates[0];\n result.y = geojson.coordinates[1];\n result.spatialReference = spatialReference;\n break;\n case 'MultiPoint':\n result.points = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'LineString':\n result.paths = [geojson.coordinates.slice(0)];\n result.spatialReference = spatialReference;\n break;\n case 'MultiLineString':\n result.paths = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'Polygon':\n result.rings = orientRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'MultiPolygon':\n result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'Feature':\n if(geojson.geometry) {\n result.geometry = EsriLeaflet.Util.geojsonToArcGIS(geojson.geometry, idAttribute);\n }\n result.attributes = (geojson.properties) ? clone(geojson.properties) : {};\n if(geojson.id){\n result.attributes[idAttribute] = geojson.id;\n }\n break;\n case 'FeatureCollection':\n result = [];\n for (i = 0; i < geojson.features.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.features[i], idAttribute));\n }\n break;\n case 'GeometryCollection':\n result = [];\n for (i = 0; i < geojson.geometries.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.geometries[i], idAttribute));\n }\n break;\n }\n\n return result;\n };\n\n EsriLeaflet.Util.responseToFeatureCollection = function(response, idAttribute){\n var objectIdField;\n\n if(idAttribute){\n objectIdField = idAttribute;\n } else if(response.objectIdFieldName){\n objectIdField = response.objectIdFieldName;\n } else if(response.fields) {\n for (var j = 0; j <= response.fields.length - 1; j++) {\n if(response.fields[j].type === 'esriFieldTypeOID') {\n objectIdField = response.fields[j].name;\n break;\n }\n }\n } else {\n objectIdField = 'OBJECTID';\n }\n\n var featureCollection = {\n type: 'FeatureCollection',\n features: []\n };\n var features = response.features || response.results;\n if(features.length){\n for (var i = features.length - 1; i >= 0; i--) {\n featureCollection.features.push(EsriLeaflet.Util.arcgisToGeojson(features[i], objectIdField));\n }\n }\n\n return featureCollection;\n };\n\n // trim whitespace and add a tailing slash is needed to a url\n EsriLeaflet.Util.cleanUrl = function(url){\n url = url.replace(/\\s\\s*/g, '');\n\n //add a trailing slash to the url if the user omitted it\n if(url[url.length-1] !== '/'){\n url += '/';\n }\n\n return url;\n };\n\n EsriLeaflet.Util.geojsonTypeToArcGIS = function (geoJsonType) {\n var arcgisGeometryType;\n switch (geoJsonType) {\n case 'Point':\n arcgisGeometryType = 'esriGeometryPoint';\n break;\n case 'MultiPoint':\n arcgisGeometryType = 'esriGeometryMultipoint';\n break;\n case 'LineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'MultiLineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'Polygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n case 'MultiPolygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n }\n return arcgisGeometryType;\n };\n\n})(EsriLeaflet);","(function(EsriLeaflet){\n\n var callbacks = 0;\n\n window._EsriLeafletCallbacks = {};\n\n function serialize(params){\n var data = '';\n\n params.f = 'json';\n\n for (var key in params){\n if(params.hasOwnProperty(key)){\n var param = params[key];\n var type = Object.prototype.toString.call(param);\n var value;\n\n if(data.length){\n data += '&';\n }\n\n if(type === '[object Array]' || type === '[object Object]'){\n value = JSON.stringify(param);\n } else if (type === '[object Date]'){\n value = param.valueOf();\n } else {\n value = param;\n }\n\n data += encodeURIComponent(key) + '=' + encodeURIComponent(value);\n }\n }\n\n return data;\n }\n\n function createRequest(callback, context){\n var httpRequest = new XMLHttpRequest();\n\n httpRequest.onerror = function(e) {\n callback.call(context, {\n error: {\n code: 500,\n message: 'XMLHttpRequest error'\n }\n }, null);\n };\n\n httpRequest.onreadystatechange = function(){\n var response;\n var error;\n\n if (httpRequest.readyState === 4) {\n try {\n response = JSON.parse(httpRequest.responseText);\n } catch(e) {\n response = null;\n error = {\n code: 500,\n message: 'Could not parse response as JSON.'\n };\n }\n\n if (!error && response.error) {\n error = response.error;\n response = null;\n }\n\n callback.call(context, error, response);\n }\n };\n\n return httpRequest;\n }\n\n // AJAX handlers for CORS (modern browsers) or JSONP (older browsers)\n EsriLeaflet.Request = {\n request: function(url, params, callback, context){\n var paramString = serialize(params);\n var httpRequest = createRequest(callback, context);\n var requestLength = (url + '?' + paramString).length;\n\n // request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest\n if(requestLength <= 2000 && L.esri.Support.CORS){\n httpRequest.open('GET', url + '?' + paramString);\n httpRequest.send(null);\n\n // request is less more then 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest\n } else if (requestLength > 2000 && L.esri.Support.CORS){\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(paramString);\n\n // request is less more then 2000 characters and the browser does not support CORS, make a JSONP request\n } else if(requestLength <= 2000 && !L.esri.Support.CORS){\n return L.esri.Request.get.JSONP(url, params, callback, context);\n\n // request is longer then 2000 characters and the browser does not support CORS, log a warning\n } else {\n if(console && console.warn){\n console.warn('a request to ' + url + ' 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');\n return;\n }\n }\n\n return httpRequest;\n },\n post: {\n XMLHTTP: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(serialize(params));\n\n return httpRequest;\n }\n },\n\n get: {\n CORS: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n\n httpRequest.open('GET', url + '?' + serialize(params), true);\n httpRequest.send(null);\n\n return httpRequest;\n },\n JSONP: function(url, params, callback, context){\n var callbackId = 'c' + callbacks;\n\n params.callback = 'window._EsriLeafletCallbacks.' + callbackId;\n\n var script = L.DomUtil.create('script', null, document.body);\n script.type = 'text/javascript';\n script.src = url + '?' + serialize(params);\n script.id = callbackId;\n\n window._EsriLeafletCallbacks[callbackId] = function(response){\n if(window._EsriLeafletCallbacks[callbackId] !== true){\n var error;\n var responseType = Object.prototype.toString.call(response);\n\n if(!(responseType === '[object Object]' || responseType === '[object Array]')){\n error = {\n error: {\n code: 500,\n message: 'Expected array or object as JSONP response'\n }\n };\n response = null;\n }\n\n if (!error && response.error) {\n error = response;\n response = null;\n }\n\n callback.call(context, error, response);\n window._EsriLeafletCallbacks[callbackId] = true;\n }\n };\n\n callbacks++;\n\n return {\n id: callbackId,\n url: script.src,\n abort: function(){\n window._EsriLeafletCallbacks._callback[callbackId]({\n code: 0,\n message: 'Request aborted.'\n });\n }\n };\n }\n }\n };\n\n // Choose the correct AJAX handler depending on CORS support\n EsriLeaflet.get = (EsriLeaflet.Support.CORS) ? EsriLeaflet.Request.get.CORS : EsriLeaflet.Request.get.JSONP;\n\n // Always use XMLHttpRequest for posts\n EsriLeaflet.post = EsriLeaflet.Request.post.XMLHTTP;\n\n // expose a common request method the uses GET\\POST based on request length\n EsriLeaflet.request = EsriLeaflet.Request.request;\n\n})(EsriLeaflet);","EsriLeaflet.Services.Service = L.Class.extend({\n\n includes: L.Mixin.Events,\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n initialize: function (url, options) {\n this.url = EsriLeaflet.Util.cleanUrl(url);\n this._requestQueue = [];\n this._authenticating = false;\n L.Util.setOptions(this, options);\n },\n\n get: function (path, params, callback, context) {\n return this._request('get', path, params, callback, context);\n },\n\n post: function (path, params, callback, context) {\n return this._request('post', path, params, callback, context);\n },\n\n request: function (path, params, callback, context) {\n return this._request('request', path, params, callback, context);\n },\n\n metadata: function (callback, context) {\n return this._request('get', '', {}, callback, context);\n },\n\n authenticate: function(token){\n this._authenticating = false;\n this.options.token = token;\n this._runQueue();\n return this;\n },\n\n _request: function(method, path, params, callback, context){\n this.fire('requeststart', {\n url: this.url + path,\n params: params,\n method: method\n });\n\n var wrappedCallback = this._createServiceCallback(method, path, params, callback, context);\n\n if (this.options.token) {\n params.token = this.options.token;\n }\n\n if (this._authenticating) {\n this._requestQueue.push([method, path, params, callback, context]);\n return;\n } else {\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, wrappedCallback);\n } else {\n return EsriLeaflet[method](url, params, wrappedCallback);\n }\n }\n },\n\n _createServiceCallback: function(method, path, params, callback, context){\n var request = [method, path, params, callback, context];\n\n return L.Util.bind(function(error, response){\n\n if (error && (error.code === 499 || error.code === 498)) {\n this._authenticating = true;\n\n this._requestQueue.push(request);\n\n this.fire('authenticationrequired', {\n authenticate: L.Util.bind(this.authenticate, this)\n });\n } else {\n callback.call(context, error, response);\n\n if(error) {\n this.fire('requesterror', {\n url: this.url + path,\n params: params,\n message: error.message,\n code: error.code,\n method: method\n });\n } else {\n this.fire('requestsuccess', {\n url: this.url + path,\n params: params,\n response: response,\n method: method\n });\n }\n\n this.fire('requestend', {\n url: this.url + path,\n params: params,\n method: method\n });\n }\n }, this);\n },\n\n _runQueue: function(){\n for (var i = this._requestQueue.length - 1; i >= 0; i--) {\n var request = this._requestQueue[i];\n var method = request.shift();\n this[method].apply(this, request);\n }\n this._requestQueue = [];\n }\n\n});\n\nEsriLeaflet.Services.service = function(url, params){\n return new EsriLeaflet.Services.Service(url, params);\n};","EsriLeaflet.Services.FeatureLayer = EsriLeaflet.Services.Service.extend({\n\n options: {\n idAttribute: 'OBJECTID'\n },\n\n query: function(){\n return new EsriLeaflet.Tasks.Query(this);\n },\n\n addFeature: function(feature, callback, context) {\n delete feature.id;\n\n feature = EsriLeaflet.Util.geojsonToArcGIS(feature);\n\n return this.post('addFeatures', {\n features: [feature]\n }, function(error, response){\n var result = (response && response.addResults) ? response.addResults[0] : undefined;\n if(callback){\n callback.call(this, error || response.addResults[0].error, result);\n }\n }, context);\n },\n\n updateFeature: function(feature, callback, context) {\n feature = EsriLeaflet.Util.geojsonToArcGIS(feature, this.options.idAttribute);\n\n return this.post('updateFeatures', {\n features: [feature]\n }, function(error, response){\n var result = (response && response.updateResults) ? response.updateResults[0] : undefined;\n if(callback){\n callback.call(context, error || response.updateResults[0].error, result);\n }\n }, context);\n },\n\n deleteFeature: function(id, callback, context) {\n return this.post('deleteFeatures', {\n objectIds: id\n }, function(error, response){\n var result = (response && response.deleteResults) ? response.deleteResults[0] : undefined;\n if(callback){\n callback.call(context, error || response.deleteResults[0].error, result);\n }\n }, context);\n }\n\n});\n\nEsriLeaflet.Services.featureLayer = function(url, options) {\n return new EsriLeaflet.Services.FeatureLayer(url, options);\n};","EsriLeaflet.Tasks.Task = L.Class.extend({\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n //Generate a method for each methodName:paramName in the setters for this task.\n generateSetter: function(param, context){\n var isArray = param.match(/([a-zA-Z]+)\\[\\]/);\n\n param = (isArray) ? isArray[1] : param;\n\n if(isArray){\n return L.Util.bind(function(value){\n // this.params[param] = (this.params[param]) ? this.params[param] + ',' : '';\n if (L.Util.isArray(value)) {\n this.params[param] = value.join(',');\n } else {\n this.params[param] = value;\n }\n return this;\n }, context);\n } else {\n return L.Util.bind(function(value){\n this.params[param] = value;\n return this;\n }, context);\n }\n },\n\n initialize: function(endpoint, options){\n // endpoint can be either a url to an ArcGIS Rest Service or an instance of EsriLeaflet.Service\n if(endpoint.url && endpoint.request){\n this._service = endpoint;\n this.url = endpoint.url;\n } else {\n this.url = EsriLeaflet.Util.cleanUrl(endpoint);\n }\n\n // clone default params into this object\n this.params = L.Util.extend({}, this.params || {});\n\n // generate setter methods based on the setters object implimented a child class\n if(this.setters){\n for (var setter in this.setters){\n var param = this.setters[setter];\n this[setter] = this.generateSetter(param, this);\n }\n }\n\n L.Util.setOptions(this, options);\n },\n\n token: function(token){\n if(this._service){\n this._service.authenticate(token);\n } else {\n this.params.token = token;\n }\n return this;\n },\n\n request: function(callback, context){\n if(this._service){\n return this._service.request(this.path, this.params, callback, context);\n } else {\n return this._request('request', this.path, this.params, callback, context);\n }\n },\n\n _request: function(method, path, params, callback, context){\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, callback, context);\n } else{\n return EsriLeaflet[method](url, params, callback, context);\n }\n }\n});","EsriLeaflet.Tasks.Query = EsriLeaflet.Tasks.Task.extend({\n setters: {\n 'offset': 'offset',\n 'limit': 'limit',\n 'outFields': 'fields[]',\n 'precision': 'geometryPrecision',\n 'featureIds': 'objectIds[]',\n 'returnGeometry': 'returnGeometry',\n 'token': 'token'\n },\n\n path: 'query',\n\n params: {\n returnGeometry: true,\n where: '1=1',\n outSr: 4326,\n outFields: '*'\n },\n\n within: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelContains'; // will make code read layer within geometry, to the api this will reads geometry contains layer\n return this;\n },\n\n intersects: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelIntersects';\n return this;\n },\n\n contains: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelWithin'; // will make code read layer contains geometry, to the api this will reads geometry within layer\n return this;\n },\n\n // crosses: function(geometry){\n // this._setGeometry(geometry);\n // this.params.spatialRel = 'esriSpatialRelCrosses';\n // return this;\n // },\n\n // touches: function(geometry){\n // this._setGeometry(geometry);\n // this.params.spatialRel = 'esriSpatialRelTouches';\n // return this;\n // },\n\n overlaps: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelOverlaps';\n return this;\n },\n\n // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online\n nearby: function(latlng, radius){\n latlng = L.latLng(latlng);\n this.params.geometry = ([latlng.lng,latlng.lat]).join(',');\n this.params.geometryType = 'esriGeometryPoint';\n this.params.spatialRel = 'esriSpatialRelIntersects';\n this.params.units = 'esriSRUnit_Meter';\n this.params.distance = radius;\n this.params.inSr = 4326;\n return this;\n },\n\n where: function(string){\n this.params.where = string.replace(/\"/g, \"\\'\"); // jshint ignore:line\n return this;\n },\n\n between: function(start, end){\n this.params.time = ([start.valueOf(), end.valueOf()]).join();\n return this;\n },\n\n fields: function (fields) {\n if (L.Util.isArray(fields)) {\n this.params.outFields = fields.join(',');\n } else {\n this.params.outFields = fields;\n }\n return this;\n },\n\n simplify: function(map, factor){\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\n return this;\n },\n\n orderBy: function(fieldName, order){\n order = order || 'ASC';\n this.params.orderByFields = (this.params.orderByFields) ? this.params.orderByFields + ',' : '';\n this.params.orderByFields += ([fieldName, order]).join(' ');\n return this;\n },\n\n returnGeometry: function(bool){\n this.params.returnGeometry = bool;\n return this;\n },\n\n run: function(callback, context){\n this._cleanParams();\n return this.request(function(error, response){\n callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response);\n }, context);\n },\n\n count: function(callback, context){\n this._cleanParams();\n this.params.returnCountOnly = true;\n return this.request(function(error, response){\n callback.call(this, error, (response && response.count), response);\n }, context);\n },\n\n ids: function(callback, context){\n this._cleanParams();\n this.params.returnIdsOnly = true;\n return this.request(function(error, response){\n callback.call(this, error, (response && response.objectIds), response);\n }, context);\n },\n\n // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online\n bounds: function(callback, context){\n this._cleanParams();\n this.params.returnExtentOnly = true;\n return this.request(function(error, response){\n callback.call(context, error, (response && response.extent && EsriLeaflet.Util.extentToBounds(response.extent)), response);\n }, context);\n },\n\n // only valid for image services\n pixelSize: function(point){\n point = L.point(point);\n this.params.pixelSize = ([point.x,point.y]).join(',');\n return this;\n },\n\n // only valid for map services\n layer: function(layer){\n this.path = layer + '/query';\n return this;\n },\n\n _cleanParams: function(){\n delete this.params.returnIdsOnly;\n delete this.params.returnExtentOnly;\n delete this.params.returnCountOnly;\n },\n\n _setGeometry: function(geometry) {\n this.params.inSr = 4326;\n\n // convert bounds to extent and finish\n if ( geometry instanceof L.LatLngBounds ) {\n // set geometry + geometryType\n this.params.geometry = EsriLeaflet.Util.boundsToExtent(geometry);\n this.params.geometryType = 'esriGeometryEnvelope';\n return;\n }\n\n // convert L.Marker > L.LatLng\n if(geometry.getLatLng){\n geometry = geometry.getLatLng();\n }\n\n // convert L.LatLng to a geojson point and continue;\n if (geometry instanceof L.LatLng) {\n geometry = {\n type: 'Point',\n coordinates: [geometry.lng, geometry.lat]\n };\n }\n\n // handle L.GeoJSON, pull out the first geometry\n if ( geometry instanceof L.GeoJSON ) {\n //reassign geometry to the GeoJSON value (we are assuming that only one feature is present)\n geometry = geometry.getLayers()[0].feature.geometry;\n this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry);\n this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type);\n }\n\n // Handle L.Polyline and L.Polygon\n if (geometry.toGeoJSON) {\n geometry = geometry.toGeoJSON();\n }\n\n // handle GeoJSON feature by pulling out the geometry\n if ( geometry.type === 'Feature' ) {\n // get the geometry of the geojson feature\n geometry = geometry.geometry;\n }\n\n // confirm that our GeoJSON is a point, line or polygon\n if ( geometry.type === 'Point' || geometry.type === 'LineString' || geometry.type === 'Polygon') {\n this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry);\n this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type);\n return;\n }\n\n // warn the user if we havn't found a\n /* global console */\n if(console && console.warn) {\n console.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');\n }\n\n return;\n }\n});\n\nEsriLeaflet.Tasks.query = function(url, params){\n return new EsriLeaflet.Tasks.Query(url, params);\n};","EsriLeaflet.Layers.FeatureGrid = L.Class.extend({\n\n includes: L.Mixin.Events,\n\n options: {\n cellSize: 512,\n updateInterval: 150\n },\n\n initialize: function (options) {\n options = L.setOptions(this, options);\n },\n\n onAdd: function (map) {\n this._map = map;\n this._update = L.Util.limitExecByInterval(this._update, this.options.updateInterval, this);\n\n // @TODO remove for leaflet 0.8\n this._map.addEventListener(this.getEvents(), this);\n\n this._reset();\n this._update();\n },\n\n onRemove: function(){\n this._map.removeEventListener(this.getEvents(), this);\n this._removeCells();\n },\n\n getEvents: function () {\n var events = {\n viewreset: this._reset,\n moveend: this._update\n };\n\n return events;\n },\n\n addTo: function(map){\n map.addLayer(this);\n return this;\n },\n\n removeFrom: function(map){\n map.removeLayer(this);\n return this;\n },\n\n _reset: function () {\n this._removeCells();\n\n this._cells = {};\n this._activeCells = {};\n this._cellsToLoad = 0;\n this._cellsTotal = 0;\n\n // @TODO enable at Leaflet 0.8\n // this._cellNumBounds = this._getCellNumBounds();\n\n this._resetWrap();\n },\n\n _resetWrap: function () {\n var map = this._map,\n crs = map.options.crs;\n\n if (crs.infinite) { return; }\n\n var cellSize = this._getCellSize();\n\n if (crs.wrapLng) {\n this._wrapLng = [\n Math.floor(map.project([0, crs.wrapLng[0]]).x / cellSize),\n Math.ceil(map.project([0, crs.wrapLng[1]]).x / cellSize)\n ];\n }\n\n if (crs.wrapLat) {\n this._wrapLat = [\n Math.floor(map.project([crs.wrapLat[0], 0]).y / cellSize),\n Math.ceil(map.project([crs.wrapLat[1], 0]).y / cellSize)\n ];\n }\n },\n\n _getCellSize: function () {\n return this.options.cellSize;\n },\n\n _update: function () {\n if (!this._map) { return; }\n\n var bounds = this._map.getPixelBounds(),\n zoom = this._map.getZoom(),\n cellSize = this._getCellSize();\n\n if (zoom > this.options.maxZoom ||\n zoom < this.options.minZoom) { return; }\n\n // cell coordinates range for the current view\n var cellBounds = L.bounds(\n bounds.min.divideBy(cellSize).floor(),\n bounds.max.divideBy(cellSize).floor());\n\n this._addCells(cellBounds);\n this._removeOtherCells(cellBounds);\n },\n\n _addCells: function (bounds) {\n var queue = [],\n center = bounds.getCenter(),\n zoom = this._map.getZoom();\n\n var j, i, coords;\n // create a queue of coordinates to load cells from\n for (j = bounds.min.y; j <= bounds.max.y; j++) {\n for (i = bounds.min.x; i <= bounds.max.x; i++) {\n coords = new L.Point(i, j);\n coords.z = zoom;\n\n // @TODO enable at Leaflet 0.8\n // if (this._isValidCell(coords)) {\n // queue.push(coords);\n // }\n\n queue.push(coords);\n }\n }\n var cellsToLoad = queue.length;\n\n if (cellsToLoad === 0) { return; }\n\n this._cellsToLoad += cellsToLoad;\n this._cellsTotal += cellsToLoad;\n\n // sort cell queue to load cells in order of their distance to center\n queue.sort(function (a, b) {\n return a.distanceTo(center) - b.distanceTo(center);\n });\n\n for (i = 0; i < cellsToLoad; i++) {\n this._addCell(queue[i]);\n }\n },\n\n // @TODO enable at Leaflet 0.8\n // _isValidCell: function (coords) {\n // var crs = this._map.options.crs;\n\n // if (!crs.infinite) {\n // // don't load cell if it's out of bounds and not wrapped\n // var bounds = this._cellNumBounds;\n // if (\n // (!crs.wrapLng && (coords.x < bounds.min.x || coords.x > bounds.max.x)) ||\n // (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y))\n // ) {\n // return false;\n // }\n // }\n\n // if (!this.options.bounds) {\n // return true;\n // }\n\n // // don't load cell if it doesn't intersect the bounds in options\n // var cellBounds = this._cellCoordsToBounds(coords);\n // return L.latLngBounds(this.options.bounds).intersects(cellBounds);\n // },\n\n // converts cell coordinates to its geographical bounds\n _cellCoordsToBounds: function (coords) {\n var map = this._map,\n cellSize = this.options.cellSize,\n\n nwPoint = coords.multiplyBy(cellSize),\n sePoint = nwPoint.add([cellSize, cellSize]),\n\n // @TODO for Leaflet 0.8\n // nw = map.wrapLatLng(map.unproject(nwPoint, coords.z)),\n // se = map.wrapLatLng(map.unproject(sePoint, coords.z));\n\n nw = map.unproject(nwPoint, coords.z).wrap(),\n se = map.unproject(sePoint, coords.z).wrap();\n\n return new L.LatLngBounds(nw, se);\n },\n\n // converts cell coordinates to key for the cell cache\n _cellCoordsToKey: function (coords) {\n return coords.x + ':' + coords.y;\n },\n\n // converts cell cache key to coordiantes\n _keyToCellCoords: function (key) {\n var kArr = key.split(':'),\n x = parseInt(kArr[0], 10),\n y = parseInt(kArr[1], 10);\n\n return new L.Point(x, y);\n },\n\n // remove any present cells that are off the specified bounds\n _removeOtherCells: function (bounds) {\n for (var key in this._cells) {\n if (!bounds.contains(this._keyToCellCoords(key))) {\n this._removeCell(key);\n }\n }\n },\n\n _removeCell: function (key) {\n var cell = this._activeCells[key];\n if(cell){\n delete this._activeCells[key];\n\n if (this.cellLeave) {\n this.cellLeave(cell.bounds, cell.coords);\n }\n\n this.fire('cellleave', {\n bounds: cell.bounds,\n coords: cell.coords\n });\n }\n },\n\n _removeCells: function(){\n for (var key in this._cells) {\n var bounds = this._cells[key].bounds;\n var coords = this._cells[key].coords;\n\n if (this.cellLeave) {\n this.cellLeave(bounds, coords);\n }\n\n this.fire('cellleave', {\n bounds: bounds,\n coords: coords\n });\n }\n },\n\n _addCell: function (coords) {\n\n // wrap cell coords if necessary (depending on CRS)\n this._wrapCoords(coords);\n\n // generate the cell key\n var key = this._cellCoordsToKey(coords);\n\n // get the cell from the cache\n var cell = this._cells[key];\n // if this cell should be shown as isnt active yet (enter)\n\n if (cell && !this._activeCells[key]) {\n if (this.cellEnter) {\n this.cellEnter(cell.bounds, coords);\n }\n\n this.fire('cellenter', {\n bounds: cell.bounds,\n coords: coords\n });\n\n this._activeCells[key] = cell;\n }\n\n // if we dont have this cell in the cache yet (create)\n if (!cell) {\n cell = {\n coords: coords,\n bounds: this._cellCoordsToBounds(coords)\n };\n\n this._cells[key] = cell;\n this._activeCells[key] = cell;\n\n if(this.createCell){\n this.createCell(cell.bounds, coords);\n }\n\n this.fire('cellcreate', {\n bounds: cell.bounds,\n coords: coords\n });\n }\n },\n\n _wrapCoords: function (coords) {\n coords.x = this._wrapLng ? L.Util.wrapNum(coords.x, this._wrapLng) : coords.x;\n coords.y = this._wrapLat ? L.Util.wrapNum(coords.y, this._wrapLat) : coords.y;\n }\n\n // get the global cell coordinates range for the current zoom\n // @TODO enable at Leaflet 0.8\n // _getCellNumBounds: function () {\n // // @TODO for Leaflet 0.8\n // // var bounds = this._map.getPixelWorldBounds(),\n // // size = this._getCellSize();\n // //\n // // return bounds ? L.bounds(\n // // bounds.min.divideBy(size).floor(),\n // // bounds.max.divideBy(size).ceil().subtract([1, 1])) : null;\n // }\n\n});","(function(EsriLeaflet){\n\n EsriLeaflet.Layers.FeatureManager = EsriLeaflet.Layers.FeatureGrid.extend({\n\n /**\n * Options\n */\n\n options: {\n where: '1=1',\n fields: ['*'],\n from: false,\n to: false,\n timeField: false,\n timeFilterMode: 'server',\n simplifyFactor: 0,\n precision: 6\n },\n\n /**\n * Constructor\n */\n\n initialize: function (url, options) {\n EsriLeaflet.Layers.FeatureGrid.prototype.initialize.call(this, options);\n\n options = L.setOptions(this, options);\n\n this.url = EsriLeaflet.Util.cleanUrl(url);\n\n this._service = new EsriLeaflet.Services.FeatureLayer(this.url, options);\n\n //use case insensitive regex to look for common fieldnames used for indexing\n /*global console */\n if (this.options.fields[0] !== '*'){\n var oidCheck = false;\n for (var i = 0; i < this.options.fields.length; i++){\n if (this.options.fields[i].match(/^(OBJECTID|FID|OID|ID)$/i)){\n oidCheck = true;\n }\n }\n if (oidCheck === false && console && console.warn){\n console.warn('no known esriFieldTypeOID field detected in fields Array. Please add an attribute field containing unique IDs to ensure the layer can be drawn correctly.');\n }\n }\n\n // Leaflet 0.8 change to new propagation\n this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', function (e) {\n e = L.extend({\n target: this\n }, e);\n this.fire(e.type, e);\n }, this);\n\n if(this.options.timeField.start && this.options.timeField.end){\n this._startTimeIndex = new BinarySearchIndex();\n this._endTimeIndex = new BinarySearchIndex();\n } else if(this.options.timeField){\n this._timeIndex = new BinarySearchIndex();\n }\n\n this._currentSnapshot = []; // cache of what layers should be active\n this._activeRequests = 0;\n this._pendingRequests = [];\n },\n\n /**\n * Layer Interface\n */\n\n onAdd: function(map){\n return EsriLeaflet.Layers.FeatureGrid.prototype.onAdd.call(this, map);\n },\n\n onRemove: function(map){\n return EsriLeaflet.Layers.FeatureGrid.prototype.onRemove.call(this, map);\n },\n\n getAttribution: function () {\n return this.options.attribution;\n },\n\n /**\n * Feature Managment\n */\n\n createCell: function(bounds, coords){\n this._requestFeatures(bounds, coords);\n },\n\n _requestFeatures: function(bounds, coords, callback){\n this._activeRequests++;\n\n // our first active request fires loading\n if(this._activeRequests === 1){\n this.fire('loading', {\n bounds: bounds\n });\n }\n\n return this._buildQuery(bounds).run(function(error, featureCollection, response){\n if(response && response.exceededTransferLimit){\n this.fire('drawlimitexceeded');\n }\n\n //deincriment the request counter\n this._activeRequests--;\n\n if(!error && featureCollection.features.length){\n this._addFeatures(featureCollection.features, coords);\n }\n\n if(callback){\n callback.call(this, error, featureCollection);\n }\n\n // if there are no more active requests fire a load event for this view\n if(this._activeRequests <= 0){\n this.fire('load', {\n bounds: bounds\n });\n }\n }, this);\n },\n\n _addFeatures: function(features){\n for (var i = features.length - 1; i >= 0; i--) {\n var id = features[i].id;\n this._currentSnapshot.push(id);\n }\n\n if(this.options.timeField){\n this._buildTimeIndexes(features);\n }\n\n this.createLayers(features);\n },\n\n _buildQuery: function(bounds){\n var query = this._service.query().intersects(bounds).where(this.options.where).fields(this.options.fields).precision(this.options.precision);\n\n if(this.options.simplifyFactor){\n query.simplify(this._map, this.options.simplifyFactor);\n }\n\n if(this.options.timeFilterMode === 'server' && this.options.from && this.options.to){\n query.between(this.options.from, this.options.to);\n }\n\n return query;\n },\n\n /**\n * Where Methods\n */\n\n setWhere: function(where, callback, context){\n\n this.options.where = (where && where.length) ? where : '1=1';\n\n var oldSnapshot = [];\n var newShapshot = [];\n var pendingRequests = 0;\n var requestError = null;\n var requestCallback = L.Util.bind(function(error, featureCollection){\n if(error){\n requestError = error;\n }\n\n if(featureCollection){\n for (var i = featureCollection.features.length - 1; i >= 0; i--) {\n newShapshot.push(featureCollection.features[i].id);\n }\n }\n\n pendingRequests--;\n\n if(pendingRequests <= 0){\n this._currentSnapshot = newShapshot;\n this.removeLayers(oldSnapshot);\n this.addLayers(newShapshot);\n if(callback) {\n callback.call(context, requestError);\n }\n }\n }, this);\n\n for (var i = this._currentSnapshot.length - 1; i >= 0; i--) {\n oldSnapshot.push(this._currentSnapshot[i]);\n }\n\n for(var key in this._activeCells){\n pendingRequests++;\n var coords = this._keyToCellCoords(key);\n var bounds = this._cellCoordsToBounds(coords);\n this._requestFeatures(bounds, key, requestCallback);\n }\n\n return this;\n },\n\n getWhere: function(){\n return this.options.where;\n },\n\n /**\n * Time Range Methods\n */\n\n getTimeRange: function(){\n return [this.options.from, this.options.to];\n },\n\n setTimeRange: function(from, to, callback, context){\n var oldFrom = this.options.from;\n var oldTo = this.options.to;\n var pendingRequests = 0;\n var requestError = null;\n var requestCallback = L.Util.bind(function(error){\n if(error){\n requestError = error;\n }\n this._filterExistingFeatures(oldFrom, oldTo, from, to);\n\n pendingRequests--;\n\n if(callback && pendingRequests <= 0){\n callback.call(context, requestError);\n }\n }, this);\n\n this.options.from = from;\n this.options.to = to;\n\n this._filterExistingFeatures(oldFrom, oldTo, from, to);\n\n if(this.options.timeFilterMode === 'server') {\n for(var key in this._activeCells){\n pendingRequests++;\n var coords = this._keyToCellCoords(key);\n var bounds = this._cellCoordsToBounds(coords);\n this._requestFeatures(bounds, key, requestCallback);\n }\n }\n },\n\n refresh: function(){\n for(var key in this._activeCells){\n var coords = this._keyToCellCoords(key);\n var bounds = this._cellCoordsToBounds(coords);\n this._requestFeatures(bounds, key);\n }\n },\n\n _filterExistingFeatures: function (oldFrom, oldTo, newFrom, newTo) {\n var layersToRemove = (oldFrom && oldTo) ? this._getFeaturesInTimeRange(oldFrom, oldTo) : this._currentSnapshot;\n var layersToAdd = this._getFeaturesInTimeRange(newFrom, newTo);\n\n if(layersToAdd.indexOf){\n for (var i = 0; i < layersToAdd.length; i++) {\n var shouldRemoveLayer = layersToRemove.indexOf(layersToAdd[i]);\n if(shouldRemoveLayer >= 0){\n layersToRemove.splice(shouldRemoveLayer, 1);\n }\n }\n }\n\n this.removeLayers(layersToRemove);\n this.addLayers(layersToAdd);\n },\n\n _getFeaturesInTimeRange: function(start, end){\n var ids = [];\n var search;\n\n if(this.options.timeField.start && this.options.timeField.end){\n var startTimes = this._startTimeIndex.between(start, end);\n var endTimes = this._endTimeIndex.between(start, end);\n search = startTimes.concat(endTimes);\n } else {\n search = this._timeIndex.between(start, end);\n }\n\n for (var i = search.length - 1; i >= 0; i--) {\n ids.push(search[i].id);\n }\n\n return ids;\n },\n\n _buildTimeIndexes: function(geojson){\n var i;\n var feature;\n if(this.options.timeField.start && this.options.timeField.end){\n var startTimeEntries = [];\n var endTimeEntries = [];\n for (i = geojson.length - 1; i >= 0; i--) {\n feature = geojson[i];\n startTimeEntries.push( {\n id: feature.id,\n value: new Date(feature.properties[this.options.timeField.start])\n });\n endTimeEntries.push( {\n id: feature.id,\n value: new Date(feature.properties[this.options.timeField.end])\n });\n }\n this._startTimeIndex.bulkAdd(startTimeEntries);\n this._endTimeIndex.bulkAdd(endTimeEntries);\n } else {\n var timeEntries = [];\n for (i = geojson.length - 1; i >= 0; i--) {\n feature = geojson[i];\n timeEntries.push( {\n id: feature.id,\n value: new Date(feature.properties[this.options.timeField])\n });\n }\n\n this._timeIndex.bulkAdd(timeEntries);\n }\n },\n\n _featureWithinTimeRange: function(feature){\n if(!this.options.from || !this.options.to){\n return true;\n }\n\n var from = +this.options.from.valueOf();\n var to = +this.options.to.valueOf();\n\n if(typeof this.options.timeField === 'string'){\n var date = +feature.properties[this.options.timeField];\n return (date >= from) && (date <= to);\n }\n\n if(this.options.timeField.start && this.options.timeField.end){\n var startDate = +feature.properties[this.options.timeField.start];\n var endDate = +feature.properties[this.options.timeField.end];\n return ((startDate >= from) && (startDate <= to)) || ((endDate >= from) && (endDate <= to));\n }\n },\n\n /**\n * Service Methods\n */\n\n authenticate: function(token){\n this._service.authenticate(token);\n return this;\n },\n\n metadata: function(callback, context){\n this._service.metadata(callback, context);\n return this;\n },\n\n query: function(){\n return this._service.query();\n },\n\n addFeature: function(feature, callback, context){\n this._service.addFeature(feature, function(error, response){\n if(!error){\n this.refresh();\n }\n if(callback){\n callback.call(context, error, response);\n }\n }, this);\n return this;\n },\n\n updateFeature: function(feature, callback, context){\n return this._service.updateFeature(feature, function(error, response){\n if(!error){\n this.refresh();\n }\n if(callback){\n callback.call(context, error, response);\n }\n }, this);\n },\n\n deleteFeature: function(id, callback, context){\n return this._service.deleteFeature(id, function(error, response){\n if(!error && response.objectId){\n this.removeLayers([response.objectId], true);\n }\n if(callback){\n callback.call(context, error, response);\n }\n }, this);\n }\n });\n\n /**\n * Temporal Binary Search Index\n */\n\n function BinarySearchIndex(values) {\n this.values = values || [];\n }\n\n BinarySearchIndex.prototype._query = function(query){\n var minIndex = 0;\n var maxIndex = this.values.length - 1;\n var currentIndex;\n var currentElement;\n var resultIndex;\n\n while (minIndex <= maxIndex) {\n resultIndex = currentIndex = (minIndex + maxIndex) / 2 | 0;\n currentElement = this.values[Math.round(currentIndex)];\n if (+currentElement.value < +query) {\n minIndex = currentIndex + 1;\n } else if (+currentElement.value > +query) {\n maxIndex = currentIndex - 1;\n } else {\n return currentIndex;\n }\n }\n\n return ~maxIndex;\n };\n\n BinarySearchIndex.prototype.sort = function(){\n this.values.sort(function(a, b) {\n return +b.value - +a.value;\n }).reverse();\n this.dirty = false;\n };\n\n BinarySearchIndex.prototype.between = function(start, end){\n if(this.dirty){\n this.sort();\n }\n\n var startIndex = this._query(start);\n var endIndex = this._query(end);\n\n if(startIndex === 0 && endIndex === 0){\n return [];\n }\n\n startIndex = Math.abs(startIndex);\n endIndex = (endIndex < 0) ? Math.abs(endIndex): endIndex + 1;\n\n return this.values.slice(startIndex, endIndex);\n };\n\n BinarySearchIndex.prototype.bulkAdd = function(items){\n this.dirty = true;\n this.values = this.values.concat(items);\n };\n\n})(EsriLeaflet);","EsriLeaflet.Layers.FeatureLayer = EsriLeaflet.Layers.FeatureManager.extend({\n\n statics: {\n EVENTS: 'click dblclick mouseover mouseout mousemove contextmenu popupopen popupclose'\n },\n\n /**\n * Constructor\n */\n\n initialize: function (url, options) {\n EsriLeaflet.Layers.FeatureManager.prototype.initialize.call(this, url, options);\n\n options = L.setOptions(this, options);\n\n this._layers = {};\n this._leafletIds = {};\n this._key = 'c'+(Math.random() * 1e9).toString(36).replace('.', '_');\n },\n\n /**\n * Layer Interface\n */\n\n onAdd: function(map){\n return EsriLeaflet.Layers.FeatureManager.prototype.onAdd.call(this, map);\n },\n\n onRemove: function(map){\n\n for (var i in this._layers) {\n map.removeLayer(this._layers[i]);\n }\n\n return EsriLeaflet.Layers.FeatureManager.prototype.onRemove.call(this, map);\n },\n\n createNewLayer: function(geojson){\n // @TODO Leaflet 0.8\n //newLayer = L.GeoJSON.geometryToLayer(geojson, this.options);\n return L.GeoJSON.geometryToLayer(geojson, this.options.pointToLayer, L.GeoJSON.coordsToLatLng, this.options);\n },\n\n /**\n * Feature Managment Methods\n */\n\n createLayers: function(features){\n for (var i = features.length - 1; i >= 0; i--) {\n\n var geojson = features[i];\n\n var layer = this._layers[geojson.id];\n var newLayer;\n\n if(layer && !this._map.hasLayer(layer)){\n this._map.addLayer(layer);\n }\n\n if (layer && layer.setLatLngs) {\n // @TODO Leaflet 0.8\n //newLayer = L.GeoJSON.geometryToLayer(geojson, this.options);\n\n var updateGeo = this.createNewLayer(geojson);\n layer.setLatLngs(updateGeo.getLatLngs());\n }\n\n if(!layer){\n // @TODO Leaflet 0.8\n //newLayer = L.GeoJSON.geometryToLayer(geojson, this.options);\n\n newLayer = this.createNewLayer(geojson);\n newLayer.feature = geojson;\n newLayer.defaultOptions = newLayer.options;\n newLayer._leaflet_id = this._key + '_' + geojson.id;\n\n this._leafletIds[newLayer._leaflet_id] = geojson.id;\n\n // bubble events from layers to this\n // @TODO Leaflet 0.8\n // newLayer.addEventParent(this);\n\n newLayer.on(EsriLeaflet.Layers.FeatureLayer.EVENTS, this._propagateEvent, this);\n\n // bind a popup if we have one\n if(this._popup && newLayer.bindPopup){\n newLayer.bindPopup(this._popup(newLayer.feature, newLayer), this._popupOptions);\n }\n\n if(this.options.onEachFeature){\n this.options.onEachFeature(newLayer.feature, newLayer);\n }\n\n // cache the layer\n this._layers[newLayer.feature.id] = newLayer;\n\n // style the layer\n this.resetStyle(newLayer.feature.id);\n\n this.fire('createfeature', {\n feature: newLayer.feature\n });\n\n // add the layer if it is within the time bounds or our layer is not time enabled\n if(!this.options.timeField || (this.options.timeField && this._featureWithinTimeRange(geojson)) ){\n this._map.addLayer(newLayer);\n }\n }\n }\n },\n\n addLayers: function(ids){\n for (var i = ids.length - 1; i >= 0; i--) {\n var layer = this._layers[ids[i]];\n if(layer){\n this.fire('addfeature', {\n feature: layer.feature\n });\n this._map.addLayer(layer);\n }\n }\n },\n\n removeLayers: function(ids, permanent){\n for (var i = ids.length - 1; i >= 0; i--) {\n var id = ids[i];\n var layer = this._layers[id];\n if(layer){\n this.fire('removefeature', {\n feature: layer.feature,\n permanent: permanent\n });\n this._map.removeLayer(layer);\n }\n if(layer && permanent){\n delete this._layers[id];\n }\n }\n },\n\n /**\n * Styling Methods\n */\n\n resetStyle: function (id) {\n var layer = this._layers[id];\n\n if(layer){\n layer.options = layer.defaultOptions;\n this.setFeatureStyle(layer.feature.id, this.options.style);\n }\n\n return this;\n },\n\n setStyle: function (style) {\n this.options.style = style;\n this.eachFeature(function (layer) {\n this.setFeatureStyle(layer.feature.id, style);\n }, this);\n return this;\n },\n\n setFeatureStyle: function (id, style) {\n var layer = this._layers[id];\n\n if (typeof style === 'function') {\n style = style(layer.feature);\n }\n if (layer.setStyle) {\n layer.setStyle(style);\n }\n },\n\n /**\n * Popup Methods\n */\n\n bindPopup: function (fn, options) {\n this._popup = fn;\n this._popupOptions = options;\n for (var i in this._layers) {\n var layer = this._layers[i];\n var popupContent = this._popup(layer.feature, layer);\n layer.bindPopup(popupContent, options);\n }\n return this;\n },\n\n unbindPopup: function () {\n this._popup = false;\n for (var i in this._layers) {\n var layer = this._layers[i];\n if (layer.unbindPopup) {\n layer.unbindPopup();\n } else if (layer.getLayers) {\n var groupLayers = layer.getLayers();\n for (var j in groupLayers) {\n var gLayer = groupLayers[j];\n gLayer.unbindPopup();\n }\n }\n }\n return this;\n },\n\n /**\n * Utility Methods\n */\n\n eachFeature: function (fn, context) {\n for (var i in this._layers) {\n fn.call(context, this._layers[i]);\n }\n return this;\n },\n\n getFeature: function (id) {\n return this._layers[id];\n },\n\n // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js\n // @TODO remove at Leaflet 0.8\n _propagateEvent: function (e) {\n e.layer = this._layers[this._leafletIds[e.target._leaflet_id]];\n e.target = this;\n this.fire(e.type, e);\n }\n});\n\nEsriLeaflet.FeatureLayer = EsriLeaflet.Layers.FeatureLayer;\n\nEsriLeaflet.Layers.featureLayer = function(url, options){\n return new EsriLeaflet.Layers.FeatureLayer(url, options);\n};\n\nEsriLeaflet.featureLayer = function(url, options){\n return new EsriLeaflet.Layers.FeatureLayer(url, options);\n};\n"]} \ No newline at end of file diff --git a/dist/builds/image-service/esri-leaflet-image-service-src.js b/dist/builds/image-service/esri-leaflet-image-service-src.js new file mode 100644 index 000000000..48e8f071f --- /dev/null +++ b/dist/builds/image-service/esri-leaflet-image-service-src.js @@ -0,0 +1,1517 @@ +/*! esri-leaflet - v1.0.0-rc.3 - 2014-11-04 +* Copyright (c) 2014 Environmental Systems Research Institute, Inc. +* Apache License*/ +(function (factory) { + //define an AMD module that relies on 'leaflet' + if (typeof define === 'function' && define.amd) { + define(['leaflet'], function (L) { + return factory(L); + }); + //define a common js module that relies on 'leaflet' + } else if (typeof module === 'object' && typeof module.exports === 'object') { + module.exports = factory(require('leaflet')); + } + + if(typeof window !== 'undefined' && window.L){ + factory(window.L); + } +}(function (L) { +var EsriLeaflet = { //jshint ignore:line + VERSION: '1.0.0-rc.2', + Layers: {}, + Services: {}, + Controls: {}, + Tasks: {}, + Util: {}, + Support: { + CORS: !!(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()), + pointerEvents: document.documentElement.style.pointerEvents === '' + } +}; + +if(typeof window !== 'undefined' && window.L){ + window.L.esri = EsriLeaflet; +} + +(function(EsriLeaflet){ + + // shallow object clone for feature properties and attributes + // from http://jsperf.com/cloning-an-object/2 + function clone(obj) { + var target = {}; + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + target[i] = obj[i]; + } + } + return target; + } + + // checks if 2 x,y points are equal + function pointsEqual(a, b) { + for (var i = 0; i < a.length; i++) { + if (a[i] !== b[i]) { + return false; + } + } + return true; + } + + // checks if the first and last points of a ring are equal and closes the ring + function closeRing(coordinates) { + if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) { + coordinates.push(coordinates[0]); + } + return coordinates; + } + + // determine if polygon ring coordinates are clockwise. clockwise signifies outer ring, counter-clockwise an inner ring + // or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon- + // points-are-in-clockwise-order + function ringIsClockwise(ringToTest) { + var total = 0,i = 0; + var rLength = ringToTest.length; + var pt1 = ringToTest[i]; + var pt2; + for (i; i < rLength - 1; i++) { + pt2 = ringToTest[i + 1]; + total += (pt2[0] - pt1[0]) * (pt2[1] + pt1[1]); + pt1 = pt2; + } + return (total >= 0); + } + + // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L504-L519 + function vertexIntersectsVertex(a1, a2, b1, b2) { + var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]); + var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]); + var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]); + + if ( uB !== 0 ) { + var ua = uaT / uB; + var ub = ubT / uB; + + if ( 0 <= ua && ua <= 1 && 0 <= ub && ub <= 1 ) { + return true; + } + } + + return false; + } + + // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L521-L531 + function arrayIntersectsArray(a, b) { + for (var i = 0; i < a.length - 1; i++) { + for (var j = 0; j < b.length - 1; j++) { + if (vertexIntersectsVertex(a[i], a[i + 1], b[j], b[j + 1])) { + return true; + } + } + } + + return false; + } + + // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L470-L480 + function coordinatesContainPoint(coordinates, point) { + var contains = false; + for(var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) { + if (((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1]) || + (coordinates[j][1] <= point[1] && point[1] < coordinates[i][1])) && + (point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0])) { + contains = !contains; + } + } + return contains; + } + + // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L106-L113 + function coordinatesContainCoordinates(outer, inner){ + var intersects = arrayIntersectsArray(outer, inner); + var contains = coordinatesContainPoint(outer, inner[0]); + if(!intersects && contains){ + return true; + } + return false; + } + + // do any polygons in this array contain any other polygons in this array? + // used for checking for holes in arcgis rings + // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L117-L172 + function convertRingsToGeoJSON(rings){ + var outerRings = []; + var holes = []; + var x; // iterator + var outerRing; // current outer ring being evaluated + var hole; // current hole being evaluated + + // for each ring + for (var r = 0; r < rings.length; r++) { + var ring = closeRing(rings[r].slice(0)); + if(ring.length < 4){ + continue; + } + // is this ring an outer ring? is it clockwise? + if(ringIsClockwise(ring)){ + var polygon = [ ring ]; + outerRings.push(polygon); // push to outer rings + } else { + holes.push(ring); // counterclockwise push to holes + } + } + + var uncontainedHoles = []; + + // while there are holes left... + while(holes.length){ + // pop a hole off out stack + hole = holes.pop(); + + // loop over all outer rings and see if they contain our hole. + var contained = false; + for (x = outerRings.length - 1; x >= 0; x--) { + outerRing = outerRings[x][0]; + if(coordinatesContainCoordinates(outerRing, hole)){ + // the hole is contained push it into our polygon + outerRings[x].push(hole); + contained = true; + break; + } + } + + // ring is not contained in any outer ring + // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320 + if(!contained){ + uncontainedHoles.push(hole); + } + } + + // if we couldn't match any holes using contains we can try intersects... + while(uncontainedHoles.length){ + // pop a hole off out stack + hole = uncontainedHoles.pop(); + + // loop over all outer rings and see if any intersect our hole. + var intersects = false; + for (x = outerRings.length - 1; x >= 0; x--) { + outerRing = outerRings[x][0]; + if(arrayIntersectsArray(outerRing, hole)){ + // the hole is contained push it into our polygon + outerRings[x].push(hole); + intersects = true; + break; + } + } + + if(!intersects) { + outerRings.push([hole.reverse()]); + } + } + + if(outerRings.length === 1){ + return { + type: 'Polygon', + coordinates: outerRings[0] + }; + } else { + return { + type: 'MultiPolygon', + coordinates: outerRings + }; + } + } + + // This function ensures that rings are oriented in the right directions + // outer rings are clockwise, holes are counterclockwise + // used for converting GeoJSON Polygons to ArcGIS Polygons + function orientRings(poly){ + var output = []; + var polygon = poly.slice(0); + var outerRing = closeRing(polygon.shift().slice(0)); + if(outerRing.length >= 4){ + if(!ringIsClockwise(outerRing)){ + outerRing.reverse(); + } + + output.push(outerRing); + + for (var i = 0; i < polygon.length; i++) { + var hole = closeRing(polygon[i].slice(0)); + if(hole.length >= 4){ + if(ringIsClockwise(hole)){ + hole.reverse(); + } + output.push(hole); + } + } + } + + return output; + } + + // This function flattens holes in multipolygons to one array of polygons + // used for converting GeoJSON Polygons to ArcGIS Polygons + function flattenMultiPolygonRings(rings){ + var output = []; + for (var i = 0; i < rings.length; i++) { + var polygon = orientRings(rings[i]); + for (var x = polygon.length - 1; x >= 0; x--) { + var ring = polygon[x].slice(0); + output.push(ring); + } + } + return output; + } + + // convert an extent (ArcGIS) to LatLngBounds (Leaflet) + EsriLeaflet.Util.extentToBounds = function(extent){ + var sw = new L.LatLng(extent.ymin, extent.xmin); + var ne = new L.LatLng(extent.ymax, extent.xmax); + return new L.LatLngBounds(sw, ne); + }; + + // convert an LatLngBounds (Leaflet) to extent (ArcGIS) + EsriLeaflet.Util.boundsToExtent = function(bounds) { + bounds = L.latLngBounds(bounds); + return { + 'xmin': bounds.getSouthWest().lng, + 'ymin': bounds.getSouthWest().lat, + 'xmax': bounds.getNorthEast().lng, + 'ymax': bounds.getNorthEast().lat, + 'spatialReference': { + 'wkid' : 4326 + } + }; + }; + + EsriLeaflet.Util.arcgisToGeojson = function (arcgis, idAttribute){ + var geojson = {}; + + if(typeof arcgis.x === 'number' && typeof arcgis.y === 'number'){ + geojson.type = 'Point'; + geojson.coordinates = [arcgis.x, arcgis.y]; + } + + if(arcgis.points){ + geojson.type = 'MultiPoint'; + geojson.coordinates = arcgis.points.slice(0); + } + + if(arcgis.paths) { + if(arcgis.paths.length === 1){ + geojson.type = 'LineString'; + geojson.coordinates = arcgis.paths[0].slice(0); + } else { + geojson.type = 'MultiLineString'; + geojson.coordinates = arcgis.paths.slice(0); + } + } + + if(arcgis.rings) { + geojson = convertRingsToGeoJSON(arcgis.rings.slice(0)); + } + + if(arcgis.geometry || arcgis.attributes) { + geojson.type = 'Feature'; + geojson.geometry = (arcgis.geometry) ? EsriLeaflet.Util.arcgisToGeojson(arcgis.geometry) : null; + geojson.properties = (arcgis.attributes) ? clone(arcgis.attributes) : null; + if(arcgis.attributes) { + geojson.id = arcgis.attributes[idAttribute] || arcgis.attributes.OBJECTID || arcgis.attributes.FID; + } + } + + return geojson; + }; + + // GeoJSON -> ArcGIS + EsriLeaflet.Util.geojsonToArcGIS = function(geojson, idAttribute){ + idAttribute = idAttribute || 'OBJECTID'; + var spatialReference = { wkid: 4326 }; + var result = {}; + var i; + + switch(geojson.type){ + case 'Point': + result.x = geojson.coordinates[0]; + result.y = geojson.coordinates[1]; + result.spatialReference = spatialReference; + break; + case 'MultiPoint': + result.points = geojson.coordinates.slice(0); + result.spatialReference = spatialReference; + break; + case 'LineString': + result.paths = [geojson.coordinates.slice(0)]; + result.spatialReference = spatialReference; + break; + case 'MultiLineString': + result.paths = geojson.coordinates.slice(0); + result.spatialReference = spatialReference; + break; + case 'Polygon': + result.rings = orientRings(geojson.coordinates.slice(0)); + result.spatialReference = spatialReference; + break; + case 'MultiPolygon': + result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0)); + result.spatialReference = spatialReference; + break; + case 'Feature': + if(geojson.geometry) { + result.geometry = EsriLeaflet.Util.geojsonToArcGIS(geojson.geometry, idAttribute); + } + result.attributes = (geojson.properties) ? clone(geojson.properties) : {}; + if(geojson.id){ + result.attributes[idAttribute] = geojson.id; + } + break; + case 'FeatureCollection': + result = []; + for (i = 0; i < geojson.features.length; i++){ + result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.features[i], idAttribute)); + } + break; + case 'GeometryCollection': + result = []; + for (i = 0; i < geojson.geometries.length; i++){ + result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.geometries[i], idAttribute)); + } + break; + } + + return result; + }; + + EsriLeaflet.Util.responseToFeatureCollection = function(response, idAttribute){ + var objectIdField; + + if(idAttribute){ + objectIdField = idAttribute; + } else if(response.objectIdFieldName){ + objectIdField = response.objectIdFieldName; + } else if(response.fields) { + for (var j = 0; j <= response.fields.length - 1; j++) { + if(response.fields[j].type === 'esriFieldTypeOID') { + objectIdField = response.fields[j].name; + break; + } + } + } else { + objectIdField = 'OBJECTID'; + } + + var featureCollection = { + type: 'FeatureCollection', + features: [] + }; + var features = response.features || response.results; + if(features.length){ + for (var i = features.length - 1; i >= 0; i--) { + featureCollection.features.push(EsriLeaflet.Util.arcgisToGeojson(features[i], objectIdField)); + } + } + + return featureCollection; + }; + + // trim whitespace and add a tailing slash is needed to a url + EsriLeaflet.Util.cleanUrl = function(url){ + url = url.replace(/\s\s*/g, ''); + + //add a trailing slash to the url if the user omitted it + if(url[url.length-1] !== '/'){ + url += '/'; + } + + return url; + }; + + EsriLeaflet.Util.geojsonTypeToArcGIS = function (geoJsonType) { + var arcgisGeometryType; + switch (geoJsonType) { + case 'Point': + arcgisGeometryType = 'esriGeometryPoint'; + break; + case 'MultiPoint': + arcgisGeometryType = 'esriGeometryMultipoint'; + break; + case 'LineString': + arcgisGeometryType = 'esriGeometryPolyline'; + break; + case 'MultiLineString': + arcgisGeometryType = 'esriGeometryPolyline'; + break; + case 'Polygon': + arcgisGeometryType = 'esriGeometryPolygon'; + break; + case 'MultiPolygon': + arcgisGeometryType = 'esriGeometryPolygon'; + break; + } + return arcgisGeometryType; + }; + +})(EsriLeaflet); + +(function(EsriLeaflet){ + + var callbacks = 0; + + window._EsriLeafletCallbacks = {}; + + function serialize(params){ + var data = ''; + + params.f = 'json'; + + for (var key in params){ + if(params.hasOwnProperty(key)){ + var param = params[key]; + var type = Object.prototype.toString.call(param); + var value; + + if(data.length){ + data += '&'; + } + + if(type === '[object Array]' || type === '[object Object]'){ + value = JSON.stringify(param); + } else if (type === '[object Date]'){ + value = param.valueOf(); + } else { + value = param; + } + + data += encodeURIComponent(key) + '=' + encodeURIComponent(value); + } + } + + return data; + } + + function createRequest(callback, context){ + var httpRequest = new XMLHttpRequest(); + + httpRequest.onerror = function(e) { + callback.call(context, { + error: { + code: 500, + message: 'XMLHttpRequest error' + } + }, null); + }; + + httpRequest.onreadystatechange = function(){ + var response; + var error; + + if (httpRequest.readyState === 4) { + try { + response = JSON.parse(httpRequest.responseText); + } catch(e) { + response = null; + error = { + code: 500, + message: 'Could not parse response as JSON.' + }; + } + + if (!error && response.error) { + error = response.error; + response = null; + } + + callback.call(context, error, response); + } + }; + + return httpRequest; + } + + // AJAX handlers for CORS (modern browsers) or JSONP (older browsers) + EsriLeaflet.Request = { + request: function(url, params, callback, context){ + var paramString = serialize(params); + var httpRequest = createRequest(callback, context); + var requestLength = (url + '?' + paramString).length; + + // request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest + if(requestLength <= 2000 && L.esri.Support.CORS){ + httpRequest.open('GET', url + '?' + paramString); + httpRequest.send(null); + + // request is less more then 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest + } else if (requestLength > 2000 && L.esri.Support.CORS){ + httpRequest.open('POST', url); + httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + httpRequest.send(paramString); + + // request is less more then 2000 characters and the browser does not support CORS, make a JSONP request + } else if(requestLength <= 2000 && !L.esri.Support.CORS){ + return L.esri.Request.get.JSONP(url, params, callback, context); + + // request is longer then 2000 characters and the browser does not support CORS, log a warning + } else { + if(console && console.warn){ + console.warn('a request to ' + url + ' 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'); + return; + } + } + + return httpRequest; + }, + post: { + XMLHTTP: function (url, params, callback, context) { + var httpRequest = createRequest(callback, context); + httpRequest.open('POST', url); + httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + httpRequest.send(serialize(params)); + + return httpRequest; + } + }, + + get: { + CORS: function (url, params, callback, context) { + var httpRequest = createRequest(callback, context); + + httpRequest.open('GET', url + '?' + serialize(params), true); + httpRequest.send(null); + + return httpRequest; + }, + JSONP: function(url, params, callback, context){ + 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){ + if(window._EsriLeafletCallbacks[callbackId] !== true){ + var error; + var responseType = Object.prototype.toString.call(response); + + if(!(responseType === '[object Object]' || responseType === '[object Array]')){ + error = { + error: { + code: 500, + message: 'Expected array or object as JSONP response' + } + }; + response = null; + } + + if (!error && response.error) { + error = response; + response = null; + } + + callback.call(context, error, response); + window._EsriLeafletCallbacks[callbackId] = true; + } + }; + + callbacks++; + + return { + id: callbackId, + url: script.src, + abort: function(){ + window._EsriLeafletCallbacks._callback[callbackId]({ + code: 0, + message: 'Request aborted.' + }); + } + }; + } + } + }; + + // Choose the correct AJAX handler depending on CORS support + EsriLeaflet.get = (EsriLeaflet.Support.CORS) ? EsriLeaflet.Request.get.CORS : EsriLeaflet.Request.get.JSONP; + + // Always use XMLHttpRequest for posts + EsriLeaflet.post = EsriLeaflet.Request.post.XMLHTTP; + + // expose a common request method the uses GET\POST based on request length + EsriLeaflet.request = EsriLeaflet.Request.request; + +})(EsriLeaflet); + +EsriLeaflet.Services.Service = L.Class.extend({ + + includes: L.Mixin.Events, + + options: { + proxy: false, + useCors: EsriLeaflet.Support.CORS + }, + + initialize: function (url, options) { + this.url = EsriLeaflet.Util.cleanUrl(url); + this._requestQueue = []; + this._authenticating = false; + L.Util.setOptions(this, options); + }, + + get: function (path, params, callback, context) { + return this._request('get', path, params, callback, context); + }, + + post: function (path, params, callback, context) { + return this._request('post', path, params, callback, context); + }, + + request: function (path, params, callback, context) { + return this._request('request', path, params, callback, context); + }, + + metadata: function (callback, context) { + return this._request('get', '', {}, callback, context); + }, + + authenticate: function(token){ + this._authenticating = false; + this.options.token = token; + this._runQueue(); + return this; + }, + + _request: function(method, path, params, callback, context){ + this.fire('requeststart', { + url: this.url + path, + params: params, + method: method + }); + + var wrappedCallback = this._createServiceCallback(method, path, params, callback, context); + + if (this.options.token) { + params.token = this.options.token; + } + + if (this._authenticating) { + this._requestQueue.push([method, path, params, callback, context]); + return; + } else { + var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path; + + if((method === 'get' || method === 'request') && !this.options.useCors){ + return EsriLeaflet.Request.get.JSONP(url, params, wrappedCallback); + } else { + return EsriLeaflet[method](url, params, wrappedCallback); + } + } + }, + + _createServiceCallback: function(method, path, params, callback, context){ + var request = [method, path, params, callback, context]; + + return L.Util.bind(function(error, response){ + + if (error && (error.code === 499 || error.code === 498)) { + this._authenticating = true; + + this._requestQueue.push(request); + + this.fire('authenticationrequired', { + authenticate: L.Util.bind(this.authenticate, this) + }); + } else { + callback.call(context, error, response); + + if(error) { + this.fire('requesterror', { + url: this.url + path, + params: params, + message: error.message, + code: error.code, + method: method + }); + } else { + this.fire('requestsuccess', { + url: this.url + path, + params: params, + response: response, + method: method + }); + } + + this.fire('requestend', { + url: this.url + path, + params: params, + method: method + }); + } + }, this); + }, + + _runQueue: function(){ + for (var i = this._requestQueue.length - 1; i >= 0; i--) { + var request = this._requestQueue[i]; + var method = request.shift(); + this[method].apply(this, request); + } + this._requestQueue = []; + } + +}); + +EsriLeaflet.Services.service = function(url, params){ + return new EsriLeaflet.Services.Service(url, params); +}; + +EsriLeaflet.Services.ImageService = EsriLeaflet.Services.Service.extend({ + + query: function () { + return new EsriLeaflet.Tasks.Query(this); + }, + + identify: function() { + return new EsriLeaflet.Tasks.IdentifyImage(this); + } +}); + +EsriLeaflet.Services.imageService = function(url, params){ + return new EsriLeaflet.Services.ImageService(url, params); +}; + +EsriLeaflet.Tasks.Task = L.Class.extend({ + + options: { + proxy: false, + useCors: EsriLeaflet.Support.CORS + }, + + //Generate a method for each methodName:paramName in the setters for this task. + generateSetter: function(param, context){ + var isArray = param.match(/([a-zA-Z]+)\[\]/); + + param = (isArray) ? isArray[1] : param; + + if(isArray){ + return L.Util.bind(function(value){ + // this.params[param] = (this.params[param]) ? this.params[param] + ',' : ''; + if (L.Util.isArray(value)) { + this.params[param] = value.join(','); + } else { + this.params[param] = value; + } + return this; + }, context); + } else { + return L.Util.bind(function(value){ + this.params[param] = value; + return this; + }, context); + } + }, + + initialize: function(endpoint, options){ + // endpoint can be either a url to an ArcGIS Rest Service or an instance of EsriLeaflet.Service + if(endpoint.url && endpoint.request){ + this._service = endpoint; + this.url = endpoint.url; + } else { + this.url = EsriLeaflet.Util.cleanUrl(endpoint); + } + + // clone default params into this object + this.params = L.Util.extend({}, this.params || {}); + + // generate setter methods based on the setters object implimented a child class + if(this.setters){ + for (var setter in this.setters){ + var param = this.setters[setter]; + this[setter] = this.generateSetter(param, this); + } + } + + L.Util.setOptions(this, options); + }, + + token: function(token){ + if(this._service){ + this._service.authenticate(token); + } else { + this.params.token = token; + } + return this; + }, + + request: function(callback, context){ + if(this._service){ + return this._service.request(this.path, this.params, callback, context); + } else { + return this._request('request', this.path, this.params, callback, context); + } + }, + + _request: function(method, path, params, callback, context){ + var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path; + if((method === 'get' || method === 'request') && !this.options.useCors){ + return EsriLeaflet.Request.get.JSONP(url, params, callback, context); + } else{ + return EsriLeaflet[method](url, params, callback, context); + } + } +}); + +EsriLeaflet.Tasks.Query = EsriLeaflet.Tasks.Task.extend({ + setters: { + 'offset': 'offset', + 'limit': 'limit', + 'outFields': 'fields[]', + 'precision': 'geometryPrecision', + 'featureIds': 'objectIds[]', + 'returnGeometry': 'returnGeometry', + 'token': 'token' + }, + + path: 'query', + + params: { + returnGeometry: true, + where: '1=1', + outSr: 4326, + outFields: '*' + }, + + within: function(geometry){ + this._setGeometry(geometry); + this.params.spatialRel = 'esriSpatialRelContains'; // will make code read layer within geometry, to the api this will reads geometry contains layer + return this; + }, + + intersects: function(geometry){ + this._setGeometry(geometry); + this.params.spatialRel = 'esriSpatialRelIntersects'; + return this; + }, + + contains: function(geometry){ + this._setGeometry(geometry); + this.params.spatialRel = 'esriSpatialRelWithin'; // will make code read layer contains geometry, to the api this will reads geometry within layer + return this; + }, + + // crosses: function(geometry){ + // this._setGeometry(geometry); + // this.params.spatialRel = 'esriSpatialRelCrosses'; + // return this; + // }, + + // touches: function(geometry){ + // this._setGeometry(geometry); + // this.params.spatialRel = 'esriSpatialRelTouches'; + // return this; + // }, + + overlaps: function(geometry){ + this._setGeometry(geometry); + this.params.spatialRel = 'esriSpatialRelOverlaps'; + return this; + }, + + // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online + nearby: function(latlng, radius){ + latlng = L.latLng(latlng); + this.params.geometry = ([latlng.lng,latlng.lat]).join(','); + this.params.geometryType = 'esriGeometryPoint'; + this.params.spatialRel = 'esriSpatialRelIntersects'; + this.params.units = 'esriSRUnit_Meter'; + this.params.distance = radius; + this.params.inSr = 4326; + return this; + }, + + where: function(string){ + this.params.where = string.replace(/"/g, "\'"); // jshint ignore:line + return this; + }, + + between: function(start, end){ + this.params.time = ([start.valueOf(), end.valueOf()]).join(); + return this; + }, + + fields: function (fields) { + if (L.Util.isArray(fields)) { + this.params.outFields = fields.join(','); + } else { + this.params.outFields = fields; + } + return this; + }, + + simplify: function(map, factor){ + var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast()); + this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor; + return this; + }, + + orderBy: function(fieldName, order){ + order = order || 'ASC'; + this.params.orderByFields = (this.params.orderByFields) ? this.params.orderByFields + ',' : ''; + this.params.orderByFields += ([fieldName, order]).join(' '); + return this; + }, + + returnGeometry: function(bool){ + this.params.returnGeometry = bool; + return this; + }, + + run: function(callback, context){ + this._cleanParams(); + return this.request(function(error, response){ + callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response); + }, context); + }, + + count: function(callback, context){ + this._cleanParams(); + this.params.returnCountOnly = true; + return this.request(function(error, response){ + callback.call(this, error, (response && response.count), response); + }, context); + }, + + ids: function(callback, context){ + this._cleanParams(); + this.params.returnIdsOnly = true; + return this.request(function(error, response){ + callback.call(this, error, (response && response.objectIds), response); + }, context); + }, + + // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online + bounds: function(callback, context){ + this._cleanParams(); + this.params.returnExtentOnly = true; + return this.request(function(error, response){ + callback.call(context, error, (response && response.extent && EsriLeaflet.Util.extentToBounds(response.extent)), response); + }, context); + }, + + // only valid for image services + pixelSize: function(point){ + point = L.point(point); + this.params.pixelSize = ([point.x,point.y]).join(','); + return this; + }, + + // only valid for map services + layer: function(layer){ + this.path = layer + '/query'; + return this; + }, + + _cleanParams: function(){ + delete this.params.returnIdsOnly; + delete this.params.returnExtentOnly; + delete this.params.returnCountOnly; + }, + + _setGeometry: function(geometry) { + this.params.inSr = 4326; + + // convert bounds to extent and finish + if ( geometry instanceof L.LatLngBounds ) { + // set geometry + geometryType + this.params.geometry = EsriLeaflet.Util.boundsToExtent(geometry); + this.params.geometryType = 'esriGeometryEnvelope'; + return; + } + + // convert L.Marker > L.LatLng + if(geometry.getLatLng){ + geometry = geometry.getLatLng(); + } + + // convert L.LatLng to a geojson point and continue; + if (geometry instanceof L.LatLng) { + geometry = { + type: 'Point', + coordinates: [geometry.lng, geometry.lat] + }; + } + + // handle L.GeoJSON, pull out the first geometry + if ( geometry instanceof L.GeoJSON ) { + //reassign geometry to the GeoJSON value (we are assuming that only one feature is present) + geometry = geometry.getLayers()[0].feature.geometry; + this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry); + this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type); + } + + // Handle L.Polyline and L.Polygon + if (geometry.toGeoJSON) { + geometry = geometry.toGeoJSON(); + } + + // handle GeoJSON feature by pulling out the geometry + if ( geometry.type === 'Feature' ) { + // get the geometry of the geojson feature + geometry = geometry.geometry; + } + + // confirm that our GeoJSON is a point, line or polygon + if ( geometry.type === 'Point' || geometry.type === 'LineString' || geometry.type === 'Polygon') { + this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry); + this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type); + return; + } + + // warn the user if we havn't found a + /* global console */ + if(console && console.warn) { + console.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'); + } + + return; + } +}); + +EsriLeaflet.Tasks.query = function(url, params){ + return new EsriLeaflet.Tasks.Query(url, params); +}; + +EsriLeaflet.Tasks.Identify = EsriLeaflet.Tasks.Task.extend({ + path: 'identify', + + between: function(start, end){ + this.params.time = ([start.valueOf(), end.valueOf()]).join(','); + return this; + }, + + returnGeometry: function (returnGeometry) { + this.params.returnGeometry = returnGeometry; + return this; + } +}); + + +EsriLeaflet.Layers.RasterLayer = L.Class.extend({ + includes: L.Mixin.Events, + + options: { + opacity: 1, + position: 'front', + f: 'image' + }, + + onAdd: function (map) { + this._map = map; + + this._update = L.Util.limitExecByInterval(this._update, this.options.updateInterval, this); + + if (map.options.crs && map.options.crs.code) { + var sr = map.options.crs.code.split(':')[1]; + this.options.bboxSR = sr; + this.options.imageSR = sr; + } + + map.on('moveend', this._update, this); + + this._update(); + + if(this._popup){ + this._map.on('click', this._getPopupData, this); + this._map.on('dblclick', this._resetPopupState, this); + } + }, + + bindPopup: function(fn, popupOptions){ + this._shouldRenderPopup = false; + this._lastClick = false; + this._popup = L.popup(popupOptions); + this._popupFunction = fn; + if(this._map){ + this._map.on('click', this._getPopupData, this); + this._map.on('dblclick', this._resetPopupState, this); + } + return this; + }, + + unbindPopup: function(){ + if(this._map){ + this._map.closePopup(this._popup); + this._map.off('click', this._getPopupData, this); + this._map.off('dblclick', this._resetPopupState, this); + } + this._popup = false; + return this; + }, + + onRemove: function (map) { + + if (this._currentImage) { + this._map.removeLayer(this._currentImage); + } + + if(this._popup){ + this._map.off('click', this._getPopupData, this); + this._map.off('dblclick', this._resetPopupState, this); + } + + this._map.off('moveend', this._update, this); + this._map = null; + }, + + addTo: function(map){ + map.addLayer(this); + return this; + }, + + removeFrom: function(map){ + map.removeLayer(this); + return this; + }, + + bringToFront: function(){ + this.options.position = 'front'; + if(this._currentImage){ + this._currentImage.bringToFront(); + } + return this; + }, + + bringToBack: function(){ + this.options.position = 'back'; + if(this._currentImage){ + this._currentImage.bringToBack(); + } + return this; + }, + + getAttribution: function () { + return this.options.attribution; + }, + + getOpacity: function(){ + return this.options.opacity; + }, + + setOpacity: function(opacity){ + this.options.opacity = opacity; + this._currentImage.setOpacity(opacity); + return this; + }, + + getTimeRange: function(){ + return [this.options.from, this.options.to]; + }, + + setTimeRange: function(from, to){ + this.options.from = from; + this.options.to = to; + this._update(); + return this; + }, + + metadata: function(callback, context){ + this._service.metadata(callback, context); + return this; + }, + + authenticate: function(token){ + this._service.authenticate(token); + return this; + }, + + _renderImage: function(url, bounds){ + if(this._map){ + var image = new L.ImageOverlay(url, bounds, { + opacity: 0 + }).addTo(this._map); + + image.once('load', function(e){ + var newImage = e.target; + var oldImage = this._currentImage; + if(newImage._bounds.equals(bounds)){ + this._currentImage = newImage; + + if(this.options.position === 'front'){ + this.bringToFront(); + } else { + this.bringToBack(); + } + + if(this._map && this._currentImage._map){ + this._currentImage.setOpacity(this.options.opacity); + } else { + this._currentImage._map.removeLayer(this._currentImage); + } + + if(oldImage){ + this._map.removeLayer(oldImage); + } + + } else { + this._map.removeLayer(newImage); + } + + this.fire('load', { + bounds: bounds + }); + + }, this); + + this.fire('loading', { + bounds: bounds + }); + } + }, + + _update: function () { + if(!this._map){ + return; + } + + var zoom = this._map.getZoom(); + var bounds = this._map.getBounds(); + + if(this._animatingZoom){ + return; + } + + if (this._map._panTransition && this._map._panTransition._inProgress) { + return; + } + + if (zoom > this.options.maxZoom || zoom < this.options.minZoom) { + return; + } + var params = this._buildExportParams(); + + this._requestExport(params, bounds); + }, + + // TODO: refactor these into raster layer + _renderPopup: function(latlng, error, results, response){ + latlng = L.latLng(latlng); + if(this._shouldRenderPopup && this._lastClick.equals(latlng)){ + //add the popup to the map where the mouse was clicked at + var content = this._popupFunction(error, results, response); + if (content) { + this._popup.setLatLng(latlng).setContent(content).openOn(this._map); + } + } + }, + + _resetPopupState: function(e){ + this._shouldRenderPopup = false; + this._lastClick = e.latlng; + }, + + // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js + // @TODO remove at Leaflet 0.8 + _propagateEvent: function (e) { + e = L.extend({ + layer: e.target, + target: this + }, e); + this.fire(e.type, e); + } +}); + +EsriLeaflet.Layers.ImageMapLayer = EsriLeaflet.Layers.RasterLayer.extend({ + + options: { + updateInterval: 150, + format: 'jpgpng' + }, + + query: function(){ + return this._service.query(); + }, + + identify: function(){ + return this._service.identify(); + }, + + initialize: function (url, options) { + this.url = EsriLeaflet.Util.cleanUrl(url); + this._service = new EsriLeaflet.Services.ImageService(this.url, options); + this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', this._propagateEvent, this); + L.Util.setOptions(this, options); + }, + + setPixelType: function (pixelType) { + this.options.pixelType = pixelType; + this._update(); + return this; + }, + + getPixelType: function () { + return this.options.pixelType; + }, + + setBandIds: function (bandIds) { + if (L.Util.isArray(bandIds)) { + this.options.bandIds = bandIds.join(','); + } else { + this.options.bandIds = bandIds.toString(); + } + this._update(); + return this; + }, + + getBandIds: function () { + return this.options.bandIds; + }, + + setNoData: function (noData, noDataInterpretation) { + if (L.Util.isArray(noData)) { + this.options.noData = noData.join(','); + } else { + this.options.noData = noData.toString(); + } + if (noDataInterpretation) { + this.options.noDataInterpretation = noDataInterpretation; + } + this._update(); + return this; + }, + + getNoData: function () { + return this.options.noData; + }, + + getNoDataInterpretation: function () { + return this.options.noDataInterpretation; + }, + + setRenderingRule: function(renderingRule) { + this.options.renderingRule = renderingRule; + this._update(); + }, + + getRenderingRule: function() { + return this.options.renderingRule; + }, + + setMosaicRule: function(mosaicRule) { + this.options.mosaicRule = mosaicRule; + this._update(); + }, + + getMosaicRule: function() { + return this.options.mosaicRule; + }, + + _getPopupData: function(e){ + var callback = L.Util.bind(function(error, results, response) { + setTimeout(L.Util.bind(function(){ + this._renderPopup(e.latlng, error, results, response); + }, this), 300); + }, this); + + var identifyRequest = this.identify().at(e.latlng); + + // set mosaic rule for identify task if it is set for layer + if (this.options.mosaicRule) { + identifyRequest.setMosaicRule(this.options.mosaicRule); + // @TODO: force return catalog items too? + } + + // @TODO: set rendering rule? Not sure, + // sometimes you want raw pixel values + // if (this.options.renderingRule) { + // identifyRequest.setRenderingRule(this.options.renderingRule); + // } + + identifyRequest.run(callback); + + // set the flags to show the popup + this._shouldRenderPopup = true; + this._lastClick = e.latlng; + }, + + _buildExportParams: function () { + var bounds = this._map.getBounds(); + var size = this._map.getSize(); + var ne = this._map.options.crs.project(bounds._northEast); + var sw = this._map.options.crs.project(bounds._southWest); + + var params = { + bbox: [sw.x, sw.y, ne.x, ne.y].join(','), + size: size.x + ',' + size.y, + format: this.options.format, + bboxSR: this.options.bboxSR, + imageSR: this.options.imageSR + }; + + if (this.options.from && this.options.to) { + params.time = this.options.from.valueOf() + ',' + this.options.to.valueOf(); + } + + if (this.options.pixelType) { + params.pixelType = this.options.pixelType; + } + + if (this.options.interpolation) { + params.interpolation = this.options.interpolation; + } + + if (this.options.compressionQuality) { + params.compressionQuality = this.options.compressionQuality; + } + + if (this.options.bandIds) { + params.bandIds = this.options.bandIds; + } + + if (this.options.noData) { + params.noData = this.options.noData; + } + + if (this.options.noDataInterpretation) { + params.noDataInterpretation = this.options.noDataInterpretation; + } + + if (this._service.options.token) { + params.token = this._service.options.token; + } + + if(this.options.renderingRule) { + params.renderingRule = JSON.stringify(this.options.renderingRule); + } + + if(this.options.mosaicRule) { + params.mosaicRule = JSON.stringify(this.options.mosaicRule); + } + + return params; + }, + + _requestExport: function (params, bounds) { + if (this.options.f === 'json') { + this._service.get('exportImage', params, function(error, response){ + this._renderImage(response.href, bounds); + }, this); + } else { + params.f = 'image'; + this._renderImage(this.url + 'exportImage' + L.Util.getParamString(params), bounds); + } + } +}); + +EsriLeaflet.ImageMapLayer = EsriLeaflet.Layers.ImageMapLayer; + +EsriLeaflet.Layers.imageMapLayer = function (url, options) { + return new EsriLeaflet.Layers.ImageMapLayer(url, options); +}; + +EsriLeaflet.imageMapLayer = function (url, options) { + return new EsriLeaflet.Layers.ImageMapLayer(url, options); +}; + + return EsriLeaflet; +})); +//# sourceMappingURL=esri-leaflet-image-service-src.js.map \ No newline at end of file diff --git a/dist/builds/image-service/esri-leaflet-image-service-src.js.map b/dist/builds/image-service/esri-leaflet-image-service-src.js.map new file mode 100644 index 000000000..2e9228ed9 --- /dev/null +++ b/dist/builds/image-service/esri-leaflet-image-service-src.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/EsriLeaflet.js","../../../src/Util.js","../../../src/Request.js","../../../src/Services/Service.js","../../../src/Services/ImageService.js","../../../src/Tasks/Task.js","../../../src/Tasks/Query.js","../../../src/Tasks/Identify.js","../../../src/Layers/RasterLayer.js","../../../src/Layers/ImageMapLayer.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,GAAG,CAAC,WAAW,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI;AAAA,EACtC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAAA,EACpB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,IAAI;AAAA,EACJ,OAAO;AAAA,IACL,IAAI,KAAK,MAAM,CAAC,cAAc,KAAK,eAAe,EAAE,EAAE,CAAC,GAAG,CAAC,cAAc;AAAA,IACzE,aAAa,EAAE,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,aAAa;AAAA;AAAA;AAAA;AAI/D,EAAE,CAAC,MAAM,CAAC,MAAM,MAAM,SAAS,KAAK,MAAM,CAAC,CAAC;AAAA,EAC1C,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,WAAW;AAAA,C;;ACd7B,CAAC,QAAQ,CAAC,WAAW;AAAA;AAAA,KAEhB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU;AAAA,KAC1D,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;AAAA,EAC7C,QAAQ,CAAC,KAAK,CAAC,GAAG;AAAA,IAChB,GAAG,CAAC,MAAM;AAAA,IACV,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG;AAAA,MACf,EAAE,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;AAAA,QACtB,MAAM,CAAC,CAAC,IAAI,GAAG,CAA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IAAI;AAAA,MAC1B,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,WAAW,GAAG,MAAM,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ;AAAA,QAC/D,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM;AAAA,SACtC,IAAI;AAAA,MACP,IAAI;AAAA,MACJ,MAAM,CAAC,CAAC,IAAI,KAAK;AAAA,MACjB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,IAAI,WAAW,IAAI,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,MAAM;AAAA;AAAA;AAAA;AAAA;AAKxF,WAAW,CAAC,aAAa,GAAG,WAAW,CAAC,MAAM,CAAC,aAAa;AAAA;AAE5D,WAAW,CAAC,MAAM,CAAC,aAAa,GAAG,QAAQ,EAAE,GAAG,EAAE,OAAO;AAAA,EACvD,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO;AAAA;AAAA;AAG1D,WAAW,CAAC,aAAa,GAAG,QAAQ,EAAE,GAAG,EAAE,OAAO;AAAA,EAChD,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO;AAAA,E","file":"esri-leaflet-image-service-src.js","sourcesContent":["var EsriLeaflet = { //jshint ignore:line\n VERSION: '1.0.0-rc.2',\n Layers: {},\n Services: {},\n Controls: {},\n Tasks: {},\n Util: {},\n Support: {\n CORS: !!(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()),\n pointerEvents: document.documentElement.style.pointerEvents === ''\n }\n};\n\nif(typeof window !== 'undefined' && window.L){\n window.L.esri = EsriLeaflet;\n}","(function(EsriLeaflet){\n\n // shallow object clone for feature properties and attributes\n // from http://jsperf.com/cloning-an-object/2\n function clone(obj) {\n var target = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n target[i] = obj[i];\n }\n }\n return target;\n }\n\n // checks if 2 x,y points are equal\n function pointsEqual(a, b) {\n for (var i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n }\n\n // checks if the first and last points of a ring are equal and closes the ring\n function closeRing(coordinates) {\n if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) {\n coordinates.push(coordinates[0]);\n }\n return coordinates;\n }\n\n // determine if polygon ring coordinates are clockwise. clockwise signifies outer ring, counter-clockwise an inner ring\n // or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-\n // points-are-in-clockwise-order\n function ringIsClockwise(ringToTest) {\n var total = 0,i = 0;\n var rLength = ringToTest.length;\n var pt1 = ringToTest[i];\n var pt2;\n for (i; i < rLength - 1; i++) {\n pt2 = ringToTest[i + 1];\n total += (pt2[0] - pt1[0]) * (pt2[1] + pt1[1]);\n pt1 = pt2;\n }\n return (total >= 0);\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L504-L519\n function vertexIntersectsVertex(a1, a2, b1, b2) {\n var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]);\n var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]);\n var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]);\n\n if ( uB !== 0 ) {\n var ua = uaT / uB;\n var ub = ubT / uB;\n\n if ( 0 <= ua && ua <= 1 && 0 <= ub && ub <= 1 ) {\n return true;\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L521-L531\n function arrayIntersectsArray(a, b) {\n for (var i = 0; i < a.length - 1; i++) {\n for (var j = 0; j < b.length - 1; j++) {\n if (vertexIntersectsVertex(a[i], a[i + 1], b[j], b[j + 1])) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L470-L480\n function coordinatesContainPoint(coordinates, point) {\n var contains = false;\n for(var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) {\n if (((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1]) ||\n (coordinates[j][1] <= point[1] && point[1] < coordinates[i][1])) &&\n (point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0])) {\n contains = !contains;\n }\n }\n return contains;\n }\n\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L106-L113\n function coordinatesContainCoordinates(outer, inner){\n var intersects = arrayIntersectsArray(outer, inner);\n var contains = coordinatesContainPoint(outer, inner[0]);\n if(!intersects && contains){\n return true;\n }\n return false;\n }\n\n // do any polygons in this array contain any other polygons in this array?\n // used for checking for holes in arcgis rings\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L117-L172\n function convertRingsToGeoJSON(rings){\n var outerRings = [];\n var holes = [];\n var x; // iterator\n var outerRing; // current outer ring being evaluated\n var hole; // current hole being evaluated\n\n // for each ring\n for (var r = 0; r < rings.length; r++) {\n var ring = closeRing(rings[r].slice(0));\n if(ring.length < 4){\n continue;\n }\n // is this ring an outer ring? is it clockwise?\n if(ringIsClockwise(ring)){\n var polygon = [ ring ];\n outerRings.push(polygon); // push to outer rings\n } else {\n holes.push(ring); // counterclockwise push to holes\n }\n }\n\n var uncontainedHoles = [];\n\n // while there are holes left...\n while(holes.length){\n // pop a hole off out stack\n hole = holes.pop();\n\n // loop over all outer rings and see if they contain our hole.\n var contained = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(coordinatesContainCoordinates(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n contained = true;\n break;\n }\n }\n\n // ring is not contained in any outer ring\n // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320\n if(!contained){\n uncontainedHoles.push(hole);\n }\n }\n\n // if we couldn't match any holes using contains we can try intersects...\n while(uncontainedHoles.length){\n // pop a hole off out stack\n hole = uncontainedHoles.pop();\n\n // loop over all outer rings and see if any intersect our hole.\n var intersects = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(arrayIntersectsArray(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n intersects = true;\n break;\n }\n }\n\n if(!intersects) {\n outerRings.push([hole.reverse()]);\n }\n }\n\n if(outerRings.length === 1){\n return {\n type: 'Polygon',\n coordinates: outerRings[0]\n };\n } else {\n return {\n type: 'MultiPolygon',\n coordinates: outerRings\n };\n }\n }\n\n // This function ensures that rings are oriented in the right directions\n // outer rings are clockwise, holes are counterclockwise\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function orientRings(poly){\n var output = [];\n var polygon = poly.slice(0);\n var outerRing = closeRing(polygon.shift().slice(0));\n if(outerRing.length >= 4){\n if(!ringIsClockwise(outerRing)){\n outerRing.reverse();\n }\n\n output.push(outerRing);\n\n for (var i = 0; i < polygon.length; i++) {\n var hole = closeRing(polygon[i].slice(0));\n if(hole.length >= 4){\n if(ringIsClockwise(hole)){\n hole.reverse();\n }\n output.push(hole);\n }\n }\n }\n\n return output;\n }\n\n // This function flattens holes in multipolygons to one array of polygons\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function flattenMultiPolygonRings(rings){\n var output = [];\n for (var i = 0; i < rings.length; i++) {\n var polygon = orientRings(rings[i]);\n for (var x = polygon.length - 1; x >= 0; x--) {\n var ring = polygon[x].slice(0);\n output.push(ring);\n }\n }\n return output;\n }\n\n // convert an extent (ArcGIS) to LatLngBounds (Leaflet)\n EsriLeaflet.Util.extentToBounds = function(extent){\n var sw = new L.LatLng(extent.ymin, extent.xmin);\n var ne = new L.LatLng(extent.ymax, extent.xmax);\n return new L.LatLngBounds(sw, ne);\n };\n\n // convert an LatLngBounds (Leaflet) to extent (ArcGIS)\n EsriLeaflet.Util.boundsToExtent = function(bounds) {\n bounds = L.latLngBounds(bounds);\n return {\n 'xmin': bounds.getSouthWest().lng,\n 'ymin': bounds.getSouthWest().lat,\n 'xmax': bounds.getNorthEast().lng,\n 'ymax': bounds.getNorthEast().lat,\n 'spatialReference': {\n 'wkid' : 4326\n }\n };\n };\n\n EsriLeaflet.Util.arcgisToGeojson = function (arcgis, idAttribute){\n var geojson = {};\n\n if(typeof arcgis.x === 'number' && typeof arcgis.y === 'number'){\n geojson.type = 'Point';\n geojson.coordinates = [arcgis.x, arcgis.y];\n }\n\n if(arcgis.points){\n geojson.type = 'MultiPoint';\n geojson.coordinates = arcgis.points.slice(0);\n }\n\n if(arcgis.paths) {\n if(arcgis.paths.length === 1){\n geojson.type = 'LineString';\n geojson.coordinates = arcgis.paths[0].slice(0);\n } else {\n geojson.type = 'MultiLineString';\n geojson.coordinates = arcgis.paths.slice(0);\n }\n }\n\n if(arcgis.rings) {\n geojson = convertRingsToGeoJSON(arcgis.rings.slice(0));\n }\n\n if(arcgis.geometry || arcgis.attributes) {\n geojson.type = 'Feature';\n geojson.geometry = (arcgis.geometry) ? EsriLeaflet.Util.arcgisToGeojson(arcgis.geometry) : null;\n geojson.properties = (arcgis.attributes) ? clone(arcgis.attributes) : null;\n if(arcgis.attributes) {\n geojson.id = arcgis.attributes[idAttribute] || arcgis.attributes.OBJECTID || arcgis.attributes.FID;\n }\n }\n\n return geojson;\n };\n\n // GeoJSON -> ArcGIS\n EsriLeaflet.Util.geojsonToArcGIS = function(geojson, idAttribute){\n idAttribute = idAttribute || 'OBJECTID';\n var spatialReference = { wkid: 4326 };\n var result = {};\n var i;\n\n switch(geojson.type){\n case 'Point':\n result.x = geojson.coordinates[0];\n result.y = geojson.coordinates[1];\n result.spatialReference = spatialReference;\n break;\n case 'MultiPoint':\n result.points = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'LineString':\n result.paths = [geojson.coordinates.slice(0)];\n result.spatialReference = spatialReference;\n break;\n case 'MultiLineString':\n result.paths = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'Polygon':\n result.rings = orientRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'MultiPolygon':\n result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'Feature':\n if(geojson.geometry) {\n result.geometry = EsriLeaflet.Util.geojsonToArcGIS(geojson.geometry, idAttribute);\n }\n result.attributes = (geojson.properties) ? clone(geojson.properties) : {};\n if(geojson.id){\n result.attributes[idAttribute] = geojson.id;\n }\n break;\n case 'FeatureCollection':\n result = [];\n for (i = 0; i < geojson.features.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.features[i], idAttribute));\n }\n break;\n case 'GeometryCollection':\n result = [];\n for (i = 0; i < geojson.geometries.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.geometries[i], idAttribute));\n }\n break;\n }\n\n return result;\n };\n\n EsriLeaflet.Util.responseToFeatureCollection = function(response, idAttribute){\n var objectIdField;\n\n if(idAttribute){\n objectIdField = idAttribute;\n } else if(response.objectIdFieldName){\n objectIdField = response.objectIdFieldName;\n } else if(response.fields) {\n for (var j = 0; j <= response.fields.length - 1; j++) {\n if(response.fields[j].type === 'esriFieldTypeOID') {\n objectIdField = response.fields[j].name;\n break;\n }\n }\n } else {\n objectIdField = 'OBJECTID';\n }\n\n var featureCollection = {\n type: 'FeatureCollection',\n features: []\n };\n var features = response.features || response.results;\n if(features.length){\n for (var i = features.length - 1; i >= 0; i--) {\n featureCollection.features.push(EsriLeaflet.Util.arcgisToGeojson(features[i], objectIdField));\n }\n }\n\n return featureCollection;\n };\n\n // trim whitespace and add a tailing slash is needed to a url\n EsriLeaflet.Util.cleanUrl = function(url){\n url = url.replace(/\\s\\s*/g, '');\n\n //add a trailing slash to the url if the user omitted it\n if(url[url.length-1] !== '/'){\n url += '/';\n }\n\n return url;\n };\n\n EsriLeaflet.Util.geojsonTypeToArcGIS = function (geoJsonType) {\n var arcgisGeometryType;\n switch (geoJsonType) {\n case 'Point':\n arcgisGeometryType = 'esriGeometryPoint';\n break;\n case 'MultiPoint':\n arcgisGeometryType = 'esriGeometryMultipoint';\n break;\n case 'LineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'MultiLineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'Polygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n case 'MultiPolygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n }\n return arcgisGeometryType;\n };\n\n})(EsriLeaflet);","(function(EsriLeaflet){\n\n var callbacks = 0;\n\n window._EsriLeafletCallbacks = {};\n\n function serialize(params){\n var data = '';\n\n params.f = 'json';\n\n for (var key in params){\n if(params.hasOwnProperty(key)){\n var param = params[key];\n var type = Object.prototype.toString.call(param);\n var value;\n\n if(data.length){\n data += '&';\n }\n\n if(type === '[object Array]' || type === '[object Object]'){\n value = JSON.stringify(param);\n } else if (type === '[object Date]'){\n value = param.valueOf();\n } else {\n value = param;\n }\n\n data += encodeURIComponent(key) + '=' + encodeURIComponent(value);\n }\n }\n\n return data;\n }\n\n function createRequest(callback, context){\n var httpRequest = new XMLHttpRequest();\n\n httpRequest.onerror = function(e) {\n callback.call(context, {\n error: {\n code: 500,\n message: 'XMLHttpRequest error'\n }\n }, null);\n };\n\n httpRequest.onreadystatechange = function(){\n var response;\n var error;\n\n if (httpRequest.readyState === 4) {\n try {\n response = JSON.parse(httpRequest.responseText);\n } catch(e) {\n response = null;\n error = {\n code: 500,\n message: 'Could not parse response as JSON.'\n };\n }\n\n if (!error && response.error) {\n error = response.error;\n response = null;\n }\n\n callback.call(context, error, response);\n }\n };\n\n return httpRequest;\n }\n\n // AJAX handlers for CORS (modern browsers) or JSONP (older browsers)\n EsriLeaflet.Request = {\n request: function(url, params, callback, context){\n var paramString = serialize(params);\n var httpRequest = createRequest(callback, context);\n var requestLength = (url + '?' + paramString).length;\n\n // request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest\n if(requestLength <= 2000 && L.esri.Support.CORS){\n httpRequest.open('GET', url + '?' + paramString);\n httpRequest.send(null);\n\n // request is less more then 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest\n } else if (requestLength > 2000 && L.esri.Support.CORS){\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(paramString);\n\n // request is less more then 2000 characters and the browser does not support CORS, make a JSONP request\n } else if(requestLength <= 2000 && !L.esri.Support.CORS){\n return L.esri.Request.get.JSONP(url, params, callback, context);\n\n // request is longer then 2000 characters and the browser does not support CORS, log a warning\n } else {\n if(console && console.warn){\n console.warn('a request to ' + url + ' 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');\n return;\n }\n }\n\n return httpRequest;\n },\n post: {\n XMLHTTP: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(serialize(params));\n\n return httpRequest;\n }\n },\n\n get: {\n CORS: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n\n httpRequest.open('GET', url + '?' + serialize(params), true);\n httpRequest.send(null);\n\n return httpRequest;\n },\n JSONP: function(url, params, callback, context){\n var callbackId = 'c' + callbacks;\n\n params.callback = 'window._EsriLeafletCallbacks.' + callbackId;\n\n var script = L.DomUtil.create('script', null, document.body);\n script.type = 'text/javascript';\n script.src = url + '?' + serialize(params);\n script.id = callbackId;\n\n window._EsriLeafletCallbacks[callbackId] = function(response){\n if(window._EsriLeafletCallbacks[callbackId] !== true){\n var error;\n var responseType = Object.prototype.toString.call(response);\n\n if(!(responseType === '[object Object]' || responseType === '[object Array]')){\n error = {\n error: {\n code: 500,\n message: 'Expected array or object as JSONP response'\n }\n };\n response = null;\n }\n\n if (!error && response.error) {\n error = response;\n response = null;\n }\n\n callback.call(context, error, response);\n window._EsriLeafletCallbacks[callbackId] = true;\n }\n };\n\n callbacks++;\n\n return {\n id: callbackId,\n url: script.src,\n abort: function(){\n window._EsriLeafletCallbacks._callback[callbackId]({\n code: 0,\n message: 'Request aborted.'\n });\n }\n };\n }\n }\n };\n\n // Choose the correct AJAX handler depending on CORS support\n EsriLeaflet.get = (EsriLeaflet.Support.CORS) ? EsriLeaflet.Request.get.CORS : EsriLeaflet.Request.get.JSONP;\n\n // Always use XMLHttpRequest for posts\n EsriLeaflet.post = EsriLeaflet.Request.post.XMLHTTP;\n\n // expose a common request method the uses GET\\POST based on request length\n EsriLeaflet.request = EsriLeaflet.Request.request;\n\n})(EsriLeaflet);","EsriLeaflet.Services.Service = L.Class.extend({\n\n includes: L.Mixin.Events,\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n initialize: function (url, options) {\n this.url = EsriLeaflet.Util.cleanUrl(url);\n this._requestQueue = [];\n this._authenticating = false;\n L.Util.setOptions(this, options);\n },\n\n get: function (path, params, callback, context) {\n return this._request('get', path, params, callback, context);\n },\n\n post: function (path, params, callback, context) {\n return this._request('post', path, params, callback, context);\n },\n\n request: function (path, params, callback, context) {\n return this._request('request', path, params, callback, context);\n },\n\n metadata: function (callback, context) {\n return this._request('get', '', {}, callback, context);\n },\n\n authenticate: function(token){\n this._authenticating = false;\n this.options.token = token;\n this._runQueue();\n return this;\n },\n\n _request: function(method, path, params, callback, context){\n this.fire('requeststart', {\n url: this.url + path,\n params: params,\n method: method\n });\n\n var wrappedCallback = this._createServiceCallback(method, path, params, callback, context);\n\n if (this.options.token) {\n params.token = this.options.token;\n }\n\n if (this._authenticating) {\n this._requestQueue.push([method, path, params, callback, context]);\n return;\n } else {\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, wrappedCallback);\n } else {\n return EsriLeaflet[method](url, params, wrappedCallback);\n }\n }\n },\n\n _createServiceCallback: function(method, path, params, callback, context){\n var request = [method, path, params, callback, context];\n\n return L.Util.bind(function(error, response){\n\n if (error && (error.code === 499 || error.code === 498)) {\n this._authenticating = true;\n\n this._requestQueue.push(request);\n\n this.fire('authenticationrequired', {\n authenticate: L.Util.bind(this.authenticate, this)\n });\n } else {\n callback.call(context, error, response);\n\n if(error) {\n this.fire('requesterror', {\n url: this.url + path,\n params: params,\n message: error.message,\n code: error.code,\n method: method\n });\n } else {\n this.fire('requestsuccess', {\n url: this.url + path,\n params: params,\n response: response,\n method: method\n });\n }\n\n this.fire('requestend', {\n url: this.url + path,\n params: params,\n method: method\n });\n }\n }, this);\n },\n\n _runQueue: function(){\n for (var i = this._requestQueue.length - 1; i >= 0; i--) {\n var request = this._requestQueue[i];\n var method = request.shift();\n this[method].apply(this, request);\n }\n this._requestQueue = [];\n }\n\n});\n\nEsriLeaflet.Services.service = function(url, params){\n return new EsriLeaflet.Services.Service(url, params);\n};","EsriLeaflet.Services.ImageService = EsriLeaflet.Services.Service.extend({\n\n query: function () {\n return new EsriLeaflet.Tasks.Query(this);\n },\n\n identify: function() {\n return new EsriLeaflet.Tasks.IdentifyImage(this);\n }\n});\n\nEsriLeaflet.Services.imageService = function(url, params){\n return new EsriLeaflet.Services.ImageService(url, params);\n};","EsriLeaflet.Tasks.Task = L.Class.extend({\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n //Generate a method for each methodName:paramName in the setters for this task.\n generateSetter: function(param, context){\n var isArray = param.match(/([a-zA-Z]+)\\[\\]/);\n\n param = (isArray) ? isArray[1] : param;\n\n if(isArray){\n return L.Util.bind(function(value){\n // this.params[param] = (this.params[param]) ? this.params[param] + ',' : '';\n if (L.Util.isArray(value)) {\n this.params[param] = value.join(',');\n } else {\n this.params[param] = value;\n }\n return this;\n }, context);\n } else {\n return L.Util.bind(function(value){\n this.params[param] = value;\n return this;\n }, context);\n }\n },\n\n initialize: function(endpoint, options){\n // endpoint can be either a url to an ArcGIS Rest Service or an instance of EsriLeaflet.Service\n if(endpoint.url && endpoint.request){\n this._service = endpoint;\n this.url = endpoint.url;\n } else {\n this.url = EsriLeaflet.Util.cleanUrl(endpoint);\n }\n\n // clone default params into this object\n this.params = L.Util.extend({}, this.params || {});\n\n // generate setter methods based on the setters object implimented a child class\n if(this.setters){\n for (var setter in this.setters){\n var param = this.setters[setter];\n this[setter] = this.generateSetter(param, this);\n }\n }\n\n L.Util.setOptions(this, options);\n },\n\n token: function(token){\n if(this._service){\n this._service.authenticate(token);\n } else {\n this.params.token = token;\n }\n return this;\n },\n\n request: function(callback, context){\n if(this._service){\n return this._service.request(this.path, this.params, callback, context);\n } else {\n return this._request('request', this.path, this.params, callback, context);\n }\n },\n\n _request: function(method, path, params, callback, context){\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, callback, context);\n } else{\n return EsriLeaflet[method](url, params, callback, context);\n }\n }\n});","EsriLeaflet.Tasks.Query = EsriLeaflet.Tasks.Task.extend({\n setters: {\n 'offset': 'offset',\n 'limit': 'limit',\n 'outFields': 'fields[]',\n 'precision': 'geometryPrecision',\n 'featureIds': 'objectIds[]',\n 'returnGeometry': 'returnGeometry',\n 'token': 'token'\n },\n\n path: 'query',\n\n params: {\n returnGeometry: true,\n where: '1=1',\n outSr: 4326,\n outFields: '*'\n },\n\n within: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelContains'; // will make code read layer within geometry, to the api this will reads geometry contains layer\n return this;\n },\n\n intersects: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelIntersects';\n return this;\n },\n\n contains: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelWithin'; // will make code read layer contains geometry, to the api this will reads geometry within layer\n return this;\n },\n\n // crosses: function(geometry){\n // this._setGeometry(geometry);\n // this.params.spatialRel = 'esriSpatialRelCrosses';\n // return this;\n // },\n\n // touches: function(geometry){\n // this._setGeometry(geometry);\n // this.params.spatialRel = 'esriSpatialRelTouches';\n // return this;\n // },\n\n overlaps: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelOverlaps';\n return this;\n },\n\n // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online\n nearby: function(latlng, radius){\n latlng = L.latLng(latlng);\n this.params.geometry = ([latlng.lng,latlng.lat]).join(',');\n this.params.geometryType = 'esriGeometryPoint';\n this.params.spatialRel = 'esriSpatialRelIntersects';\n this.params.units = 'esriSRUnit_Meter';\n this.params.distance = radius;\n this.params.inSr = 4326;\n return this;\n },\n\n where: function(string){\n this.params.where = string.replace(/\"/g, \"\\'\"); // jshint ignore:line\n return this;\n },\n\n between: function(start, end){\n this.params.time = ([start.valueOf(), end.valueOf()]).join();\n return this;\n },\n\n fields: function (fields) {\n if (L.Util.isArray(fields)) {\n this.params.outFields = fields.join(',');\n } else {\n this.params.outFields = fields;\n }\n return this;\n },\n\n simplify: function(map, factor){\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\n return this;\n },\n\n orderBy: function(fieldName, order){\n order = order || 'ASC';\n this.params.orderByFields = (this.params.orderByFields) ? this.params.orderByFields + ',' : '';\n this.params.orderByFields += ([fieldName, order]).join(' ');\n return this;\n },\n\n returnGeometry: function(bool){\n this.params.returnGeometry = bool;\n return this;\n },\n\n run: function(callback, context){\n this._cleanParams();\n return this.request(function(error, response){\n callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response);\n }, context);\n },\n\n count: function(callback, context){\n this._cleanParams();\n this.params.returnCountOnly = true;\n return this.request(function(error, response){\n callback.call(this, error, (response && response.count), response);\n }, context);\n },\n\n ids: function(callback, context){\n this._cleanParams();\n this.params.returnIdsOnly = true;\n return this.request(function(error, response){\n callback.call(this, error, (response && response.objectIds), response);\n }, context);\n },\n\n // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online\n bounds: function(callback, context){\n this._cleanParams();\n this.params.returnExtentOnly = true;\n return this.request(function(error, response){\n callback.call(context, error, (response && response.extent && EsriLeaflet.Util.extentToBounds(response.extent)), response);\n }, context);\n },\n\n // only valid for image services\n pixelSize: function(point){\n point = L.point(point);\n this.params.pixelSize = ([point.x,point.y]).join(',');\n return this;\n },\n\n // only valid for map services\n layer: function(layer){\n this.path = layer + '/query';\n return this;\n },\n\n _cleanParams: function(){\n delete this.params.returnIdsOnly;\n delete this.params.returnExtentOnly;\n delete this.params.returnCountOnly;\n },\n\n _setGeometry: function(geometry) {\n this.params.inSr = 4326;\n\n // convert bounds to extent and finish\n if ( geometry instanceof L.LatLngBounds ) {\n // set geometry + geometryType\n this.params.geometry = EsriLeaflet.Util.boundsToExtent(geometry);\n this.params.geometryType = 'esriGeometryEnvelope';\n return;\n }\n\n // convert L.Marker > L.LatLng\n if(geometry.getLatLng){\n geometry = geometry.getLatLng();\n }\n\n // convert L.LatLng to a geojson point and continue;\n if (geometry instanceof L.LatLng) {\n geometry = {\n type: 'Point',\n coordinates: [geometry.lng, geometry.lat]\n };\n }\n\n // handle L.GeoJSON, pull out the first geometry\n if ( geometry instanceof L.GeoJSON ) {\n //reassign geometry to the GeoJSON value (we are assuming that only one feature is present)\n geometry = geometry.getLayers()[0].feature.geometry;\n this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry);\n this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type);\n }\n\n // Handle L.Polyline and L.Polygon\n if (geometry.toGeoJSON) {\n geometry = geometry.toGeoJSON();\n }\n\n // handle GeoJSON feature by pulling out the geometry\n if ( geometry.type === 'Feature' ) {\n // get the geometry of the geojson feature\n geometry = geometry.geometry;\n }\n\n // confirm that our GeoJSON is a point, line or polygon\n if ( geometry.type === 'Point' || geometry.type === 'LineString' || geometry.type === 'Polygon') {\n this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry);\n this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type);\n return;\n }\n\n // warn the user if we havn't found a\n /* global console */\n if(console && console.warn) {\n console.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');\n }\n\n return;\n }\n});\n\nEsriLeaflet.Tasks.query = function(url, params){\n return new EsriLeaflet.Tasks.Query(url, params);\n};","EsriLeaflet.Tasks.Identify = EsriLeaflet.Tasks.Task.extend({\n path: 'identify',\n\n between: function(start, end){\n this.params.time = ([start.valueOf(), end.valueOf()]).join(',');\n return this;\n },\n\n returnGeometry: function (returnGeometry) {\n this.params.returnGeometry = returnGeometry;\n return this;\n }\n});\n","EsriLeaflet.Layers.RasterLayer = L.Class.extend({\n includes: L.Mixin.Events,\n\n options: {\n opacity: 1,\n position: 'front',\n f: 'image'\n },\n\n onAdd: function (map) {\n this._map = map;\n\n this._update = L.Util.limitExecByInterval(this._update, this.options.updateInterval, this);\n\n if (map.options.crs && map.options.crs.code) {\n var sr = map.options.crs.code.split(':')[1];\n this.options.bboxSR = sr;\n this.options.imageSR = sr;\n }\n\n map.on('moveend', this._update, this);\n\n this._update();\n\n if(this._popup){\n this._map.on('click', this._getPopupData, this);\n this._map.on('dblclick', this._resetPopupState, this);\n }\n },\n\n bindPopup: function(fn, popupOptions){\n this._shouldRenderPopup = false;\n this._lastClick = false;\n this._popup = L.popup(popupOptions);\n this._popupFunction = fn;\n if(this._map){\n this._map.on('click', this._getPopupData, this);\n this._map.on('dblclick', this._resetPopupState, this);\n }\n return this;\n },\n\n unbindPopup: function(){\n if(this._map){\n this._map.closePopup(this._popup);\n this._map.off('click', this._getPopupData, this);\n this._map.off('dblclick', this._resetPopupState, this);\n }\n this._popup = false;\n return this;\n },\n\n onRemove: function (map) {\n\n if (this._currentImage) {\n this._map.removeLayer(this._currentImage);\n }\n\n if(this._popup){\n this._map.off('click', this._getPopupData, this);\n this._map.off('dblclick', this._resetPopupState, this);\n }\n\n this._map.off('moveend', this._update, this);\n this._map = null;\n },\n\n addTo: function(map){\n map.addLayer(this);\n return this;\n },\n\n removeFrom: function(map){\n map.removeLayer(this);\n return this;\n },\n\n bringToFront: function(){\n this.options.position = 'front';\n if(this._currentImage){\n this._currentImage.bringToFront();\n }\n return this;\n },\n\n bringToBack: function(){\n this.options.position = 'back';\n if(this._currentImage){\n this._currentImage.bringToBack();\n }\n return this;\n },\n\n getAttribution: function () {\n return this.options.attribution;\n },\n\n getOpacity: function(){\n return this.options.opacity;\n },\n\n setOpacity: function(opacity){\n this.options.opacity = opacity;\n this._currentImage.setOpacity(opacity);\n return this;\n },\n\n getTimeRange: function(){\n return [this.options.from, this.options.to];\n },\n\n setTimeRange: function(from, to){\n this.options.from = from;\n this.options.to = to;\n this._update();\n return this;\n },\n\n metadata: function(callback, context){\n this._service.metadata(callback, context);\n return this;\n },\n\n authenticate: function(token){\n this._service.authenticate(token);\n return this;\n },\n\n _renderImage: function(url, bounds){\n if(this._map){\n var image = new L.ImageOverlay(url, bounds, {\n opacity: 0\n }).addTo(this._map);\n\n image.once('load', function(e){\n var newImage = e.target;\n var oldImage = this._currentImage;\n if(newImage._bounds.equals(bounds)){\n this._currentImage = newImage;\n\n if(this.options.position === 'front'){\n this.bringToFront();\n } else {\n this.bringToBack();\n }\n\n if(this._map && this._currentImage._map){\n this._currentImage.setOpacity(this.options.opacity);\n } else {\n this._currentImage._map.removeLayer(this._currentImage);\n }\n\n if(oldImage){\n this._map.removeLayer(oldImage);\n }\n\n } else {\n this._map.removeLayer(newImage);\n }\n\n this.fire('load', {\n bounds: bounds\n });\n\n }, this);\n\n this.fire('loading', {\n bounds: bounds\n });\n }\n },\n\n _update: function () {\n if(!this._map){\n return;\n }\n\n var zoom = this._map.getZoom();\n var bounds = this._map.getBounds();\n\n if(this._animatingZoom){\n return;\n }\n\n if (this._map._panTransition && this._map._panTransition._inProgress) {\n return;\n }\n\n if (zoom > this.options.maxZoom || zoom < this.options.minZoom) {\n return;\n }\n var params = this._buildExportParams();\n\n this._requestExport(params, bounds);\n },\n\n // TODO: refactor these into raster layer\n _renderPopup: function(latlng, error, results, response){\n latlng = L.latLng(latlng);\n if(this._shouldRenderPopup && this._lastClick.equals(latlng)){\n //add the popup to the map where the mouse was clicked at\n var content = this._popupFunction(error, results, response);\n if (content) {\n this._popup.setLatLng(latlng).setContent(content).openOn(this._map);\n }\n }\n },\n\n _resetPopupState: function(e){\n this._shouldRenderPopup = false;\n this._lastClick = e.latlng;\n },\n\n // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js\n // @TODO remove at Leaflet 0.8\n _propagateEvent: function (e) {\n e = L.extend({\n layer: e.target,\n target: this\n }, e);\n this.fire(e.type, e);\n }\n});","EsriLeaflet.Layers.ImageMapLayer = EsriLeaflet.Layers.RasterLayer.extend({\n\n options: {\n updateInterval: 150,\n format: 'jpgpng'\n },\n\n query: function(){\n return this._service.query();\n },\n\n identify: function(){\n return this._service.identify();\n },\n\n initialize: function (url, options) {\n this.url = EsriLeaflet.Util.cleanUrl(url);\n this._service = new EsriLeaflet.Services.ImageService(this.url, options);\n this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', this._propagateEvent, this);\n L.Util.setOptions(this, options);\n },\n\n setPixelType: function (pixelType) {\n this.options.pixelType = pixelType;\n this._update();\n return this;\n },\n\n getPixelType: function () {\n return this.options.pixelType;\n },\n\n setBandIds: function (bandIds) {\n if (L.Util.isArray(bandIds)) {\n this.options.bandIds = bandIds.join(',');\n } else {\n this.options.bandIds = bandIds.toString();\n }\n this._update();\n return this;\n },\n\n getBandIds: function () {\n return this.options.bandIds;\n },\n\n setNoData: function (noData, noDataInterpretation) {\n if (L.Util.isArray(noData)) {\n this.options.noData = noData.join(',');\n } else {\n this.options.noData = noData.toString();\n }\n if (noDataInterpretation) {\n this.options.noDataInterpretation = noDataInterpretation;\n }\n this._update();\n return this;\n },\n\n getNoData: function () {\n return this.options.noData;\n },\n\n getNoDataInterpretation: function () {\n return this.options.noDataInterpretation;\n },\n\n setRenderingRule: function(renderingRule) {\n this.options.renderingRule = renderingRule;\n this._update();\n },\n\n getRenderingRule: function() {\n return this.options.renderingRule;\n },\n\n setMosaicRule: function(mosaicRule) {\n this.options.mosaicRule = mosaicRule;\n this._update();\n },\n\n getMosaicRule: function() {\n return this.options.mosaicRule;\n },\n\n _getPopupData: function(e){\n var callback = L.Util.bind(function(error, results, response) {\n setTimeout(L.Util.bind(function(){\n this._renderPopup(e.latlng, error, results, response);\n }, this), 300);\n }, this);\n\n var identifyRequest = this.identify().at(e.latlng);\n\n // set mosaic rule for identify task if it is set for layer\n if (this.options.mosaicRule) {\n identifyRequest.setMosaicRule(this.options.mosaicRule);\n // @TODO: force return catalog items too?\n }\n\n // @TODO: set rendering rule? Not sure,\n // sometimes you want raw pixel values\n // if (this.options.renderingRule) {\n // identifyRequest.setRenderingRule(this.options.renderingRule);\n // }\n\n identifyRequest.run(callback);\n\n // set the flags to show the popup\n this._shouldRenderPopup = true;\n this._lastClick = e.latlng;\n },\n\n _buildExportParams: function () {\n var bounds = this._map.getBounds();\n var size = this._map.getSize();\n var ne = this._map.options.crs.project(bounds._northEast);\n var sw = this._map.options.crs.project(bounds._southWest);\n\n var params = {\n bbox: [sw.x, sw.y, ne.x, ne.y].join(','),\n size: size.x + ',' + size.y,\n format: this.options.format,\n bboxSR: this.options.bboxSR,\n imageSR: this.options.imageSR\n };\n\n if (this.options.from && this.options.to) {\n params.time = this.options.from.valueOf() + ',' + this.options.to.valueOf();\n }\n\n if (this.options.pixelType) {\n params.pixelType = this.options.pixelType;\n }\n\n if (this.options.interpolation) {\n params.interpolation = this.options.interpolation;\n }\n\n if (this.options.compressionQuality) {\n params.compressionQuality = this.options.compressionQuality;\n }\n\n if (this.options.bandIds) {\n params.bandIds = this.options.bandIds;\n }\n\n if (this.options.noData) {\n params.noData = this.options.noData;\n }\n\n if (this.options.noDataInterpretation) {\n params.noDataInterpretation = this.options.noDataInterpretation;\n }\n\n if (this._service.options.token) {\n params.token = this._service.options.token;\n }\n\n if(this.options.renderingRule) {\n params.renderingRule = JSON.stringify(this.options.renderingRule);\n }\n\n if(this.options.mosaicRule) {\n params.mosaicRule = JSON.stringify(this.options.mosaicRule);\n }\n\n return params;\n },\n\n _requestExport: function (params, bounds) {\n if (this.options.f === 'json') {\n this._service.get('exportImage', params, function(error, response){\n this._renderImage(response.href, bounds);\n }, this);\n } else {\n params.f = 'image';\n this._renderImage(this.url + 'exportImage' + L.Util.getParamString(params), bounds);\n }\n }\n});\n\nEsriLeaflet.ImageMapLayer = EsriLeaflet.Layers.ImageMapLayer;\n\nEsriLeaflet.Layers.imageMapLayer = function (url, options) {\n return new EsriLeaflet.Layers.ImageMapLayer(url, options);\n};\n\nEsriLeaflet.imageMapLayer = function (url, options) {\n return new EsriLeaflet.Layers.ImageMapLayer(url, options);\n};"]} \ No newline at end of file diff --git a/dist/builds/image-service/esri-leaflet-image-service.js b/dist/builds/image-service/esri-leaflet-image-service.js new file mode 100644 index 000000000..23a89c748 --- /dev/null +++ b/dist/builds/image-service/esri-leaflet-image-service.js @@ -0,0 +1,24 @@ +/*! esri-leaflet - v1.0.0-rc.3 - 2014-11-04 +* Copyright (c) 2014 Environmental Systems Research Institute, Inc. +* Apache License*/ +(function (factory) { + //define an AMD module that relies on 'leaflet' + if (typeof define === 'function' && define.amd) { + define(['leaflet'], function (L) { + return factory(L); + }); + //define a common js module that relies on 'leaflet' + } else if (typeof module === 'object' && typeof module.exports === 'object') { + module.exports = factory(require('leaflet')); + } + + if(typeof window !== 'undefined' && window.L){ + factory(window.L); + } +}(function (L) { + +var EsriLeaflet={VERSION:"1.0.0-rc.2",Layers:{},Services:{},Controls:{},Tasks:{},Util:{},Support:{CORS:!!(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),pointerEvents:""===document.documentElement.style.pointerEvents}};"undefined"!=typeof window&&window.L&&(window.L.esri=EsriLeaflet),function(a){function b(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function c(a,b){for(var c=0;cd;d++)b=a[d+1],c+=(b[0]-f[0])*(b[1]+f[1]),f=b;return c>=0}function f(a,b,c,d){var e=(d[0]-c[0])*(a[1]-c[1])-(d[1]-c[1])*(a[0]-c[0]),f=(b[0]-a[0])*(a[1]-c[1])-(b[1]-a[1])*(a[0]-c[0]),g=(d[1]-c[1])*(b[0]-a[0])-(d[0]-c[0])*(b[1]-a[1]);if(0!==g){var h=e/g,i=f/g;if(h>=0&&1>=h&&i>=0&&1>=i)return!0}return!1}function g(a,b){for(var c=0;c=0;b--)if(c=h[b][0],i(c,f)){h[b].push(f),o=!0;break}o||n.push(f)}for(;n.length;){f=n.pop();var p=!1;for(b=h.length-1;b>=0;b--)if(c=h[b][0],g(c,f)){h[b].push(f),p=!0;break}p||h.push([f.reverse()])}return 1===h.length?{type:"Polygon",coordinates:h[0]}:{type:"MultiPolygon",coordinates:h}}function k(a){var b=[],c=a.slice(0),f=d(c.shift().slice(0));if(f.length>=4){e(f)||f.reverse(),b.push(f);for(var g=0;g=4&&(e(h)&&h.reverse(),b.push(h))}}return b}function l(a){for(var b=[],c=0;c=0;e--){var f=d[e].slice(0);b.push(f)}return b}a.Util.extentToBounds=function(a){var b=new L.LatLng(a.ymin,a.xmin),c=new L.LatLng(a.ymax,a.xmax);return new L.LatLngBounds(b,c)},a.Util.boundsToExtent=function(a){return a=L.latLngBounds(a),{xmin:a.getSouthWest().lng,ymin:a.getSouthWest().lat,xmax:a.getNorthEast().lng,ymax:a.getNorthEast().lat,spatialReference:{wkid:4326}}},a.Util.arcgisToGeojson=function(c,d){var e={};return"number"==typeof c.x&&"number"==typeof c.y&&(e.type="Point",e.coordinates=[c.x,c.y]),c.points&&(e.type="MultiPoint",e.coordinates=c.points.slice(0)),c.paths&&(1===c.paths.length?(e.type="LineString",e.coordinates=c.paths[0].slice(0)):(e.type="MultiLineString",e.coordinates=c.paths.slice(0))),c.rings&&(e=j(c.rings.slice(0))),(c.geometry||c.attributes)&&(e.type="Feature",e.geometry=c.geometry?a.Util.arcgisToGeojson(c.geometry):null,e.properties=c.attributes?b(c.attributes):null,c.attributes&&(e.id=c.attributes[d]||c.attributes.OBJECTID||c.attributes.FID)),e},a.Util.geojsonToArcGIS=function(c,d){d=d||"OBJECTID";var e,f={wkid:4326},g={};switch(c.type){case"Point":g.x=c.coordinates[0],g.y=c.coordinates[1],g.spatialReference=f;break;case"MultiPoint":g.points=c.coordinates.slice(0),g.spatialReference=f;break;case"LineString":g.paths=[c.coordinates.slice(0)],g.spatialReference=f;break;case"MultiLineString":g.paths=c.coordinates.slice(0),g.spatialReference=f;break;case"Polygon":g.rings=k(c.coordinates.slice(0)),g.spatialReference=f;break;case"MultiPolygon":g.rings=l(c.coordinates.slice(0)),g.spatialReference=f;break;case"Feature":c.geometry&&(g.geometry=a.Util.geojsonToArcGIS(c.geometry,d)),g.attributes=c.properties?b(c.properties):{},c.id&&(g.attributes[d]=c.id);break;case"FeatureCollection":for(g=[],e=0;e=0;h--)f.features.push(a.Util.arcgisToGeojson(g[h],d));return f},a.Util.cleanUrl=function(a){return a=a.replace(/\s\s*/g,""),"/"!==a[a.length-1]&&(a+="/"),a},a.Util.geojsonTypeToArcGIS=function(a){var b;switch(a){case"Point":b="esriGeometryPoint";break;case"MultiPoint":b="esriGeometryMultipoint";break;case"LineString":b="esriGeometryPolyline";break;case"MultiLineString":b="esriGeometryPolyline";break;case"Polygon":b="esriGeometryPolygon";break;case"MultiPolygon":b="esriGeometryPolygon"}return b}}(EsriLeaflet),function(a){function b(a){var b="";a.f="json";for(var c in a)if(a.hasOwnProperty(c)){var d,e=a[c],f=Object.prototype.toString.call(e);b.length&&(b+="&"),d="[object Array]"===f||"[object Object]"===f?JSON.stringify(e):"[object Date]"===f?e.valueOf():e,b+=encodeURIComponent(c)+"="+encodeURIComponent(d)}return b}function c(a,b){var c=new XMLHttpRequest;return c.onerror=function(){a.call(b,{error:{code:500,message:"XMLHttpRequest error"}},null)},c.onreadystatechange=function(){var d,e;if(4===c.readyState){try{d=JSON.parse(c.responseText)}catch(f){d=null,e={code:500,message:"Could not parse response as JSON."}}!e&&d.error&&(e=d.error,d=null),a.call(b,e,d)}},c}var d=0;window._EsriLeafletCallbacks={},a.Request={request:function(a,d,e,f){var g=b(d),h=c(e,f),i=(a+"?"+g).length;if(2e3>=i&&L.esri.Support.CORS)h.open("GET",a+"?"+g),h.send(null);else if(i>2e3&&L.esri.Support.CORS)h.open("POST",a),h.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),h.send(g);else{if(2e3>=i&&!L.esri.Support.CORS)return L.esri.Request.get.JSONP(a,d,e,f);if(console&&console.warn)return void console.warn("a request to "+a+" 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")}return h},post:{XMLHTTP:function(a,d,e,f){var g=c(e,f);return g.open("POST",a),g.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),g.send(b(d)),g}},get:{CORS:function(a,d,e,f){var g=c(e,f);return g.open("GET",a+"?"+b(d),!0),g.send(null),g},JSONP:function(a,c,e,f){var g="c"+d;c.callback="window._EsriLeafletCallbacks."+g;var h=L.DomUtil.create("script",null,document.body);return h.type="text/javascript",h.src=a+"?"+b(c),h.id=g,window._EsriLeafletCallbacks[g]=function(a){if(window._EsriLeafletCallbacks[g]!==!0){var b,c=Object.prototype.toString.call(a);"[object Object]"!==c&&"[object Array]"!==c&&(b={error:{code:500,message:"Expected array or object as JSONP response"}},a=null),!b&&a.error&&(b=a,a=null),e.call(f,b,a),window._EsriLeafletCallbacks[g]=!0}},d++,{id:g,url:h.src,abort:function(){window._EsriLeafletCallbacks._callback[g]({code:0,message:"Request aborted."})}}}}},a.get=a.Support.CORS?a.Request.get.CORS:a.Request.get.JSONP,a.post=a.Request.post.XMLHTTP,a.request=a.Request.request}(EsriLeaflet),EsriLeaflet.Services.Service=L.Class.extend({includes:L.Mixin.Events,options:{proxy:!1,useCors:EsriLeaflet.Support.CORS},initialize:function(a,b){this.url=EsriLeaflet.Util.cleanUrl(a),this._requestQueue=[],this._authenticating=!1,L.Util.setOptions(this,b)},get:function(a,b,c,d){return this._request("get",a,b,c,d)},post:function(a,b,c,d){return this._request("post",a,b,c,d)},request:function(a,b,c,d){return this._request("request",a,b,c,d)},metadata:function(a,b){return this._request("get","",{},a,b)},authenticate:function(a){return this._authenticating=!1,this.options.token=a,this._runQueue(),this},_request:function(a,b,c,d,e){this.fire("requeststart",{url:this.url+b,params:c,method:a});var f=this._createServiceCallback(a,b,c,d,e);if(this.options.token&&(c.token=this.options.token),this._authenticating)return void this._requestQueue.push([a,b,c,d,e]);var g=this.options.proxy?this.options.proxy+"?"+this.url+b:this.url+b;return"get"!==a&&"request"!==a||this.options.useCors?EsriLeaflet[a](g,c,f):EsriLeaflet.Request.get.JSONP(g,c,f)},_createServiceCallback:function(a,b,c,d,e){var f=[a,b,c,d,e];return L.Util.bind(function(g,h){!g||499!==g.code&&498!==g.code?(d.call(e,g,h),g?this.fire("requesterror",{url:this.url+b,params:c,message:g.message,code:g.code,method:a}):this.fire("requestsuccess",{url:this.url+b,params:c,response:h,method:a}),this.fire("requestend",{url:this.url+b,params:c,method:a})):(this._authenticating=!0,this._requestQueue.push(f),this.fire("authenticationrequired",{authenticate:L.Util.bind(this.authenticate,this)}))},this)},_runQueue:function(){for(var a=this._requestQueue.length-1;a>=0;a--){var b=this._requestQueue[a],c=b.shift();this[c].apply(this,b)}this._requestQueue=[]}}),EsriLeaflet.Services.service=function(a,b){return new EsriLeaflet.Services.Service(a,b)},EsriLeaflet.Services.ImageService=EsriLeaflet.Services.Service.extend({query:function(){return new EsriLeaflet.Tasks.Query(this)},identify:function(){return new EsriLeaflet.Tasks.IdentifyImage(this)}}),EsriLeaflet.Services.imageService=function(a,b){return new EsriLeaflet.Services.ImageService(a,b)},EsriLeaflet.Tasks.Task=L.Class.extend({options:{proxy:!1,useCors:EsriLeaflet.Support.CORS},generateSetter:function(a,b){var c=a.match(/([a-zA-Z]+)\[\]/);return a=c?c[1]:a,c?L.Util.bind(function(b){return this.params[a]=L.Util.isArray(b)?b.join(","):b,this},b):L.Util.bind(function(b){return this.params[a]=b,this},b)},initialize:function(a,b){if(a.url&&a.request?(this._service=a,this.url=a.url):this.url=EsriLeaflet.Util.cleanUrl(a),this.params=L.Util.extend({},this.params||{}),this.setters)for(var c in this.setters){var d=this.setters[c];this[c]=this.generateSetter(d,this)}L.Util.setOptions(this,b)},token:function(a){return this._service?this._service.authenticate(a):this.params.token=a,this},request:function(a,b){return this._service?this._service.request(this.path,this.params,a,b):this._request("request",this.path,this.params,a,b)},_request:function(a,b,c,d,e){var f=this.options.proxy?this.options.proxy+"?"+this.url+b:this.url+b;return"get"!==a&&"request"!==a||this.options.useCors?EsriLeaflet[a](f,c,d,e):EsriLeaflet.Request.get.JSONP(f,c,d,e)}}),EsriLeaflet.Tasks.Query=EsriLeaflet.Tasks.Task.extend({setters:{offset:"offset",limit:"limit",outFields:"fields[]",precision:"geometryPrecision",featureIds:"objectIds[]",returnGeometry:"returnGeometry",token:"token"},path:"query",params:{returnGeometry:!0,where:"1=1",outSr:4326,outFields:"*"},within:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelContains",this},intersects:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelIntersects",this},contains:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelWithin",this},overlaps:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelOverlaps",this},nearby:function(a,b){return a=L.latLng(a),this.params.geometry=[a.lng,a.lat].join(","),this.params.geometryType="esriGeometryPoint",this.params.spatialRel="esriSpatialRelIntersects",this.params.units="esriSRUnit_Meter",this.params.distance=b,this.params.inSr=4326,this},where:function(a){return this.params.where=a.replace(/"/g,"'"),this},between:function(a,b){return this.params.time=[a.valueOf(),b.valueOf()].join(),this},fields:function(a){return this.params.outFields=L.Util.isArray(a)?a.join(","):a,this},simplify:function(a,b){var c=Math.abs(a.getBounds().getWest()-a.getBounds().getEast());return this.params.maxAllowableOffset=c/a.getSize().y*b,this},orderBy:function(a,b){return b=b||"ASC",this.params.orderByFields=this.params.orderByFields?this.params.orderByFields+",":"",this.params.orderByFields+=[a,b].join(" "),this},returnGeometry:function(a){return this.params.returnGeometry=a,this},run:function(a,b){return this._cleanParams(),this.request(function(c,d){a.call(b,c,d&&EsriLeaflet.Util.responseToFeatureCollection(d),d)},b)},count:function(a,b){return this._cleanParams(),this.params.returnCountOnly=!0,this.request(function(b,c){a.call(this,b,c&&c.count,c)},b)},ids:function(a,b){return this._cleanParams(),this.params.returnIdsOnly=!0,this.request(function(b,c){a.call(this,b,c&&c.objectIds,c)},b)},bounds:function(a,b){return this._cleanParams(),this.params.returnExtentOnly=!0,this.request(function(c,d){a.call(b,c,d&&d.extent&&EsriLeaflet.Util.extentToBounds(d.extent),d)},b)},pixelSize:function(a){return a=L.point(a),this.params.pixelSize=[a.x,a.y].join(","),this},layer:function(a){return this.path=a+"/query",this},_cleanParams:function(){delete this.params.returnIdsOnly,delete this.params.returnExtentOnly,delete this.params.returnCountOnly},_setGeometry:function(a){return this.params.inSr=4326,a instanceof L.LatLngBounds?(this.params.geometry=EsriLeaflet.Util.boundsToExtent(a),void(this.params.geometryType="esriGeometryEnvelope")):(a.getLatLng&&(a=a.getLatLng()),a instanceof L.LatLng&&(a={type:"Point",coordinates:[a.lng,a.lat]}),a instanceof L.GeoJSON&&(a=a.getLayers()[0].feature.geometry,this.params.geometry=EsriLeaflet.Util.geojsonToArcGIS(a),this.params.geometryType=EsriLeaflet.Util.geojsonTypeToArcGIS(a.type)),a.toGeoJSON&&(a=a.toGeoJSON()),"Feature"===a.type&&(a=a.geometry),"Point"===a.type||"LineString"===a.type||"Polygon"===a.type?(this.params.geometry=EsriLeaflet.Util.geojsonToArcGIS(a),void(this.params.geometryType=EsriLeaflet.Util.geojsonTypeToArcGIS(a.type))):void(console&&console.warn&&console.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")))}}),EsriLeaflet.Tasks.query=function(a,b){return new EsriLeaflet.Tasks.Query(a,b)},EsriLeaflet.Tasks.Identify=EsriLeaflet.Tasks.Task.extend({path:"identify",between:function(a,b){return this.params.time=[a.valueOf(),b.valueOf()].join(","),this},returnGeometry:function(a){return this.params.returnGeometry=a,this}}),EsriLeaflet.Layers.RasterLayer=L.Class.extend({includes:L.Mixin.Events,options:{opacity:1,position:"front",f:"image"},onAdd:function(a){if(this._map=a,this._update=L.Util.limitExecByInterval(this._update,this.options.updateInterval,this),a.options.crs&&a.options.crs.code){var b=a.options.crs.code.split(":")[1];this.options.bboxSR=b,this.options.imageSR=b}a.on("moveend",this._update,this),this._update(),this._popup&&(this._map.on("click",this._getPopupData,this),this._map.on("dblclick",this._resetPopupState,this))},bindPopup:function(a,b){return this._shouldRenderPopup=!1,this._lastClick=!1,this._popup=L.popup(b),this._popupFunction=a,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},onRemove:function(){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),this._map=null},addTo:function(a){return a.addLayer(this),this},removeFrom:function(a){return a.removeLayer(this),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(a){return this.options.opacity=a,this._currentImage.setOpacity(a),this},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(a,b){return this.options.from=a,this.options.to=b,this._update(),this},metadata:function(a,b){return this._service.metadata(a,b),this},authenticate:function(a){return this._service.authenticate(a),this},_renderImage:function(a,b){if(this._map){var c=new L.ImageOverlay(a,b,{opacity:0}).addTo(this._map);c.once("load",function(a){var c=a.target,d=this._currentImage;c._bounds.equals(b)?(this._currentImage=c,"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),d&&this._map.removeLayer(d)):this._map.removeLayer(c),this.fire("load",{bounds:b})},this),this.fire("loading",{bounds:b})}},_update:function(){if(this._map){var a=this._map.getZoom(),b=this._map.getBounds();if(!this._animatingZoom&&!(this._map._panTransition&&this._map._panTransition._inProgress||a>this.options.maxZoom||a= 0);\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L504-L519\n function vertexIntersectsVertex(a1, a2, b1, b2) {\n var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]);\n var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]);\n var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]);\n\n if ( uB !== 0 ) {\n var ua = uaT / uB;\n var ub = ubT / uB;\n\n if ( 0 <= ua && ua <= 1 && 0 <= ub && ub <= 1 ) {\n return true;\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L521-L531\n function arrayIntersectsArray(a, b) {\n for (var i = 0; i < a.length - 1; i++) {\n for (var j = 0; j < b.length - 1; j++) {\n if (vertexIntersectsVertex(a[i], a[i + 1], b[j], b[j + 1])) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L470-L480\n function coordinatesContainPoint(coordinates, point) {\n var contains = false;\n for(var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) {\n if (((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1]) ||\n (coordinates[j][1] <= point[1] && point[1] < coordinates[i][1])) &&\n (point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0])) {\n contains = !contains;\n }\n }\n return contains;\n }\n\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L106-L113\n function coordinatesContainCoordinates(outer, inner){\n var intersects = arrayIntersectsArray(outer, inner);\n var contains = coordinatesContainPoint(outer, inner[0]);\n if(!intersects && contains){\n return true;\n }\n return false;\n }\n\n // do any polygons in this array contain any other polygons in this array?\n // used for checking for holes in arcgis rings\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L117-L172\n function convertRingsToGeoJSON(rings){\n var outerRings = [];\n var holes = [];\n var x; // iterator\n var outerRing; // current outer ring being evaluated\n var hole; // current hole being evaluated\n\n // for each ring\n for (var r = 0; r < rings.length; r++) {\n var ring = closeRing(rings[r].slice(0));\n if(ring.length < 4){\n continue;\n }\n // is this ring an outer ring? is it clockwise?\n if(ringIsClockwise(ring)){\n var polygon = [ ring ];\n outerRings.push(polygon); // push to outer rings\n } else {\n holes.push(ring); // counterclockwise push to holes\n }\n }\n\n var uncontainedHoles = [];\n\n // while there are holes left...\n while(holes.length){\n // pop a hole off out stack\n hole = holes.pop();\n\n // loop over all outer rings and see if they contain our hole.\n var contained = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(coordinatesContainCoordinates(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n contained = true;\n break;\n }\n }\n\n // ring is not contained in any outer ring\n // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320\n if(!contained){\n uncontainedHoles.push(hole);\n }\n }\n\n // if we couldn't match any holes using contains we can try intersects...\n while(uncontainedHoles.length){\n // pop a hole off out stack\n hole = uncontainedHoles.pop();\n\n // loop over all outer rings and see if any intersect our hole.\n var intersects = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(arrayIntersectsArray(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n intersects = true;\n break;\n }\n }\n\n if(!intersects) {\n outerRings.push([hole.reverse()]);\n }\n }\n\n if(outerRings.length === 1){\n return {\n type: 'Polygon',\n coordinates: outerRings[0]\n };\n } else {\n return {\n type: 'MultiPolygon',\n coordinates: outerRings\n };\n }\n }\n\n // This function ensures that rings are oriented in the right directions\n // outer rings are clockwise, holes are counterclockwise\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function orientRings(poly){\n var output = [];\n var polygon = poly.slice(0);\n var outerRing = closeRing(polygon.shift().slice(0));\n if(outerRing.length >= 4){\n if(!ringIsClockwise(outerRing)){\n outerRing.reverse();\n }\n\n output.push(outerRing);\n\n for (var i = 0; i < polygon.length; i++) {\n var hole = closeRing(polygon[i].slice(0));\n if(hole.length >= 4){\n if(ringIsClockwise(hole)){\n hole.reverse();\n }\n output.push(hole);\n }\n }\n }\n\n return output;\n }\n\n // This function flattens holes in multipolygons to one array of polygons\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function flattenMultiPolygonRings(rings){\n var output = [];\n for (var i = 0; i < rings.length; i++) {\n var polygon = orientRings(rings[i]);\n for (var x = polygon.length - 1; x >= 0; x--) {\n var ring = polygon[x].slice(0);\n output.push(ring);\n }\n }\n return output;\n }\n\n // convert an extent (ArcGIS) to LatLngBounds (Leaflet)\n EsriLeaflet.Util.extentToBounds = function(extent){\n var sw = new L.LatLng(extent.ymin, extent.xmin);\n var ne = new L.LatLng(extent.ymax, extent.xmax);\n return new L.LatLngBounds(sw, ne);\n };\n\n // convert an LatLngBounds (Leaflet) to extent (ArcGIS)\n EsriLeaflet.Util.boundsToExtent = function(bounds) {\n bounds = L.latLngBounds(bounds);\n return {\n 'xmin': bounds.getSouthWest().lng,\n 'ymin': bounds.getSouthWest().lat,\n 'xmax': bounds.getNorthEast().lng,\n 'ymax': bounds.getNorthEast().lat,\n 'spatialReference': {\n 'wkid' : 4326\n }\n };\n };\n\n EsriLeaflet.Util.arcgisToGeojson = function (arcgis, idAttribute){\n var geojson = {};\n\n if(typeof arcgis.x === 'number' && typeof arcgis.y === 'number'){\n geojson.type = 'Point';\n geojson.coordinates = [arcgis.x, arcgis.y];\n }\n\n if(arcgis.points){\n geojson.type = 'MultiPoint';\n geojson.coordinates = arcgis.points.slice(0);\n }\n\n if(arcgis.paths) {\n if(arcgis.paths.length === 1){\n geojson.type = 'LineString';\n geojson.coordinates = arcgis.paths[0].slice(0);\n } else {\n geojson.type = 'MultiLineString';\n geojson.coordinates = arcgis.paths.slice(0);\n }\n }\n\n if(arcgis.rings) {\n geojson = convertRingsToGeoJSON(arcgis.rings.slice(0));\n }\n\n if(arcgis.geometry || arcgis.attributes) {\n geojson.type = 'Feature';\n geojson.geometry = (arcgis.geometry) ? EsriLeaflet.Util.arcgisToGeojson(arcgis.geometry) : null;\n geojson.properties = (arcgis.attributes) ? clone(arcgis.attributes) : null;\n if(arcgis.attributes) {\n geojson.id = arcgis.attributes[idAttribute] || arcgis.attributes.OBJECTID || arcgis.attributes.FID;\n }\n }\n\n return geojson;\n };\n\n // GeoJSON -> ArcGIS\n EsriLeaflet.Util.geojsonToArcGIS = function(geojson, idAttribute){\n idAttribute = idAttribute || 'OBJECTID';\n var spatialReference = { wkid: 4326 };\n var result = {};\n var i;\n\n switch(geojson.type){\n case 'Point':\n result.x = geojson.coordinates[0];\n result.y = geojson.coordinates[1];\n result.spatialReference = spatialReference;\n break;\n case 'MultiPoint':\n result.points = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'LineString':\n result.paths = [geojson.coordinates.slice(0)];\n result.spatialReference = spatialReference;\n break;\n case 'MultiLineString':\n result.paths = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'Polygon':\n result.rings = orientRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'MultiPolygon':\n result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'Feature':\n if(geojson.geometry) {\n result.geometry = EsriLeaflet.Util.geojsonToArcGIS(geojson.geometry, idAttribute);\n }\n result.attributes = (geojson.properties) ? clone(geojson.properties) : {};\n if(geojson.id){\n result.attributes[idAttribute] = geojson.id;\n }\n break;\n case 'FeatureCollection':\n result = [];\n for (i = 0; i < geojson.features.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.features[i], idAttribute));\n }\n break;\n case 'GeometryCollection':\n result = [];\n for (i = 0; i < geojson.geometries.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.geometries[i], idAttribute));\n }\n break;\n }\n\n return result;\n };\n\n EsriLeaflet.Util.responseToFeatureCollection = function(response, idAttribute){\n var objectIdField;\n\n if(idAttribute){\n objectIdField = idAttribute;\n } else if(response.objectIdFieldName){\n objectIdField = response.objectIdFieldName;\n } else if(response.fields) {\n for (var j = 0; j <= response.fields.length - 1; j++) {\n if(response.fields[j].type === 'esriFieldTypeOID') {\n objectIdField = response.fields[j].name;\n break;\n }\n }\n } else {\n objectIdField = 'OBJECTID';\n }\n\n var featureCollection = {\n type: 'FeatureCollection',\n features: []\n };\n var features = response.features || response.results;\n if(features.length){\n for (var i = features.length - 1; i >= 0; i--) {\n featureCollection.features.push(EsriLeaflet.Util.arcgisToGeojson(features[i], objectIdField));\n }\n }\n\n return featureCollection;\n };\n\n // trim whitespace and add a tailing slash is needed to a url\n EsriLeaflet.Util.cleanUrl = function(url){\n url = url.replace(/\\s\\s*/g, '');\n\n //add a trailing slash to the url if the user omitted it\n if(url[url.length-1] !== '/'){\n url += '/';\n }\n\n return url;\n };\n\n EsriLeaflet.Util.geojsonTypeToArcGIS = function (geoJsonType) {\n var arcgisGeometryType;\n switch (geoJsonType) {\n case 'Point':\n arcgisGeometryType = 'esriGeometryPoint';\n break;\n case 'MultiPoint':\n arcgisGeometryType = 'esriGeometryMultipoint';\n break;\n case 'LineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'MultiLineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'Polygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n case 'MultiPolygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n }\n return arcgisGeometryType;\n };\n\n})(EsriLeaflet);","(function(EsriLeaflet){\n\n var callbacks = 0;\n\n window._EsriLeafletCallbacks = {};\n\n function serialize(params){\n var data = '';\n\n params.f = 'json';\n\n for (var key in params){\n if(params.hasOwnProperty(key)){\n var param = params[key];\n var type = Object.prototype.toString.call(param);\n var value;\n\n if(data.length){\n data += '&';\n }\n\n if(type === '[object Array]' || type === '[object Object]'){\n value = JSON.stringify(param);\n } else if (type === '[object Date]'){\n value = param.valueOf();\n } else {\n value = param;\n }\n\n data += encodeURIComponent(key) + '=' + encodeURIComponent(value);\n }\n }\n\n return data;\n }\n\n function createRequest(callback, context){\n var httpRequest = new XMLHttpRequest();\n\n httpRequest.onerror = function(e) {\n callback.call(context, {\n error: {\n code: 500,\n message: 'XMLHttpRequest error'\n }\n }, null);\n };\n\n httpRequest.onreadystatechange = function(){\n var response;\n var error;\n\n if (httpRequest.readyState === 4) {\n try {\n response = JSON.parse(httpRequest.responseText);\n } catch(e) {\n response = null;\n error = {\n code: 500,\n message: 'Could not parse response as JSON.'\n };\n }\n\n if (!error && response.error) {\n error = response.error;\n response = null;\n }\n\n callback.call(context, error, response);\n }\n };\n\n return httpRequest;\n }\n\n // AJAX handlers for CORS (modern browsers) or JSONP (older browsers)\n EsriLeaflet.Request = {\n request: function(url, params, callback, context){\n var paramString = serialize(params);\n var httpRequest = createRequest(callback, context);\n var requestLength = (url + '?' + paramString).length;\n\n // request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest\n if(requestLength <= 2000 && L.esri.Support.CORS){\n httpRequest.open('GET', url + '?' + paramString);\n httpRequest.send(null);\n\n // request is less more then 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest\n } else if (requestLength > 2000 && L.esri.Support.CORS){\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(paramString);\n\n // request is less more then 2000 characters and the browser does not support CORS, make a JSONP request\n } else if(requestLength <= 2000 && !L.esri.Support.CORS){\n return L.esri.Request.get.JSONP(url, params, callback, context);\n\n // request is longer then 2000 characters and the browser does not support CORS, log a warning\n } else {\n if(console && console.warn){\n console.warn('a request to ' + url + ' 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');\n return;\n }\n }\n\n return httpRequest;\n },\n post: {\n XMLHTTP: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(serialize(params));\n\n return httpRequest;\n }\n },\n\n get: {\n CORS: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n\n httpRequest.open('GET', url + '?' + serialize(params), true);\n httpRequest.send(null);\n\n return httpRequest;\n },\n JSONP: function(url, params, callback, context){\n var callbackId = 'c' + callbacks;\n\n params.callback = 'window._EsriLeafletCallbacks.' + callbackId;\n\n var script = L.DomUtil.create('script', null, document.body);\n script.type = 'text/javascript';\n script.src = url + '?' + serialize(params);\n script.id = callbackId;\n\n window._EsriLeafletCallbacks[callbackId] = function(response){\n if(window._EsriLeafletCallbacks[callbackId] !== true){\n var error;\n var responseType = Object.prototype.toString.call(response);\n\n if(!(responseType === '[object Object]' || responseType === '[object Array]')){\n error = {\n error: {\n code: 500,\n message: 'Expected array or object as JSONP response'\n }\n };\n response = null;\n }\n\n if (!error && response.error) {\n error = response;\n response = null;\n }\n\n callback.call(context, error, response);\n window._EsriLeafletCallbacks[callbackId] = true;\n }\n };\n\n callbacks++;\n\n return {\n id: callbackId,\n url: script.src,\n abort: function(){\n window._EsriLeafletCallbacks._callback[callbackId]({\n code: 0,\n message: 'Request aborted.'\n });\n }\n };\n }\n }\n };\n\n // Choose the correct AJAX handler depending on CORS support\n EsriLeaflet.get = (EsriLeaflet.Support.CORS) ? EsriLeaflet.Request.get.CORS : EsriLeaflet.Request.get.JSONP;\n\n // Always use XMLHttpRequest for posts\n EsriLeaflet.post = EsriLeaflet.Request.post.XMLHTTP;\n\n // expose a common request method the uses GET\\POST based on request length\n EsriLeaflet.request = EsriLeaflet.Request.request;\n\n})(EsriLeaflet);","EsriLeaflet.Services.Service = L.Class.extend({\n\n includes: L.Mixin.Events,\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n initialize: function (url, options) {\n this.url = EsriLeaflet.Util.cleanUrl(url);\n this._requestQueue = [];\n this._authenticating = false;\n L.Util.setOptions(this, options);\n },\n\n get: function (path, params, callback, context) {\n return this._request('get', path, params, callback, context);\n },\n\n post: function (path, params, callback, context) {\n return this._request('post', path, params, callback, context);\n },\n\n request: function (path, params, callback, context) {\n return this._request('request', path, params, callback, context);\n },\n\n metadata: function (callback, context) {\n return this._request('get', '', {}, callback, context);\n },\n\n authenticate: function(token){\n this._authenticating = false;\n this.options.token = token;\n this._runQueue();\n return this;\n },\n\n _request: function(method, path, params, callback, context){\n this.fire('requeststart', {\n url: this.url + path,\n params: params,\n method: method\n });\n\n var wrappedCallback = this._createServiceCallback(method, path, params, callback, context);\n\n if (this.options.token) {\n params.token = this.options.token;\n }\n\n if (this._authenticating) {\n this._requestQueue.push([method, path, params, callback, context]);\n return;\n } else {\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, wrappedCallback);\n } else {\n return EsriLeaflet[method](url, params, wrappedCallback);\n }\n }\n },\n\n _createServiceCallback: function(method, path, params, callback, context){\n var request = [method, path, params, callback, context];\n\n return L.Util.bind(function(error, response){\n\n if (error && (error.code === 499 || error.code === 498)) {\n this._authenticating = true;\n\n this._requestQueue.push(request);\n\n this.fire('authenticationrequired', {\n authenticate: L.Util.bind(this.authenticate, this)\n });\n } else {\n callback.call(context, error, response);\n\n if(error) {\n this.fire('requesterror', {\n url: this.url + path,\n params: params,\n message: error.message,\n code: error.code,\n method: method\n });\n } else {\n this.fire('requestsuccess', {\n url: this.url + path,\n params: params,\n response: response,\n method: method\n });\n }\n\n this.fire('requestend', {\n url: this.url + path,\n params: params,\n method: method\n });\n }\n }, this);\n },\n\n _runQueue: function(){\n for (var i = this._requestQueue.length - 1; i >= 0; i--) {\n var request = this._requestQueue[i];\n var method = request.shift();\n this[method].apply(this, request);\n }\n this._requestQueue = [];\n }\n\n});\n\nEsriLeaflet.Services.service = function(url, params){\n return new EsriLeaflet.Services.Service(url, params);\n};","EsriLeaflet.Services.ImageService = EsriLeaflet.Services.Service.extend({\n\n query: function () {\n return new EsriLeaflet.Tasks.Query(this);\n },\n\n identify: function() {\n return new EsriLeaflet.Tasks.IdentifyImage(this);\n }\n});\n\nEsriLeaflet.Services.imageService = function(url, params){\n return new EsriLeaflet.Services.ImageService(url, params);\n};","EsriLeaflet.Tasks.Task = L.Class.extend({\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n //Generate a method for each methodName:paramName in the setters for this task.\n generateSetter: function(param, context){\n var isArray = param.match(/([a-zA-Z]+)\\[\\]/);\n\n param = (isArray) ? isArray[1] : param;\n\n if(isArray){\n return L.Util.bind(function(value){\n // this.params[param] = (this.params[param]) ? this.params[param] + ',' : '';\n if (L.Util.isArray(value)) {\n this.params[param] = value.join(',');\n } else {\n this.params[param] = value;\n }\n return this;\n }, context);\n } else {\n return L.Util.bind(function(value){\n this.params[param] = value;\n return this;\n }, context);\n }\n },\n\n initialize: function(endpoint, options){\n // endpoint can be either a url to an ArcGIS Rest Service or an instance of EsriLeaflet.Service\n if(endpoint.url && endpoint.request){\n this._service = endpoint;\n this.url = endpoint.url;\n } else {\n this.url = EsriLeaflet.Util.cleanUrl(endpoint);\n }\n\n // clone default params into this object\n this.params = L.Util.extend({}, this.params || {});\n\n // generate setter methods based on the setters object implimented a child class\n if(this.setters){\n for (var setter in this.setters){\n var param = this.setters[setter];\n this[setter] = this.generateSetter(param, this);\n }\n }\n\n L.Util.setOptions(this, options);\n },\n\n token: function(token){\n if(this._service){\n this._service.authenticate(token);\n } else {\n this.params.token = token;\n }\n return this;\n },\n\n request: function(callback, context){\n if(this._service){\n return this._service.request(this.path, this.params, callback, context);\n } else {\n return this._request('request', this.path, this.params, callback, context);\n }\n },\n\n _request: function(method, path, params, callback, context){\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, callback, context);\n } else{\n return EsriLeaflet[method](url, params, callback, context);\n }\n }\n});","EsriLeaflet.Tasks.Query = EsriLeaflet.Tasks.Task.extend({\n setters: {\n 'offset': 'offset',\n 'limit': 'limit',\n 'outFields': 'fields[]',\n 'precision': 'geometryPrecision',\n 'featureIds': 'objectIds[]',\n 'returnGeometry': 'returnGeometry',\n 'token': 'token'\n },\n\n path: 'query',\n\n params: {\n returnGeometry: true,\n where: '1=1',\n outSr: 4326,\n outFields: '*'\n },\n\n within: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelContains'; // will make code read layer within geometry, to the api this will reads geometry contains layer\n return this;\n },\n\n intersects: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelIntersects';\n return this;\n },\n\n contains: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelWithin'; // will make code read layer contains geometry, to the api this will reads geometry within layer\n return this;\n },\n\n // crosses: function(geometry){\n // this._setGeometry(geometry);\n // this.params.spatialRel = 'esriSpatialRelCrosses';\n // return this;\n // },\n\n // touches: function(geometry){\n // this._setGeometry(geometry);\n // this.params.spatialRel = 'esriSpatialRelTouches';\n // return this;\n // },\n\n overlaps: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelOverlaps';\n return this;\n },\n\n // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online\n nearby: function(latlng, radius){\n latlng = L.latLng(latlng);\n this.params.geometry = ([latlng.lng,latlng.lat]).join(',');\n this.params.geometryType = 'esriGeometryPoint';\n this.params.spatialRel = 'esriSpatialRelIntersects';\n this.params.units = 'esriSRUnit_Meter';\n this.params.distance = radius;\n this.params.inSr = 4326;\n return this;\n },\n\n where: function(string){\n this.params.where = string.replace(/\"/g, \"\\'\"); // jshint ignore:line\n return this;\n },\n\n between: function(start, end){\n this.params.time = ([start.valueOf(), end.valueOf()]).join();\n return this;\n },\n\n fields: function (fields) {\n if (L.Util.isArray(fields)) {\n this.params.outFields = fields.join(',');\n } else {\n this.params.outFields = fields;\n }\n return this;\n },\n\n simplify: function(map, factor){\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\n return this;\n },\n\n orderBy: function(fieldName, order){\n order = order || 'ASC';\n this.params.orderByFields = (this.params.orderByFields) ? this.params.orderByFields + ',' : '';\n this.params.orderByFields += ([fieldName, order]).join(' ');\n return this;\n },\n\n returnGeometry: function(bool){\n this.params.returnGeometry = bool;\n return this;\n },\n\n run: function(callback, context){\n this._cleanParams();\n return this.request(function(error, response){\n callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response);\n }, context);\n },\n\n count: function(callback, context){\n this._cleanParams();\n this.params.returnCountOnly = true;\n return this.request(function(error, response){\n callback.call(this, error, (response && response.count), response);\n }, context);\n },\n\n ids: function(callback, context){\n this._cleanParams();\n this.params.returnIdsOnly = true;\n return this.request(function(error, response){\n callback.call(this, error, (response && response.objectIds), response);\n }, context);\n },\n\n // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online\n bounds: function(callback, context){\n this._cleanParams();\n this.params.returnExtentOnly = true;\n return this.request(function(error, response){\n callback.call(context, error, (response && response.extent && EsriLeaflet.Util.extentToBounds(response.extent)), response);\n }, context);\n },\n\n // only valid for image services\n pixelSize: function(point){\n point = L.point(point);\n this.params.pixelSize = ([point.x,point.y]).join(',');\n return this;\n },\n\n // only valid for map services\n layer: function(layer){\n this.path = layer + '/query';\n return this;\n },\n\n _cleanParams: function(){\n delete this.params.returnIdsOnly;\n delete this.params.returnExtentOnly;\n delete this.params.returnCountOnly;\n },\n\n _setGeometry: function(geometry) {\n this.params.inSr = 4326;\n\n // convert bounds to extent and finish\n if ( geometry instanceof L.LatLngBounds ) {\n // set geometry + geometryType\n this.params.geometry = EsriLeaflet.Util.boundsToExtent(geometry);\n this.params.geometryType = 'esriGeometryEnvelope';\n return;\n }\n\n // convert L.Marker > L.LatLng\n if(geometry.getLatLng){\n geometry = geometry.getLatLng();\n }\n\n // convert L.LatLng to a geojson point and continue;\n if (geometry instanceof L.LatLng) {\n geometry = {\n type: 'Point',\n coordinates: [geometry.lng, geometry.lat]\n };\n }\n\n // handle L.GeoJSON, pull out the first geometry\n if ( geometry instanceof L.GeoJSON ) {\n //reassign geometry to the GeoJSON value (we are assuming that only one feature is present)\n geometry = geometry.getLayers()[0].feature.geometry;\n this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry);\n this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type);\n }\n\n // Handle L.Polyline and L.Polygon\n if (geometry.toGeoJSON) {\n geometry = geometry.toGeoJSON();\n }\n\n // handle GeoJSON feature by pulling out the geometry\n if ( geometry.type === 'Feature' ) {\n // get the geometry of the geojson feature\n geometry = geometry.geometry;\n }\n\n // confirm that our GeoJSON is a point, line or polygon\n if ( geometry.type === 'Point' || geometry.type === 'LineString' || geometry.type === 'Polygon') {\n this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry);\n this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type);\n return;\n }\n\n // warn the user if we havn't found a\n /* global console */\n if(console && console.warn) {\n console.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');\n }\n\n return;\n }\n});\n\nEsriLeaflet.Tasks.query = function(url, params){\n return new EsriLeaflet.Tasks.Query(url, params);\n};","EsriLeaflet.Tasks.Identify = EsriLeaflet.Tasks.Task.extend({\n path: 'identify',\n\n between: function(start, end){\n this.params.time = ([start.valueOf(), end.valueOf()]).join(',');\n return this;\n },\n\n returnGeometry: function (returnGeometry) {\n this.params.returnGeometry = returnGeometry;\n return this;\n }\n});\n","EsriLeaflet.Layers.RasterLayer = L.Class.extend({\n includes: L.Mixin.Events,\n\n options: {\n opacity: 1,\n position: 'front',\n f: 'image'\n },\n\n onAdd: function (map) {\n this._map = map;\n\n this._update = L.Util.limitExecByInterval(this._update, this.options.updateInterval, this);\n\n if (map.options.crs && map.options.crs.code) {\n var sr = map.options.crs.code.split(':')[1];\n this.options.bboxSR = sr;\n this.options.imageSR = sr;\n }\n\n map.on('moveend', this._update, this);\n\n this._update();\n\n if(this._popup){\n this._map.on('click', this._getPopupData, this);\n this._map.on('dblclick', this._resetPopupState, this);\n }\n },\n\n bindPopup: function(fn, popupOptions){\n this._shouldRenderPopup = false;\n this._lastClick = false;\n this._popup = L.popup(popupOptions);\n this._popupFunction = fn;\n if(this._map){\n this._map.on('click', this._getPopupData, this);\n this._map.on('dblclick', this._resetPopupState, this);\n }\n return this;\n },\n\n unbindPopup: function(){\n if(this._map){\n this._map.closePopup(this._popup);\n this._map.off('click', this._getPopupData, this);\n this._map.off('dblclick', this._resetPopupState, this);\n }\n this._popup = false;\n return this;\n },\n\n onRemove: function (map) {\n\n if (this._currentImage) {\n this._map.removeLayer(this._currentImage);\n }\n\n if(this._popup){\n this._map.off('click', this._getPopupData, this);\n this._map.off('dblclick', this._resetPopupState, this);\n }\n\n this._map.off('moveend', this._update, this);\n this._map = null;\n },\n\n addTo: function(map){\n map.addLayer(this);\n return this;\n },\n\n removeFrom: function(map){\n map.removeLayer(this);\n return this;\n },\n\n bringToFront: function(){\n this.options.position = 'front';\n if(this._currentImage){\n this._currentImage.bringToFront();\n }\n return this;\n },\n\n bringToBack: function(){\n this.options.position = 'back';\n if(this._currentImage){\n this._currentImage.bringToBack();\n }\n return this;\n },\n\n getAttribution: function () {\n return this.options.attribution;\n },\n\n getOpacity: function(){\n return this.options.opacity;\n },\n\n setOpacity: function(opacity){\n this.options.opacity = opacity;\n this._currentImage.setOpacity(opacity);\n return this;\n },\n\n getTimeRange: function(){\n return [this.options.from, this.options.to];\n },\n\n setTimeRange: function(from, to){\n this.options.from = from;\n this.options.to = to;\n this._update();\n return this;\n },\n\n metadata: function(callback, context){\n this._service.metadata(callback, context);\n return this;\n },\n\n authenticate: function(token){\n this._service.authenticate(token);\n return this;\n },\n\n _renderImage: function(url, bounds){\n if(this._map){\n var image = new L.ImageOverlay(url, bounds, {\n opacity: 0\n }).addTo(this._map);\n\n image.once('load', function(e){\n var newImage = e.target;\n var oldImage = this._currentImage;\n if(newImage._bounds.equals(bounds)){\n this._currentImage = newImage;\n\n if(this.options.position === 'front'){\n this.bringToFront();\n } else {\n this.bringToBack();\n }\n\n if(this._map && this._currentImage._map){\n this._currentImage.setOpacity(this.options.opacity);\n } else {\n this._currentImage._map.removeLayer(this._currentImage);\n }\n\n if(oldImage){\n this._map.removeLayer(oldImage);\n }\n\n } else {\n this._map.removeLayer(newImage);\n }\n\n this.fire('load', {\n bounds: bounds\n });\n\n }, this);\n\n this.fire('loading', {\n bounds: bounds\n });\n }\n },\n\n _update: function () {\n if(!this._map){\n return;\n }\n\n var zoom = this._map.getZoom();\n var bounds = this._map.getBounds();\n\n if(this._animatingZoom){\n return;\n }\n\n if (this._map._panTransition && this._map._panTransition._inProgress) {\n return;\n }\n\n if (zoom > this.options.maxZoom || zoom < this.options.minZoom) {\n return;\n }\n var params = this._buildExportParams();\n\n this._requestExport(params, bounds);\n },\n\n // TODO: refactor these into raster layer\n _renderPopup: function(latlng, error, results, response){\n latlng = L.latLng(latlng);\n if(this._shouldRenderPopup && this._lastClick.equals(latlng)){\n //add the popup to the map where the mouse was clicked at\n var content = this._popupFunction(error, results, response);\n if (content) {\n this._popup.setLatLng(latlng).setContent(content).openOn(this._map);\n }\n }\n },\n\n _resetPopupState: function(e){\n this._shouldRenderPopup = false;\n this._lastClick = e.latlng;\n },\n\n // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js\n // @TODO remove at Leaflet 0.8\n _propagateEvent: function (e) {\n e = L.extend({\n layer: e.target,\n target: this\n }, e);\n this.fire(e.type, e);\n }\n});","EsriLeaflet.Layers.ImageMapLayer = EsriLeaflet.Layers.RasterLayer.extend({\n\n options: {\n updateInterval: 150,\n format: 'jpgpng'\n },\n\n query: function(){\n return this._service.query();\n },\n\n identify: function(){\n return this._service.identify();\n },\n\n initialize: function (url, options) {\n this.url = EsriLeaflet.Util.cleanUrl(url);\n this._service = new EsriLeaflet.Services.ImageService(this.url, options);\n this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', this._propagateEvent, this);\n L.Util.setOptions(this, options);\n },\n\n setPixelType: function (pixelType) {\n this.options.pixelType = pixelType;\n this._update();\n return this;\n },\n\n getPixelType: function () {\n return this.options.pixelType;\n },\n\n setBandIds: function (bandIds) {\n if (L.Util.isArray(bandIds)) {\n this.options.bandIds = bandIds.join(',');\n } else {\n this.options.bandIds = bandIds.toString();\n }\n this._update();\n return this;\n },\n\n getBandIds: function () {\n return this.options.bandIds;\n },\n\n setNoData: function (noData, noDataInterpretation) {\n if (L.Util.isArray(noData)) {\n this.options.noData = noData.join(',');\n } else {\n this.options.noData = noData.toString();\n }\n if (noDataInterpretation) {\n this.options.noDataInterpretation = noDataInterpretation;\n }\n this._update();\n return this;\n },\n\n getNoData: function () {\n return this.options.noData;\n },\n\n getNoDataInterpretation: function () {\n return this.options.noDataInterpretation;\n },\n\n setRenderingRule: function(renderingRule) {\n this.options.renderingRule = renderingRule;\n this._update();\n },\n\n getRenderingRule: function() {\n return this.options.renderingRule;\n },\n\n setMosaicRule: function(mosaicRule) {\n this.options.mosaicRule = mosaicRule;\n this._update();\n },\n\n getMosaicRule: function() {\n return this.options.mosaicRule;\n },\n\n _getPopupData: function(e){\n var callback = L.Util.bind(function(error, results, response) {\n setTimeout(L.Util.bind(function(){\n this._renderPopup(e.latlng, error, results, response);\n }, this), 300);\n }, this);\n\n var identifyRequest = this.identify().at(e.latlng);\n\n // set mosaic rule for identify task if it is set for layer\n if (this.options.mosaicRule) {\n identifyRequest.setMosaicRule(this.options.mosaicRule);\n // @TODO: force return catalog items too?\n }\n\n // @TODO: set rendering rule? Not sure,\n // sometimes you want raw pixel values\n // if (this.options.renderingRule) {\n // identifyRequest.setRenderingRule(this.options.renderingRule);\n // }\n\n identifyRequest.run(callback);\n\n // set the flags to show the popup\n this._shouldRenderPopup = true;\n this._lastClick = e.latlng;\n },\n\n _buildExportParams: function () {\n var bounds = this._map.getBounds();\n var size = this._map.getSize();\n var ne = this._map.options.crs.project(bounds._northEast);\n var sw = this._map.options.crs.project(bounds._southWest);\n\n var params = {\n bbox: [sw.x, sw.y, ne.x, ne.y].join(','),\n size: size.x + ',' + size.y,\n format: this.options.format,\n bboxSR: this.options.bboxSR,\n imageSR: this.options.imageSR\n };\n\n if (this.options.from && this.options.to) {\n params.time = this.options.from.valueOf() + ',' + this.options.to.valueOf();\n }\n\n if (this.options.pixelType) {\n params.pixelType = this.options.pixelType;\n }\n\n if (this.options.interpolation) {\n params.interpolation = this.options.interpolation;\n }\n\n if (this.options.compressionQuality) {\n params.compressionQuality = this.options.compressionQuality;\n }\n\n if (this.options.bandIds) {\n params.bandIds = this.options.bandIds;\n }\n\n if (this.options.noData) {\n params.noData = this.options.noData;\n }\n\n if (this.options.noDataInterpretation) {\n params.noDataInterpretation = this.options.noDataInterpretation;\n }\n\n if (this._service.options.token) {\n params.token = this._service.options.token;\n }\n\n if(this.options.renderingRule) {\n params.renderingRule = JSON.stringify(this.options.renderingRule);\n }\n\n if(this.options.mosaicRule) {\n params.mosaicRule = JSON.stringify(this.options.mosaicRule);\n }\n\n return params;\n },\n\n _requestExport: function (params, bounds) {\n if (this.options.f === 'json') {\n this._service.get('exportImage', params, function(error, response){\n this._renderImage(response.href, bounds);\n }, this);\n } else {\n params.f = 'image';\n this._renderImage(this.url + 'exportImage' + L.Util.getParamString(params), bounds);\n }\n }\n});\n\nEsriLeaflet.ImageMapLayer = EsriLeaflet.Layers.ImageMapLayer;\n\nEsriLeaflet.Layers.imageMapLayer = function (url, options) {\n return new EsriLeaflet.Layers.ImageMapLayer(url, options);\n};\n\nEsriLeaflet.imageMapLayer = function (url, options) {\n return new EsriLeaflet.Layers.ImageMapLayer(url, options);\n};"]} \ No newline at end of file diff --git a/dist/builds/map-service/esri-leaflet-map-service-src.js b/dist/builds/map-service/esri-leaflet-map-service-src.js new file mode 100644 index 000000000..102d87028 --- /dev/null +++ b/dist/builds/map-service/esri-leaflet-map-service-src.js @@ -0,0 +1,1640 @@ +/*! esri-leaflet - v1.0.0-rc.3 - 2014-11-04 +* Copyright (c) 2014 Environmental Systems Research Institute, Inc. +* Apache License*/ +(function (factory) { + //define an AMD module that relies on 'leaflet' + if (typeof define === 'function' && define.amd) { + define(['leaflet'], function (L) { + return factory(L); + }); + //define a common js module that relies on 'leaflet' + } else if (typeof module === 'object' && typeof module.exports === 'object') { + module.exports = factory(require('leaflet')); + } + + if(typeof window !== 'undefined' && window.L){ + factory(window.L); + } +}(function (L) { +var EsriLeaflet = { //jshint ignore:line + VERSION: '1.0.0-rc.2', + Layers: {}, + Services: {}, + Controls: {}, + Tasks: {}, + Util: {}, + Support: { + CORS: !!(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()), + pointerEvents: document.documentElement.style.pointerEvents === '' + } +}; + +if(typeof window !== 'undefined' && window.L){ + window.L.esri = EsriLeaflet; +} + +(function(EsriLeaflet){ + + // shallow object clone for feature properties and attributes + // from http://jsperf.com/cloning-an-object/2 + function clone(obj) { + var target = {}; + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + target[i] = obj[i]; + } + } + return target; + } + + // checks if 2 x,y points are equal + function pointsEqual(a, b) { + for (var i = 0; i < a.length; i++) { + if (a[i] !== b[i]) { + return false; + } + } + return true; + } + + // checks if the first and last points of a ring are equal and closes the ring + function closeRing(coordinates) { + if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) { + coordinates.push(coordinates[0]); + } + return coordinates; + } + + // determine if polygon ring coordinates are clockwise. clockwise signifies outer ring, counter-clockwise an inner ring + // or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon- + // points-are-in-clockwise-order + function ringIsClockwise(ringToTest) { + var total = 0,i = 0; + var rLength = ringToTest.length; + var pt1 = ringToTest[i]; + var pt2; + for (i; i < rLength - 1; i++) { + pt2 = ringToTest[i + 1]; + total += (pt2[0] - pt1[0]) * (pt2[1] + pt1[1]); + pt1 = pt2; + } + return (total >= 0); + } + + // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L504-L519 + function vertexIntersectsVertex(a1, a2, b1, b2) { + var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]); + var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]); + var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]); + + if ( uB !== 0 ) { + var ua = uaT / uB; + var ub = ubT / uB; + + if ( 0 <= ua && ua <= 1 && 0 <= ub && ub <= 1 ) { + return true; + } + } + + return false; + } + + // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L521-L531 + function arrayIntersectsArray(a, b) { + for (var i = 0; i < a.length - 1; i++) { + for (var j = 0; j < b.length - 1; j++) { + if (vertexIntersectsVertex(a[i], a[i + 1], b[j], b[j + 1])) { + return true; + } + } + } + + return false; + } + + // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L470-L480 + function coordinatesContainPoint(coordinates, point) { + var contains = false; + for(var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) { + if (((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1]) || + (coordinates[j][1] <= point[1] && point[1] < coordinates[i][1])) && + (point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0])) { + contains = !contains; + } + } + return contains; + } + + // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L106-L113 + function coordinatesContainCoordinates(outer, inner){ + var intersects = arrayIntersectsArray(outer, inner); + var contains = coordinatesContainPoint(outer, inner[0]); + if(!intersects && contains){ + return true; + } + return false; + } + + // do any polygons in this array contain any other polygons in this array? + // used for checking for holes in arcgis rings + // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L117-L172 + function convertRingsToGeoJSON(rings){ + var outerRings = []; + var holes = []; + var x; // iterator + var outerRing; // current outer ring being evaluated + var hole; // current hole being evaluated + + // for each ring + for (var r = 0; r < rings.length; r++) { + var ring = closeRing(rings[r].slice(0)); + if(ring.length < 4){ + continue; + } + // is this ring an outer ring? is it clockwise? + if(ringIsClockwise(ring)){ + var polygon = [ ring ]; + outerRings.push(polygon); // push to outer rings + } else { + holes.push(ring); // counterclockwise push to holes + } + } + + var uncontainedHoles = []; + + // while there are holes left... + while(holes.length){ + // pop a hole off out stack + hole = holes.pop(); + + // loop over all outer rings and see if they contain our hole. + var contained = false; + for (x = outerRings.length - 1; x >= 0; x--) { + outerRing = outerRings[x][0]; + if(coordinatesContainCoordinates(outerRing, hole)){ + // the hole is contained push it into our polygon + outerRings[x].push(hole); + contained = true; + break; + } + } + + // ring is not contained in any outer ring + // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320 + if(!contained){ + uncontainedHoles.push(hole); + } + } + + // if we couldn't match any holes using contains we can try intersects... + while(uncontainedHoles.length){ + // pop a hole off out stack + hole = uncontainedHoles.pop(); + + // loop over all outer rings and see if any intersect our hole. + var intersects = false; + for (x = outerRings.length - 1; x >= 0; x--) { + outerRing = outerRings[x][0]; + if(arrayIntersectsArray(outerRing, hole)){ + // the hole is contained push it into our polygon + outerRings[x].push(hole); + intersects = true; + break; + } + } + + if(!intersects) { + outerRings.push([hole.reverse()]); + } + } + + if(outerRings.length === 1){ + return { + type: 'Polygon', + coordinates: outerRings[0] + }; + } else { + return { + type: 'MultiPolygon', + coordinates: outerRings + }; + } + } + + // This function ensures that rings are oriented in the right directions + // outer rings are clockwise, holes are counterclockwise + // used for converting GeoJSON Polygons to ArcGIS Polygons + function orientRings(poly){ + var output = []; + var polygon = poly.slice(0); + var outerRing = closeRing(polygon.shift().slice(0)); + if(outerRing.length >= 4){ + if(!ringIsClockwise(outerRing)){ + outerRing.reverse(); + } + + output.push(outerRing); + + for (var i = 0; i < polygon.length; i++) { + var hole = closeRing(polygon[i].slice(0)); + if(hole.length >= 4){ + if(ringIsClockwise(hole)){ + hole.reverse(); + } + output.push(hole); + } + } + } + + return output; + } + + // This function flattens holes in multipolygons to one array of polygons + // used for converting GeoJSON Polygons to ArcGIS Polygons + function flattenMultiPolygonRings(rings){ + var output = []; + for (var i = 0; i < rings.length; i++) { + var polygon = orientRings(rings[i]); + for (var x = polygon.length - 1; x >= 0; x--) { + var ring = polygon[x].slice(0); + output.push(ring); + } + } + return output; + } + + // convert an extent (ArcGIS) to LatLngBounds (Leaflet) + EsriLeaflet.Util.extentToBounds = function(extent){ + var sw = new L.LatLng(extent.ymin, extent.xmin); + var ne = new L.LatLng(extent.ymax, extent.xmax); + return new L.LatLngBounds(sw, ne); + }; + + // convert an LatLngBounds (Leaflet) to extent (ArcGIS) + EsriLeaflet.Util.boundsToExtent = function(bounds) { + bounds = L.latLngBounds(bounds); + return { + 'xmin': bounds.getSouthWest().lng, + 'ymin': bounds.getSouthWest().lat, + 'xmax': bounds.getNorthEast().lng, + 'ymax': bounds.getNorthEast().lat, + 'spatialReference': { + 'wkid' : 4326 + } + }; + }; + + EsriLeaflet.Util.arcgisToGeojson = function (arcgis, idAttribute){ + var geojson = {}; + + if(typeof arcgis.x === 'number' && typeof arcgis.y === 'number'){ + geojson.type = 'Point'; + geojson.coordinates = [arcgis.x, arcgis.y]; + } + + if(arcgis.points){ + geojson.type = 'MultiPoint'; + geojson.coordinates = arcgis.points.slice(0); + } + + if(arcgis.paths) { + if(arcgis.paths.length === 1){ + geojson.type = 'LineString'; + geojson.coordinates = arcgis.paths[0].slice(0); + } else { + geojson.type = 'MultiLineString'; + geojson.coordinates = arcgis.paths.slice(0); + } + } + + if(arcgis.rings) { + geojson = convertRingsToGeoJSON(arcgis.rings.slice(0)); + } + + if(arcgis.geometry || arcgis.attributes) { + geojson.type = 'Feature'; + geojson.geometry = (arcgis.geometry) ? EsriLeaflet.Util.arcgisToGeojson(arcgis.geometry) : null; + geojson.properties = (arcgis.attributes) ? clone(arcgis.attributes) : null; + if(arcgis.attributes) { + geojson.id = arcgis.attributes[idAttribute] || arcgis.attributes.OBJECTID || arcgis.attributes.FID; + } + } + + return geojson; + }; + + // GeoJSON -> ArcGIS + EsriLeaflet.Util.geojsonToArcGIS = function(geojson, idAttribute){ + idAttribute = idAttribute || 'OBJECTID'; + var spatialReference = { wkid: 4326 }; + var result = {}; + var i; + + switch(geojson.type){ + case 'Point': + result.x = geojson.coordinates[0]; + result.y = geojson.coordinates[1]; + result.spatialReference = spatialReference; + break; + case 'MultiPoint': + result.points = geojson.coordinates.slice(0); + result.spatialReference = spatialReference; + break; + case 'LineString': + result.paths = [geojson.coordinates.slice(0)]; + result.spatialReference = spatialReference; + break; + case 'MultiLineString': + result.paths = geojson.coordinates.slice(0); + result.spatialReference = spatialReference; + break; + case 'Polygon': + result.rings = orientRings(geojson.coordinates.slice(0)); + result.spatialReference = spatialReference; + break; + case 'MultiPolygon': + result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0)); + result.spatialReference = spatialReference; + break; + case 'Feature': + if(geojson.geometry) { + result.geometry = EsriLeaflet.Util.geojsonToArcGIS(geojson.geometry, idAttribute); + } + result.attributes = (geojson.properties) ? clone(geojson.properties) : {}; + if(geojson.id){ + result.attributes[idAttribute] = geojson.id; + } + break; + case 'FeatureCollection': + result = []; + for (i = 0; i < geojson.features.length; i++){ + result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.features[i], idAttribute)); + } + break; + case 'GeometryCollection': + result = []; + for (i = 0; i < geojson.geometries.length; i++){ + result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.geometries[i], idAttribute)); + } + break; + } + + return result; + }; + + EsriLeaflet.Util.responseToFeatureCollection = function(response, idAttribute){ + var objectIdField; + + if(idAttribute){ + objectIdField = idAttribute; + } else if(response.objectIdFieldName){ + objectIdField = response.objectIdFieldName; + } else if(response.fields) { + for (var j = 0; j <= response.fields.length - 1; j++) { + if(response.fields[j].type === 'esriFieldTypeOID') { + objectIdField = response.fields[j].name; + break; + } + } + } else { + objectIdField = 'OBJECTID'; + } + + var featureCollection = { + type: 'FeatureCollection', + features: [] + }; + var features = response.features || response.results; + if(features.length){ + for (var i = features.length - 1; i >= 0; i--) { + featureCollection.features.push(EsriLeaflet.Util.arcgisToGeojson(features[i], objectIdField)); + } + } + + return featureCollection; + }; + + // trim whitespace and add a tailing slash is needed to a url + EsriLeaflet.Util.cleanUrl = function(url){ + url = url.replace(/\s\s*/g, ''); + + //add a trailing slash to the url if the user omitted it + if(url[url.length-1] !== '/'){ + url += '/'; + } + + return url; + }; + + EsriLeaflet.Util.geojsonTypeToArcGIS = function (geoJsonType) { + var arcgisGeometryType; + switch (geoJsonType) { + case 'Point': + arcgisGeometryType = 'esriGeometryPoint'; + break; + case 'MultiPoint': + arcgisGeometryType = 'esriGeometryMultipoint'; + break; + case 'LineString': + arcgisGeometryType = 'esriGeometryPolyline'; + break; + case 'MultiLineString': + arcgisGeometryType = 'esriGeometryPolyline'; + break; + case 'Polygon': + arcgisGeometryType = 'esriGeometryPolygon'; + break; + case 'MultiPolygon': + arcgisGeometryType = 'esriGeometryPolygon'; + break; + } + return arcgisGeometryType; + }; + +})(EsriLeaflet); + +(function(EsriLeaflet){ + + var callbacks = 0; + + window._EsriLeafletCallbacks = {}; + + function serialize(params){ + var data = ''; + + params.f = 'json'; + + for (var key in params){ + if(params.hasOwnProperty(key)){ + var param = params[key]; + var type = Object.prototype.toString.call(param); + var value; + + if(data.length){ + data += '&'; + } + + if(type === '[object Array]' || type === '[object Object]'){ + value = JSON.stringify(param); + } else if (type === '[object Date]'){ + value = param.valueOf(); + } else { + value = param; + } + + data += encodeURIComponent(key) + '=' + encodeURIComponent(value); + } + } + + return data; + } + + function createRequest(callback, context){ + var httpRequest = new XMLHttpRequest(); + + httpRequest.onerror = function(e) { + callback.call(context, { + error: { + code: 500, + message: 'XMLHttpRequest error' + } + }, null); + }; + + httpRequest.onreadystatechange = function(){ + var response; + var error; + + if (httpRequest.readyState === 4) { + try { + response = JSON.parse(httpRequest.responseText); + } catch(e) { + response = null; + error = { + code: 500, + message: 'Could not parse response as JSON.' + }; + } + + if (!error && response.error) { + error = response.error; + response = null; + } + + callback.call(context, error, response); + } + }; + + return httpRequest; + } + + // AJAX handlers for CORS (modern browsers) or JSONP (older browsers) + EsriLeaflet.Request = { + request: function(url, params, callback, context){ + var paramString = serialize(params); + var httpRequest = createRequest(callback, context); + var requestLength = (url + '?' + paramString).length; + + // request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest + if(requestLength <= 2000 && L.esri.Support.CORS){ + httpRequest.open('GET', url + '?' + paramString); + httpRequest.send(null); + + // request is less more then 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest + } else if (requestLength > 2000 && L.esri.Support.CORS){ + httpRequest.open('POST', url); + httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + httpRequest.send(paramString); + + // request is less more then 2000 characters and the browser does not support CORS, make a JSONP request + } else if(requestLength <= 2000 && !L.esri.Support.CORS){ + return L.esri.Request.get.JSONP(url, params, callback, context); + + // request is longer then 2000 characters and the browser does not support CORS, log a warning + } else { + if(console && console.warn){ + console.warn('a request to ' + url + ' 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'); + return; + } + } + + return httpRequest; + }, + post: { + XMLHTTP: function (url, params, callback, context) { + var httpRequest = createRequest(callback, context); + httpRequest.open('POST', url); + httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + httpRequest.send(serialize(params)); + + return httpRequest; + } + }, + + get: { + CORS: function (url, params, callback, context) { + var httpRequest = createRequest(callback, context); + + httpRequest.open('GET', url + '?' + serialize(params), true); + httpRequest.send(null); + + return httpRequest; + }, + JSONP: function(url, params, callback, context){ + 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){ + if(window._EsriLeafletCallbacks[callbackId] !== true){ + var error; + var responseType = Object.prototype.toString.call(response); + + if(!(responseType === '[object Object]' || responseType === '[object Array]')){ + error = { + error: { + code: 500, + message: 'Expected array or object as JSONP response' + } + }; + response = null; + } + + if (!error && response.error) { + error = response; + response = null; + } + + callback.call(context, error, response); + window._EsriLeafletCallbacks[callbackId] = true; + } + }; + + callbacks++; + + return { + id: callbackId, + url: script.src, + abort: function(){ + window._EsriLeafletCallbacks._callback[callbackId]({ + code: 0, + message: 'Request aborted.' + }); + } + }; + } + } + }; + + // Choose the correct AJAX handler depending on CORS support + EsriLeaflet.get = (EsriLeaflet.Support.CORS) ? EsriLeaflet.Request.get.CORS : EsriLeaflet.Request.get.JSONP; + + // Always use XMLHttpRequest for posts + EsriLeaflet.post = EsriLeaflet.Request.post.XMLHTTP; + + // expose a common request method the uses GET\POST based on request length + EsriLeaflet.request = EsriLeaflet.Request.request; + +})(EsriLeaflet); + +EsriLeaflet.Services.Service = L.Class.extend({ + + includes: L.Mixin.Events, + + options: { + proxy: false, + useCors: EsriLeaflet.Support.CORS + }, + + initialize: function (url, options) { + this.url = EsriLeaflet.Util.cleanUrl(url); + this._requestQueue = []; + this._authenticating = false; + L.Util.setOptions(this, options); + }, + + get: function (path, params, callback, context) { + return this._request('get', path, params, callback, context); + }, + + post: function (path, params, callback, context) { + return this._request('post', path, params, callback, context); + }, + + request: function (path, params, callback, context) { + return this._request('request', path, params, callback, context); + }, + + metadata: function (callback, context) { + return this._request('get', '', {}, callback, context); + }, + + authenticate: function(token){ + this._authenticating = false; + this.options.token = token; + this._runQueue(); + return this; + }, + + _request: function(method, path, params, callback, context){ + this.fire('requeststart', { + url: this.url + path, + params: params, + method: method + }); + + var wrappedCallback = this._createServiceCallback(method, path, params, callback, context); + + if (this.options.token) { + params.token = this.options.token; + } + + if (this._authenticating) { + this._requestQueue.push([method, path, params, callback, context]); + return; + } else { + var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path; + + if((method === 'get' || method === 'request') && !this.options.useCors){ + return EsriLeaflet.Request.get.JSONP(url, params, wrappedCallback); + } else { + return EsriLeaflet[method](url, params, wrappedCallback); + } + } + }, + + _createServiceCallback: function(method, path, params, callback, context){ + var request = [method, path, params, callback, context]; + + return L.Util.bind(function(error, response){ + + if (error && (error.code === 499 || error.code === 498)) { + this._authenticating = true; + + this._requestQueue.push(request); + + this.fire('authenticationrequired', { + authenticate: L.Util.bind(this.authenticate, this) + }); + } else { + callback.call(context, error, response); + + if(error) { + this.fire('requesterror', { + url: this.url + path, + params: params, + message: error.message, + code: error.code, + method: method + }); + } else { + this.fire('requestsuccess', { + url: this.url + path, + params: params, + response: response, + method: method + }); + } + + this.fire('requestend', { + url: this.url + path, + params: params, + method: method + }); + } + }, this); + }, + + _runQueue: function(){ + for (var i = this._requestQueue.length - 1; i >= 0; i--) { + var request = this._requestQueue[i]; + var method = request.shift(); + this[method].apply(this, request); + } + this._requestQueue = []; + } + +}); + +EsriLeaflet.Services.service = function(url, params){ + return new EsriLeaflet.Services.Service(url, params); +}; + +EsriLeaflet.Services.MapService = EsriLeaflet.Services.Service.extend({ + + identify: function () { + return new EsriLeaflet.Tasks.identifyFeatures(this); + }, + + find: function () { + return new EsriLeaflet.Tasks.Find(this); + }, + + query: function () { + return new EsriLeaflet.Tasks.Query(this); + } + +}); + +EsriLeaflet.Services.mapService = function(url, params){ + return new EsriLeaflet.Services.MapService(url, params); +}; + +EsriLeaflet.Tasks.Task = L.Class.extend({ + + options: { + proxy: false, + useCors: EsriLeaflet.Support.CORS + }, + + //Generate a method for each methodName:paramName in the setters for this task. + generateSetter: function(param, context){ + var isArray = param.match(/([a-zA-Z]+)\[\]/); + + param = (isArray) ? isArray[1] : param; + + if(isArray){ + return L.Util.bind(function(value){ + // this.params[param] = (this.params[param]) ? this.params[param] + ',' : ''; + if (L.Util.isArray(value)) { + this.params[param] = value.join(','); + } else { + this.params[param] = value; + } + return this; + }, context); + } else { + return L.Util.bind(function(value){ + this.params[param] = value; + return this; + }, context); + } + }, + + initialize: function(endpoint, options){ + // endpoint can be either a url to an ArcGIS Rest Service or an instance of EsriLeaflet.Service + if(endpoint.url && endpoint.request){ + this._service = endpoint; + this.url = endpoint.url; + } else { + this.url = EsriLeaflet.Util.cleanUrl(endpoint); + } + + // clone default params into this object + this.params = L.Util.extend({}, this.params || {}); + + // generate setter methods based on the setters object implimented a child class + if(this.setters){ + for (var setter in this.setters){ + var param = this.setters[setter]; + this[setter] = this.generateSetter(param, this); + } + } + + L.Util.setOptions(this, options); + }, + + token: function(token){ + if(this._service){ + this._service.authenticate(token); + } else { + this.params.token = token; + } + return this; + }, + + request: function(callback, context){ + if(this._service){ + return this._service.request(this.path, this.params, callback, context); + } else { + return this._request('request', this.path, this.params, callback, context); + } + }, + + _request: function(method, path, params, callback, context){ + var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path; + if((method === 'get' || method === 'request') && !this.options.useCors){ + return EsriLeaflet.Request.get.JSONP(url, params, callback, context); + } else{ + return EsriLeaflet[method](url, params, callback, context); + } + } +}); + +EsriLeaflet.Tasks.Identify = EsriLeaflet.Tasks.Task.extend({ + path: 'identify', + + between: function(start, end){ + this.params.time = ([start.valueOf(), end.valueOf()]).join(','); + return this; + }, + + returnGeometry: function (returnGeometry) { + this.params.returnGeometry = returnGeometry; + return this; + } +}); + + +EsriLeaflet.Tasks.IdentifyFeatures = EsriLeaflet.Tasks.Identify.extend({ + setters: { + 'layers': 'layers', + 'precision': 'geometryPrecision', + 'tolerance': 'tolerance' + }, + + params: { + sr: 4326, + layers: 'all', + tolerance: 3, + returnGeometry: true + }, + + on: function(map){ + var extent = EsriLeaflet.Util.boundsToExtent(map.getBounds()); + var size = map.getSize(); + this.params.imageDisplay = [size.x, size.y, 96].join(','); + this.params.mapExtent=([extent.xmin, extent.ymin, extent.xmax, extent.ymax]).join(','); + return this; + }, + + at: function(latlng){ + latlng = L.latLng(latlng); + this.params.geometry = ([latlng.lng, latlng.lat]).join(','); + this.params.geometryType = 'esriGeometryPoint'; + return this; + }, + + layerDef: function (id, where){ + this.params.layerDefs = (this.params.layerDefs) ? this.params.layerDefs + ';' : ''; + this.params.layerDefs += ([id, where]).join(':'); + return this; + }, + + simplify: function(map, factor){ + var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast()); + this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * (1 - factor); + return this; + }, + + run: function (callback, context){ + return this.request(function(error, response){ + callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response); + }, context); + } + +}); + +EsriLeaflet.Tasks.identifyFeatures = function(url, params){ + return new EsriLeaflet.Tasks.IdentifyFeatures(url, params); +}; + +EsriLeaflet.Tasks.Query = EsriLeaflet.Tasks.Task.extend({ + setters: { + 'offset': 'offset', + 'limit': 'limit', + 'outFields': 'fields[]', + 'precision': 'geometryPrecision', + 'featureIds': 'objectIds[]', + 'returnGeometry': 'returnGeometry', + 'token': 'token' + }, + + path: 'query', + + params: { + returnGeometry: true, + where: '1=1', + outSr: 4326, + outFields: '*' + }, + + within: function(geometry){ + this._setGeometry(geometry); + this.params.spatialRel = 'esriSpatialRelContains'; // will make code read layer within geometry, to the api this will reads geometry contains layer + return this; + }, + + intersects: function(geometry){ + this._setGeometry(geometry); + this.params.spatialRel = 'esriSpatialRelIntersects'; + return this; + }, + + contains: function(geometry){ + this._setGeometry(geometry); + this.params.spatialRel = 'esriSpatialRelWithin'; // will make code read layer contains geometry, to the api this will reads geometry within layer + return this; + }, + + // crosses: function(geometry){ + // this._setGeometry(geometry); + // this.params.spatialRel = 'esriSpatialRelCrosses'; + // return this; + // }, + + // touches: function(geometry){ + // this._setGeometry(geometry); + // this.params.spatialRel = 'esriSpatialRelTouches'; + // return this; + // }, + + overlaps: function(geometry){ + this._setGeometry(geometry); + this.params.spatialRel = 'esriSpatialRelOverlaps'; + return this; + }, + + // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online + nearby: function(latlng, radius){ + latlng = L.latLng(latlng); + this.params.geometry = ([latlng.lng,latlng.lat]).join(','); + this.params.geometryType = 'esriGeometryPoint'; + this.params.spatialRel = 'esriSpatialRelIntersects'; + this.params.units = 'esriSRUnit_Meter'; + this.params.distance = radius; + this.params.inSr = 4326; + return this; + }, + + where: function(string){ + this.params.where = string.replace(/"/g, "\'"); // jshint ignore:line + return this; + }, + + between: function(start, end){ + this.params.time = ([start.valueOf(), end.valueOf()]).join(); + return this; + }, + + fields: function (fields) { + if (L.Util.isArray(fields)) { + this.params.outFields = fields.join(','); + } else { + this.params.outFields = fields; + } + return this; + }, + + simplify: function(map, factor){ + var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast()); + this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor; + return this; + }, + + orderBy: function(fieldName, order){ + order = order || 'ASC'; + this.params.orderByFields = (this.params.orderByFields) ? this.params.orderByFields + ',' : ''; + this.params.orderByFields += ([fieldName, order]).join(' '); + return this; + }, + + returnGeometry: function(bool){ + this.params.returnGeometry = bool; + return this; + }, + + run: function(callback, context){ + this._cleanParams(); + return this.request(function(error, response){ + callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response); + }, context); + }, + + count: function(callback, context){ + this._cleanParams(); + this.params.returnCountOnly = true; + return this.request(function(error, response){ + callback.call(this, error, (response && response.count), response); + }, context); + }, + + ids: function(callback, context){ + this._cleanParams(); + this.params.returnIdsOnly = true; + return this.request(function(error, response){ + callback.call(this, error, (response && response.objectIds), response); + }, context); + }, + + // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online + bounds: function(callback, context){ + this._cleanParams(); + this.params.returnExtentOnly = true; + return this.request(function(error, response){ + callback.call(context, error, (response && response.extent && EsriLeaflet.Util.extentToBounds(response.extent)), response); + }, context); + }, + + // only valid for image services + pixelSize: function(point){ + point = L.point(point); + this.params.pixelSize = ([point.x,point.y]).join(','); + return this; + }, + + // only valid for map services + layer: function(layer){ + this.path = layer + '/query'; + return this; + }, + + _cleanParams: function(){ + delete this.params.returnIdsOnly; + delete this.params.returnExtentOnly; + delete this.params.returnCountOnly; + }, + + _setGeometry: function(geometry) { + this.params.inSr = 4326; + + // convert bounds to extent and finish + if ( geometry instanceof L.LatLngBounds ) { + // set geometry + geometryType + this.params.geometry = EsriLeaflet.Util.boundsToExtent(geometry); + this.params.geometryType = 'esriGeometryEnvelope'; + return; + } + + // convert L.Marker > L.LatLng + if(geometry.getLatLng){ + geometry = geometry.getLatLng(); + } + + // convert L.LatLng to a geojson point and continue; + if (geometry instanceof L.LatLng) { + geometry = { + type: 'Point', + coordinates: [geometry.lng, geometry.lat] + }; + } + + // handle L.GeoJSON, pull out the first geometry + if ( geometry instanceof L.GeoJSON ) { + //reassign geometry to the GeoJSON value (we are assuming that only one feature is present) + geometry = geometry.getLayers()[0].feature.geometry; + this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry); + this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type); + } + + // Handle L.Polyline and L.Polygon + if (geometry.toGeoJSON) { + geometry = geometry.toGeoJSON(); + } + + // handle GeoJSON feature by pulling out the geometry + if ( geometry.type === 'Feature' ) { + // get the geometry of the geojson feature + geometry = geometry.geometry; + } + + // confirm that our GeoJSON is a point, line or polygon + if ( geometry.type === 'Point' || geometry.type === 'LineString' || geometry.type === 'Polygon') { + this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry); + this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type); + return; + } + + // warn the user if we havn't found a + /* global console */ + if(console && console.warn) { + console.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'); + } + + return; + } +}); + +EsriLeaflet.Tasks.query = function(url, params){ + return new EsriLeaflet.Tasks.Query(url, params); +}; + +EsriLeaflet.Tasks.Find = EsriLeaflet.Tasks.Task.extend({ + setters: { + // method name > param name + 'contains': 'contains', + 'text': 'searchText', + 'fields': 'searchFields[]', // denote an array or single string + '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: true, + returnGeometry: true, + returnZ: true, + returnM: false + }, + + layerDefs: function (id, where) { + this.params.layerDefs = (this.params.layerDefs) ? this.params.layerDefs + ';' : ''; + this.params.layerDefs += ([id, where]).join(':'); + return this; + }, + + simplify: function(map, factor){ + var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast()); + this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor; + return this; + }, + + run: function (callback, context) { + return this.request(function(error, response){ + callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response); + }, context); + } +}); + +EsriLeaflet.Tasks.find = function (url, params) { + return new EsriLeaflet.Tasks.Find(url, params); +}; + +EsriLeaflet.Layers.RasterLayer = L.Class.extend({ + includes: L.Mixin.Events, + + options: { + opacity: 1, + position: 'front', + f: 'image' + }, + + onAdd: function (map) { + this._map = map; + + this._update = L.Util.limitExecByInterval(this._update, this.options.updateInterval, this); + + if (map.options.crs && map.options.crs.code) { + var sr = map.options.crs.code.split(':')[1]; + this.options.bboxSR = sr; + this.options.imageSR = sr; + } + + map.on('moveend', this._update, this); + + this._update(); + + if(this._popup){ + this._map.on('click', this._getPopupData, this); + this._map.on('dblclick', this._resetPopupState, this); + } + }, + + bindPopup: function(fn, popupOptions){ + this._shouldRenderPopup = false; + this._lastClick = false; + this._popup = L.popup(popupOptions); + this._popupFunction = fn; + if(this._map){ + this._map.on('click', this._getPopupData, this); + this._map.on('dblclick', this._resetPopupState, this); + } + return this; + }, + + unbindPopup: function(){ + if(this._map){ + this._map.closePopup(this._popup); + this._map.off('click', this._getPopupData, this); + this._map.off('dblclick', this._resetPopupState, this); + } + this._popup = false; + return this; + }, + + onRemove: function (map) { + + if (this._currentImage) { + this._map.removeLayer(this._currentImage); + } + + if(this._popup){ + this._map.off('click', this._getPopupData, this); + this._map.off('dblclick', this._resetPopupState, this); + } + + this._map.off('moveend', this._update, this); + this._map = null; + }, + + addTo: function(map){ + map.addLayer(this); + return this; + }, + + removeFrom: function(map){ + map.removeLayer(this); + return this; + }, + + bringToFront: function(){ + this.options.position = 'front'; + if(this._currentImage){ + this._currentImage.bringToFront(); + } + return this; + }, + + bringToBack: function(){ + this.options.position = 'back'; + if(this._currentImage){ + this._currentImage.bringToBack(); + } + return this; + }, + + getAttribution: function () { + return this.options.attribution; + }, + + getOpacity: function(){ + return this.options.opacity; + }, + + setOpacity: function(opacity){ + this.options.opacity = opacity; + this._currentImage.setOpacity(opacity); + return this; + }, + + getTimeRange: function(){ + return [this.options.from, this.options.to]; + }, + + setTimeRange: function(from, to){ + this.options.from = from; + this.options.to = to; + this._update(); + return this; + }, + + metadata: function(callback, context){ + this._service.metadata(callback, context); + return this; + }, + + authenticate: function(token){ + this._service.authenticate(token); + return this; + }, + + _renderImage: function(url, bounds){ + if(this._map){ + var image = new L.ImageOverlay(url, bounds, { + opacity: 0 + }).addTo(this._map); + + image.once('load', function(e){ + var newImage = e.target; + var oldImage = this._currentImage; + if(newImage._bounds.equals(bounds)){ + this._currentImage = newImage; + + if(this.options.position === 'front'){ + this.bringToFront(); + } else { + this.bringToBack(); + } + + if(this._map && this._currentImage._map){ + this._currentImage.setOpacity(this.options.opacity); + } else { + this._currentImage._map.removeLayer(this._currentImage); + } + + if(oldImage){ + this._map.removeLayer(oldImage); + } + + } else { + this._map.removeLayer(newImage); + } + + this.fire('load', { + bounds: bounds + }); + + }, this); + + this.fire('loading', { + bounds: bounds + }); + } + }, + + _update: function () { + if(!this._map){ + return; + } + + var zoom = this._map.getZoom(); + var bounds = this._map.getBounds(); + + if(this._animatingZoom){ + return; + } + + if (this._map._panTransition && this._map._panTransition._inProgress) { + return; + } + + if (zoom > this.options.maxZoom || zoom < this.options.minZoom) { + return; + } + var params = this._buildExportParams(); + + this._requestExport(params, bounds); + }, + + // TODO: refactor these into raster layer + _renderPopup: function(latlng, error, results, response){ + latlng = L.latLng(latlng); + if(this._shouldRenderPopup && this._lastClick.equals(latlng)){ + //add the popup to the map where the mouse was clicked at + var content = this._popupFunction(error, results, response); + if (content) { + this._popup.setLatLng(latlng).setContent(content).openOn(this._map); + } + } + }, + + _resetPopupState: function(e){ + this._shouldRenderPopup = false; + this._lastClick = e.latlng; + }, + + // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js + // @TODO remove at Leaflet 0.8 + _propagateEvent: function (e) { + e = L.extend({ + layer: e.target, + target: this + }, e); + this.fire(e.type, e); + } +}); + +EsriLeaflet.Layers.DynamicMapLayer = EsriLeaflet.Layers.RasterLayer.extend({ + + options: { + updateInterval: 150, + layers: false, + layerDefs: false, + timeOptions: false, + format: 'png24', + transparent: true + }, + + initialize: function (url, options) { + this.url = EsriLeaflet.Util.cleanUrl(url); + this._service = new EsriLeaflet.Services.MapService(this.url, options); + this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', this._propagateEvent, this); + L.Util.setOptions(this, options); + }, + + getLayers: function(){ + return this.options.layers; + }, + + setLayers: function(layers){ + this.options.layers = layers; + this._update(); + return this; + }, + + getLayerDefs: function(){ + return this.options.layerDefs; + }, + + setLayerDefs: function(layerDefs){ + this.options.layerDefs = layerDefs; + this._update(); + return this; + }, + + getTimeOptions: function(){ + return this.options.timeOptions; + }, + + setTimeOptions: function(timeOptions){ + this.options.timeOptions = timeOptions; + this._update(); + return this; + }, + + query: function(){ + return this._service.query(); + }, + + identify: function(){ + return this._service.identify(); + }, + + find: function(){ + return this._service.find(); + }, + + _getPopupData: function(e){ + var callback = L.Util.bind(function(error, featureCollection, response) { + setTimeout(L.Util.bind(function(){ + this._renderPopup(e.latlng, error, featureCollection, response); + }, this), 300); + }, this); + + var identifyRequest = this.identify().on(this._map).at(e.latlng); + + if(this.options.layers){ + identifyRequest.layers('visible:' + this.options.layers.join(',')); + } else { + identifyRequest.layers('visible'); + } + + identifyRequest.run(callback); + + // set the flags to show the popup + this._shouldRenderPopup = true; + this._lastClick = e.latlng; + }, + + _buildExportParams: function () { + var bounds = this._map.getBounds(); + var size = this._map.getSize(); + var ne = this._map.options.crs.project(bounds._northEast); + var sw = this._map.options.crs.project(bounds._southWest); + + var params = { + bbox: [sw.x, sw.y, ne.x, ne.y].join(','), + size: size.x + ',' + size.y, + dpi: 96, + format: this.options.format, + transparent: this.options.transparent, + bboxSR: this.options.bboxSR, + imageSR: this.options.imageSR + }; + + if(this.options.layers){ + params.layers = 'show:' + this.options.layers.join(','); + } + + if(this.options.layerDefs){ + params.layerDefs = JSON.stringify(this.options.layerDefs); + } + + if(this.options.timeOptions){ + params.timeOptions = JSON.stringify(this.options.timeOptions); + } + + if(this.options.from && this.options.to){ + params.time = this.options.from.valueOf() + ',' + this.options.to.valueOf(); + } + + if(this._service.options.token) { + params.token = this._service.options.token; + } + + return params; + }, + + _requestExport: function (params, bounds) { + if(this.options.f === 'json'){ + this._service.get('export', params, function(error, response){ + this._renderImage(response.href, bounds); + }, this); + } else { + params.f = 'image'; + this._renderImage(this.url + 'export' + L.Util.getParamString(params), bounds); + } + } +}); + +EsriLeaflet.DynamicMapLayer = EsriLeaflet.Layers.DynamicMapLayer; + +EsriLeaflet.Layers.dynamicMapLayer = function(url, options){ + return new EsriLeaflet.Layers.DynamicMapLayer(url, options); +}; + +EsriLeaflet.dynamicMapLayer = function(url, options){ + return new EsriLeaflet.Layers.DynamicMapLayer(url, options); +}; + +EsriLeaflet.Layers.TiledMapLayer = L.TileLayer.extend({ + initialize: function(url, options){ + options = L.Util.setOptions(this, options); + + // set the urls + this.url = L.esri.Util.cleanUrl(url); + this.tileUrl = L.esri.Util.cleanUrl(url) + 'tile/{z}/{y}/{x}'; + this._service = new L.esri.Services.MapService(this.url, options); + this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', this._propagateEvent, this); + + //if this is looking at the AGO tiles subdomain insert the subdomain placeholder + if(this.tileUrl.match('://tiles.arcgisonline.com')){ + this.tileUrl = this.tileUrl.replace('://tiles.arcgisonline.com', '://tiles{s}.arcgisonline.com'); + options.subdomains = ['1', '2', '3', '4']; + } + + if(this.options.token) { + this.tileUrl += ('?token=' + this.options.token); + } + + // init layer by calling TileLayers initialize method + L.TileLayer.prototype.initialize.call(this, this.tileUrl, options); + }, + + metadata: function(callback, context){ + this._service.metadata(callback, context); + return this; + }, + + identify: function(){ + return this._service.identify(); + }, + + authenticate: function(token){ + var tokenQs = '?token=' + token; + this.tileUrl = (this.options.token) ? this.tileUrl.replace(/\?token=(.+)/g, tokenQs) : this.tileUrl + tokenQs; + this.options.token = token; + this._service.authenticate(token); + return this; + }, + + // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js + // @TODO remove at Leaflet 0.8 + _propagateEvent: function (e) { + e = L.extend({ + layer: e.target, + target: this + }, e); + this.fire(e.type, e); + } +}); + +L.esri.TiledMapLayer = L.esri.Layers.tiledMapLayer; + +L.esri.Layers.tiledMapLayer = function(url, options){ + return new L.esri.Layers.TiledMapLayer(url, options); +}; + +L.esri.tiledMapLayer = function(url, options){ + return new L.esri.Layers.TiledMapLayer(url, options); +}; + + return EsriLeaflet; +})); +//# sourceMappingURL=esri-leaflet-map-service-src.js.map \ No newline at end of file diff --git a/dist/builds/map-service/esri-leaflet-map-service-src.js.map b/dist/builds/map-service/esri-leaflet-map-service-src.js.map new file mode 100644 index 000000000..6898f9ef1 --- /dev/null +++ b/dist/builds/map-service/esri-leaflet-map-service-src.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/EsriLeaflet.js","../../../src/Util.js","../../../src/Request.js","../../../src/Services/Service.js","../../../src/Services/MapService.js","../../../src/Tasks/Task.js","../../../src/Tasks/Identify.js","../../../src/Tasks/IdentifyFeatures.js","../../../src/Tasks/Query.js","../../../src/Tasks/Find.js","../../../src/Layers/RasterLayer.js","../../../src/Layers/DynamicMapLayer.js","../../../src/Layers/TiledMapLayer.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,GAAG,CAAC,WAAW,OAAO,MAAM,CAAC,MAAM,C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AI,CAAC,MAAM,CAAC,aAAa,GAAG,QAAQ,CAAC,GAAG,EAAE,OAAO;AAAA,EACjD,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO;AAAA;AAAA;AAGrD,CAAC,CAAC,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC,GAAG,EAAE,OAAO;AAAA,EAC1C,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO;AAAA,E","file":"esri-leaflet-map-service-src.js","sourcesContent":["var EsriLeaflet = { //jshint ignore:line\n VERSION: '1.0.0-rc.2',\n Layers: {},\n Services: {},\n Controls: {},\n Tasks: {},\n Util: {},\n Support: {\n CORS: !!(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()),\n pointerEvents: document.documentElement.style.pointerEvents === ''\n }\n};\n\nif(typeof window !== 'undefined' && window.L){\n window.L.esri = EsriLeaflet;\n}","(function(EsriLeaflet){\n\n // shallow object clone for feature properties and attributes\n // from http://jsperf.com/cloning-an-object/2\n function clone(obj) {\n var target = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n target[i] = obj[i];\n }\n }\n return target;\n }\n\n // checks if 2 x,y points are equal\n function pointsEqual(a, b) {\n for (var i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n }\n\n // checks if the first and last points of a ring are equal and closes the ring\n function closeRing(coordinates) {\n if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) {\n coordinates.push(coordinates[0]);\n }\n return coordinates;\n }\n\n // determine if polygon ring coordinates are clockwise. clockwise signifies outer ring, counter-clockwise an inner ring\n // or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-\n // points-are-in-clockwise-order\n function ringIsClockwise(ringToTest) {\n var total = 0,i = 0;\n var rLength = ringToTest.length;\n var pt1 = ringToTest[i];\n var pt2;\n for (i; i < rLength - 1; i++) {\n pt2 = ringToTest[i + 1];\n total += (pt2[0] - pt1[0]) * (pt2[1] + pt1[1]);\n pt1 = pt2;\n }\n return (total >= 0);\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L504-L519\n function vertexIntersectsVertex(a1, a2, b1, b2) {\n var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]);\n var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]);\n var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]);\n\n if ( uB !== 0 ) {\n var ua = uaT / uB;\n var ub = ubT / uB;\n\n if ( 0 <= ua && ua <= 1 && 0 <= ub && ub <= 1 ) {\n return true;\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L521-L531\n function arrayIntersectsArray(a, b) {\n for (var i = 0; i < a.length - 1; i++) {\n for (var j = 0; j < b.length - 1; j++) {\n if (vertexIntersectsVertex(a[i], a[i + 1], b[j], b[j + 1])) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L470-L480\n function coordinatesContainPoint(coordinates, point) {\n var contains = false;\n for(var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) {\n if (((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1]) ||\n (coordinates[j][1] <= point[1] && point[1] < coordinates[i][1])) &&\n (point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0])) {\n contains = !contains;\n }\n }\n return contains;\n }\n\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L106-L113\n function coordinatesContainCoordinates(outer, inner){\n var intersects = arrayIntersectsArray(outer, inner);\n var contains = coordinatesContainPoint(outer, inner[0]);\n if(!intersects && contains){\n return true;\n }\n return false;\n }\n\n // do any polygons in this array contain any other polygons in this array?\n // used for checking for holes in arcgis rings\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L117-L172\n function convertRingsToGeoJSON(rings){\n var outerRings = [];\n var holes = [];\n var x; // iterator\n var outerRing; // current outer ring being evaluated\n var hole; // current hole being evaluated\n\n // for each ring\n for (var r = 0; r < rings.length; r++) {\n var ring = closeRing(rings[r].slice(0));\n if(ring.length < 4){\n continue;\n }\n // is this ring an outer ring? is it clockwise?\n if(ringIsClockwise(ring)){\n var polygon = [ ring ];\n outerRings.push(polygon); // push to outer rings\n } else {\n holes.push(ring); // counterclockwise push to holes\n }\n }\n\n var uncontainedHoles = [];\n\n // while there are holes left...\n while(holes.length){\n // pop a hole off out stack\n hole = holes.pop();\n\n // loop over all outer rings and see if they contain our hole.\n var contained = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(coordinatesContainCoordinates(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n contained = true;\n break;\n }\n }\n\n // ring is not contained in any outer ring\n // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320\n if(!contained){\n uncontainedHoles.push(hole);\n }\n }\n\n // if we couldn't match any holes using contains we can try intersects...\n while(uncontainedHoles.length){\n // pop a hole off out stack\n hole = uncontainedHoles.pop();\n\n // loop over all outer rings and see if any intersect our hole.\n var intersects = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(arrayIntersectsArray(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n intersects = true;\n break;\n }\n }\n\n if(!intersects) {\n outerRings.push([hole.reverse()]);\n }\n }\n\n if(outerRings.length === 1){\n return {\n type: 'Polygon',\n coordinates: outerRings[0]\n };\n } else {\n return {\n type: 'MultiPolygon',\n coordinates: outerRings\n };\n }\n }\n\n // This function ensures that rings are oriented in the right directions\n // outer rings are clockwise, holes are counterclockwise\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function orientRings(poly){\n var output = [];\n var polygon = poly.slice(0);\n var outerRing = closeRing(polygon.shift().slice(0));\n if(outerRing.length >= 4){\n if(!ringIsClockwise(outerRing)){\n outerRing.reverse();\n }\n\n output.push(outerRing);\n\n for (var i = 0; i < polygon.length; i++) {\n var hole = closeRing(polygon[i].slice(0));\n if(hole.length >= 4){\n if(ringIsClockwise(hole)){\n hole.reverse();\n }\n output.push(hole);\n }\n }\n }\n\n return output;\n }\n\n // This function flattens holes in multipolygons to one array of polygons\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function flattenMultiPolygonRings(rings){\n var output = [];\n for (var i = 0; i < rings.length; i++) {\n var polygon = orientRings(rings[i]);\n for (var x = polygon.length - 1; x >= 0; x--) {\n var ring = polygon[x].slice(0);\n output.push(ring);\n }\n }\n return output;\n }\n\n // convert an extent (ArcGIS) to LatLngBounds (Leaflet)\n EsriLeaflet.Util.extentToBounds = function(extent){\n var sw = new L.LatLng(extent.ymin, extent.xmin);\n var ne = new L.LatLng(extent.ymax, extent.xmax);\n return new L.LatLngBounds(sw, ne);\n };\n\n // convert an LatLngBounds (Leaflet) to extent (ArcGIS)\n EsriLeaflet.Util.boundsToExtent = function(bounds) {\n bounds = L.latLngBounds(bounds);\n return {\n 'xmin': bounds.getSouthWest().lng,\n 'ymin': bounds.getSouthWest().lat,\n 'xmax': bounds.getNorthEast().lng,\n 'ymax': bounds.getNorthEast().lat,\n 'spatialReference': {\n 'wkid' : 4326\n }\n };\n };\n\n EsriLeaflet.Util.arcgisToGeojson = function (arcgis, idAttribute){\n var geojson = {};\n\n if(typeof arcgis.x === 'number' && typeof arcgis.y === 'number'){\n geojson.type = 'Point';\n geojson.coordinates = [arcgis.x, arcgis.y];\n }\n\n if(arcgis.points){\n geojson.type = 'MultiPoint';\n geojson.coordinates = arcgis.points.slice(0);\n }\n\n if(arcgis.paths) {\n if(arcgis.paths.length === 1){\n geojson.type = 'LineString';\n geojson.coordinates = arcgis.paths[0].slice(0);\n } else {\n geojson.type = 'MultiLineString';\n geojson.coordinates = arcgis.paths.slice(0);\n }\n }\n\n if(arcgis.rings) {\n geojson = convertRingsToGeoJSON(arcgis.rings.slice(0));\n }\n\n if(arcgis.geometry || arcgis.attributes) {\n geojson.type = 'Feature';\n geojson.geometry = (arcgis.geometry) ? EsriLeaflet.Util.arcgisToGeojson(arcgis.geometry) : null;\n geojson.properties = (arcgis.attributes) ? clone(arcgis.attributes) : null;\n if(arcgis.attributes) {\n geojson.id = arcgis.attributes[idAttribute] || arcgis.attributes.OBJECTID || arcgis.attributes.FID;\n }\n }\n\n return geojson;\n };\n\n // GeoJSON -> ArcGIS\n EsriLeaflet.Util.geojsonToArcGIS = function(geojson, idAttribute){\n idAttribute = idAttribute || 'OBJECTID';\n var spatialReference = { wkid: 4326 };\n var result = {};\n var i;\n\n switch(geojson.type){\n case 'Point':\n result.x = geojson.coordinates[0];\n result.y = geojson.coordinates[1];\n result.spatialReference = spatialReference;\n break;\n case 'MultiPoint':\n result.points = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'LineString':\n result.paths = [geojson.coordinates.slice(0)];\n result.spatialReference = spatialReference;\n break;\n case 'MultiLineString':\n result.paths = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'Polygon':\n result.rings = orientRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'MultiPolygon':\n result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'Feature':\n if(geojson.geometry) {\n result.geometry = EsriLeaflet.Util.geojsonToArcGIS(geojson.geometry, idAttribute);\n }\n result.attributes = (geojson.properties) ? clone(geojson.properties) : {};\n if(geojson.id){\n result.attributes[idAttribute] = geojson.id;\n }\n break;\n case 'FeatureCollection':\n result = [];\n for (i = 0; i < geojson.features.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.features[i], idAttribute));\n }\n break;\n case 'GeometryCollection':\n result = [];\n for (i = 0; i < geojson.geometries.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.geometries[i], idAttribute));\n }\n break;\n }\n\n return result;\n };\n\n EsriLeaflet.Util.responseToFeatureCollection = function(response, idAttribute){\n var objectIdField;\n\n if(idAttribute){\n objectIdField = idAttribute;\n } else if(response.objectIdFieldName){\n objectIdField = response.objectIdFieldName;\n } else if(response.fields) {\n for (var j = 0; j <= response.fields.length - 1; j++) {\n if(response.fields[j].type === 'esriFieldTypeOID') {\n objectIdField = response.fields[j].name;\n break;\n }\n }\n } else {\n objectIdField = 'OBJECTID';\n }\n\n var featureCollection = {\n type: 'FeatureCollection',\n features: []\n };\n var features = response.features || response.results;\n if(features.length){\n for (var i = features.length - 1; i >= 0; i--) {\n featureCollection.features.push(EsriLeaflet.Util.arcgisToGeojson(features[i], objectIdField));\n }\n }\n\n return featureCollection;\n };\n\n // trim whitespace and add a tailing slash is needed to a url\n EsriLeaflet.Util.cleanUrl = function(url){\n url = url.replace(/\\s\\s*/g, '');\n\n //add a trailing slash to the url if the user omitted it\n if(url[url.length-1] !== '/'){\n url += '/';\n }\n\n return url;\n };\n\n EsriLeaflet.Util.geojsonTypeToArcGIS = function (geoJsonType) {\n var arcgisGeometryType;\n switch (geoJsonType) {\n case 'Point':\n arcgisGeometryType = 'esriGeometryPoint';\n break;\n case 'MultiPoint':\n arcgisGeometryType = 'esriGeometryMultipoint';\n break;\n case 'LineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'MultiLineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'Polygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n case 'MultiPolygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n }\n return arcgisGeometryType;\n };\n\n})(EsriLeaflet);","(function(EsriLeaflet){\n\n var callbacks = 0;\n\n window._EsriLeafletCallbacks = {};\n\n function serialize(params){\n var data = '';\n\n params.f = 'json';\n\n for (var key in params){\n if(params.hasOwnProperty(key)){\n var param = params[key];\n var type = Object.prototype.toString.call(param);\n var value;\n\n if(data.length){\n data += '&';\n }\n\n if(type === '[object Array]' || type === '[object Object]'){\n value = JSON.stringify(param);\n } else if (type === '[object Date]'){\n value = param.valueOf();\n } else {\n value = param;\n }\n\n data += encodeURIComponent(key) + '=' + encodeURIComponent(value);\n }\n }\n\n return data;\n }\n\n function createRequest(callback, context){\n var httpRequest = new XMLHttpRequest();\n\n httpRequest.onerror = function(e) {\n callback.call(context, {\n error: {\n code: 500,\n message: 'XMLHttpRequest error'\n }\n }, null);\n };\n\n httpRequest.onreadystatechange = function(){\n var response;\n var error;\n\n if (httpRequest.readyState === 4) {\n try {\n response = JSON.parse(httpRequest.responseText);\n } catch(e) {\n response = null;\n error = {\n code: 500,\n message: 'Could not parse response as JSON.'\n };\n }\n\n if (!error && response.error) {\n error = response.error;\n response = null;\n }\n\n callback.call(context, error, response);\n }\n };\n\n return httpRequest;\n }\n\n // AJAX handlers for CORS (modern browsers) or JSONP (older browsers)\n EsriLeaflet.Request = {\n request: function(url, params, callback, context){\n var paramString = serialize(params);\n var httpRequest = createRequest(callback, context);\n var requestLength = (url + '?' + paramString).length;\n\n // request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest\n if(requestLength <= 2000 && L.esri.Support.CORS){\n httpRequest.open('GET', url + '?' + paramString);\n httpRequest.send(null);\n\n // request is less more then 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest\n } else if (requestLength > 2000 && L.esri.Support.CORS){\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(paramString);\n\n // request is less more then 2000 characters and the browser does not support CORS, make a JSONP request\n } else if(requestLength <= 2000 && !L.esri.Support.CORS){\n return L.esri.Request.get.JSONP(url, params, callback, context);\n\n // request is longer then 2000 characters and the browser does not support CORS, log a warning\n } else {\n if(console && console.warn){\n console.warn('a request to ' + url + ' 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');\n return;\n }\n }\n\n return httpRequest;\n },\n post: {\n XMLHTTP: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(serialize(params));\n\n return httpRequest;\n }\n },\n\n get: {\n CORS: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n\n httpRequest.open('GET', url + '?' + serialize(params), true);\n httpRequest.send(null);\n\n return httpRequest;\n },\n JSONP: function(url, params, callback, context){\n var callbackId = 'c' + callbacks;\n\n params.callback = 'window._EsriLeafletCallbacks.' + callbackId;\n\n var script = L.DomUtil.create('script', null, document.body);\n script.type = 'text/javascript';\n script.src = url + '?' + serialize(params);\n script.id = callbackId;\n\n window._EsriLeafletCallbacks[callbackId] = function(response){\n if(window._EsriLeafletCallbacks[callbackId] !== true){\n var error;\n var responseType = Object.prototype.toString.call(response);\n\n if(!(responseType === '[object Object]' || responseType === '[object Array]')){\n error = {\n error: {\n code: 500,\n message: 'Expected array or object as JSONP response'\n }\n };\n response = null;\n }\n\n if (!error && response.error) {\n error = response;\n response = null;\n }\n\n callback.call(context, error, response);\n window._EsriLeafletCallbacks[callbackId] = true;\n }\n };\n\n callbacks++;\n\n return {\n id: callbackId,\n url: script.src,\n abort: function(){\n window._EsriLeafletCallbacks._callback[callbackId]({\n code: 0,\n message: 'Request aborted.'\n });\n }\n };\n }\n }\n };\n\n // Choose the correct AJAX handler depending on CORS support\n EsriLeaflet.get = (EsriLeaflet.Support.CORS) ? EsriLeaflet.Request.get.CORS : EsriLeaflet.Request.get.JSONP;\n\n // Always use XMLHttpRequest for posts\n EsriLeaflet.post = EsriLeaflet.Request.post.XMLHTTP;\n\n // expose a common request method the uses GET\\POST based on request length\n EsriLeaflet.request = EsriLeaflet.Request.request;\n\n})(EsriLeaflet);","EsriLeaflet.Services.Service = L.Class.extend({\n\n includes: L.Mixin.Events,\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n initialize: function (url, options) {\n this.url = EsriLeaflet.Util.cleanUrl(url);\n this._requestQueue = [];\n this._authenticating = false;\n L.Util.setOptions(this, options);\n },\n\n get: function (path, params, callback, context) {\n return this._request('get', path, params, callback, context);\n },\n\n post: function (path, params, callback, context) {\n return this._request('post', path, params, callback, context);\n },\n\n request: function (path, params, callback, context) {\n return this._request('request', path, params, callback, context);\n },\n\n metadata: function (callback, context) {\n return this._request('get', '', {}, callback, context);\n },\n\n authenticate: function(token){\n this._authenticating = false;\n this.options.token = token;\n this._runQueue();\n return this;\n },\n\n _request: function(method, path, params, callback, context){\n this.fire('requeststart', {\n url: this.url + path,\n params: params,\n method: method\n });\n\n var wrappedCallback = this._createServiceCallback(method, path, params, callback, context);\n\n if (this.options.token) {\n params.token = this.options.token;\n }\n\n if (this._authenticating) {\n this._requestQueue.push([method, path, params, callback, context]);\n return;\n } else {\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, wrappedCallback);\n } else {\n return EsriLeaflet[method](url, params, wrappedCallback);\n }\n }\n },\n\n _createServiceCallback: function(method, path, params, callback, context){\n var request = [method, path, params, callback, context];\n\n return L.Util.bind(function(error, response){\n\n if (error && (error.code === 499 || error.code === 498)) {\n this._authenticating = true;\n\n this._requestQueue.push(request);\n\n this.fire('authenticationrequired', {\n authenticate: L.Util.bind(this.authenticate, this)\n });\n } else {\n callback.call(context, error, response);\n\n if(error) {\n this.fire('requesterror', {\n url: this.url + path,\n params: params,\n message: error.message,\n code: error.code,\n method: method\n });\n } else {\n this.fire('requestsuccess', {\n url: this.url + path,\n params: params,\n response: response,\n method: method\n });\n }\n\n this.fire('requestend', {\n url: this.url + path,\n params: params,\n method: method\n });\n }\n }, this);\n },\n\n _runQueue: function(){\n for (var i = this._requestQueue.length - 1; i >= 0; i--) {\n var request = this._requestQueue[i];\n var method = request.shift();\n this[method].apply(this, request);\n }\n this._requestQueue = [];\n }\n\n});\n\nEsriLeaflet.Services.service = function(url, params){\n return new EsriLeaflet.Services.Service(url, params);\n};","EsriLeaflet.Services.MapService = EsriLeaflet.Services.Service.extend({\n\n identify: function () {\n return new EsriLeaflet.Tasks.identifyFeatures(this);\n },\n\n find: function () {\n return new EsriLeaflet.Tasks.Find(this);\n },\n\n query: function () {\n return new EsriLeaflet.Tasks.Query(this);\n }\n\n});\n\nEsriLeaflet.Services.mapService = function(url, params){\n return new EsriLeaflet.Services.MapService(url, params);\n};","EsriLeaflet.Tasks.Task = L.Class.extend({\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n //Generate a method for each methodName:paramName in the setters for this task.\n generateSetter: function(param, context){\n var isArray = param.match(/([a-zA-Z]+)\\[\\]/);\n\n param = (isArray) ? isArray[1] : param;\n\n if(isArray){\n return L.Util.bind(function(value){\n // this.params[param] = (this.params[param]) ? this.params[param] + ',' : '';\n if (L.Util.isArray(value)) {\n this.params[param] = value.join(',');\n } else {\n this.params[param] = value;\n }\n return this;\n }, context);\n } else {\n return L.Util.bind(function(value){\n this.params[param] = value;\n return this;\n }, context);\n }\n },\n\n initialize: function(endpoint, options){\n // endpoint can be either a url to an ArcGIS Rest Service or an instance of EsriLeaflet.Service\n if(endpoint.url && endpoint.request){\n this._service = endpoint;\n this.url = endpoint.url;\n } else {\n this.url = EsriLeaflet.Util.cleanUrl(endpoint);\n }\n\n // clone default params into this object\n this.params = L.Util.extend({}, this.params || {});\n\n // generate setter methods based on the setters object implimented a child class\n if(this.setters){\n for (var setter in this.setters){\n var param = this.setters[setter];\n this[setter] = this.generateSetter(param, this);\n }\n }\n\n L.Util.setOptions(this, options);\n },\n\n token: function(token){\n if(this._service){\n this._service.authenticate(token);\n } else {\n this.params.token = token;\n }\n return this;\n },\n\n request: function(callback, context){\n if(this._service){\n return this._service.request(this.path, this.params, callback, context);\n } else {\n return this._request('request', this.path, this.params, callback, context);\n }\n },\n\n _request: function(method, path, params, callback, context){\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, callback, context);\n } else{\n return EsriLeaflet[method](url, params, callback, context);\n }\n }\n});","EsriLeaflet.Tasks.Identify = EsriLeaflet.Tasks.Task.extend({\n path: 'identify',\n\n between: function(start, end){\n this.params.time = ([start.valueOf(), end.valueOf()]).join(',');\n return this;\n },\n\n returnGeometry: function (returnGeometry) {\n this.params.returnGeometry = returnGeometry;\n return this;\n }\n});\n","EsriLeaflet.Tasks.IdentifyFeatures = EsriLeaflet.Tasks.Identify.extend({\n setters: {\n 'layers': 'layers',\n 'precision': 'geometryPrecision',\n 'tolerance': 'tolerance'\n },\n\n params: {\n sr: 4326,\n layers: 'all',\n tolerance: 3,\n returnGeometry: true\n },\n\n on: function(map){\n var extent = EsriLeaflet.Util.boundsToExtent(map.getBounds());\n var size = map.getSize();\n this.params.imageDisplay = [size.x, size.y, 96].join(',');\n this.params.mapExtent=([extent.xmin, extent.ymin, extent.xmax, extent.ymax]).join(',');\n return this;\n },\n\n at: function(latlng){\n latlng = L.latLng(latlng);\n this.params.geometry = ([latlng.lng, latlng.lat]).join(',');\n this.params.geometryType = 'esriGeometryPoint';\n return this;\n },\n\n layerDef: function (id, where){\n this.params.layerDefs = (this.params.layerDefs) ? this.params.layerDefs + ';' : '';\n this.params.layerDefs += ([id, where]).join(':');\n return this;\n },\n\n simplify: function(map, factor){\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * (1 - factor);\n return this;\n },\n\n run: function (callback, context){\n return this.request(function(error, response){\n callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response);\n }, context);\n }\n\n});\n\nEsriLeaflet.Tasks.identifyFeatures = function(url, params){\n return new EsriLeaflet.Tasks.IdentifyFeatures(url, params);\n};","EsriLeaflet.Tasks.Query = EsriLeaflet.Tasks.Task.extend({\n setters: {\n 'offset': 'offset',\n 'limit': 'limit',\n 'outFields': 'fields[]',\n 'precision': 'geometryPrecision',\n 'featureIds': 'objectIds[]',\n 'returnGeometry': 'returnGeometry',\n 'token': 'token'\n },\n\n path: 'query',\n\n params: {\n returnGeometry: true,\n where: '1=1',\n outSr: 4326,\n outFields: '*'\n },\n\n within: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelContains'; // will make code read layer within geometry, to the api this will reads geometry contains layer\n return this;\n },\n\n intersects: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelIntersects';\n return this;\n },\n\n contains: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelWithin'; // will make code read layer contains geometry, to the api this will reads geometry within layer\n return this;\n },\n\n // crosses: function(geometry){\n // this._setGeometry(geometry);\n // this.params.spatialRel = 'esriSpatialRelCrosses';\n // return this;\n // },\n\n // touches: function(geometry){\n // this._setGeometry(geometry);\n // this.params.spatialRel = 'esriSpatialRelTouches';\n // return this;\n // },\n\n overlaps: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelOverlaps';\n return this;\n },\n\n // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online\n nearby: function(latlng, radius){\n latlng = L.latLng(latlng);\n this.params.geometry = ([latlng.lng,latlng.lat]).join(',');\n this.params.geometryType = 'esriGeometryPoint';\n this.params.spatialRel = 'esriSpatialRelIntersects';\n this.params.units = 'esriSRUnit_Meter';\n this.params.distance = radius;\n this.params.inSr = 4326;\n return this;\n },\n\n where: function(string){\n this.params.where = string.replace(/\"/g, \"\\'\"); // jshint ignore:line\n return this;\n },\n\n between: function(start, end){\n this.params.time = ([start.valueOf(), end.valueOf()]).join();\n return this;\n },\n\n fields: function (fields) {\n if (L.Util.isArray(fields)) {\n this.params.outFields = fields.join(',');\n } else {\n this.params.outFields = fields;\n }\n return this;\n },\n\n simplify: function(map, factor){\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\n return this;\n },\n\n orderBy: function(fieldName, order){\n order = order || 'ASC';\n this.params.orderByFields = (this.params.orderByFields) ? this.params.orderByFields + ',' : '';\n this.params.orderByFields += ([fieldName, order]).join(' ');\n return this;\n },\n\n returnGeometry: function(bool){\n this.params.returnGeometry = bool;\n return this;\n },\n\n run: function(callback, context){\n this._cleanParams();\n return this.request(function(error, response){\n callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response);\n }, context);\n },\n\n count: function(callback, context){\n this._cleanParams();\n this.params.returnCountOnly = true;\n return this.request(function(error, response){\n callback.call(this, error, (response && response.count), response);\n }, context);\n },\n\n ids: function(callback, context){\n this._cleanParams();\n this.params.returnIdsOnly = true;\n return this.request(function(error, response){\n callback.call(this, error, (response && response.objectIds), response);\n }, context);\n },\n\n // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online\n bounds: function(callback, context){\n this._cleanParams();\n this.params.returnExtentOnly = true;\n return this.request(function(error, response){\n callback.call(context, error, (response && response.extent && EsriLeaflet.Util.extentToBounds(response.extent)), response);\n }, context);\n },\n\n // only valid for image services\n pixelSize: function(point){\n point = L.point(point);\n this.params.pixelSize = ([point.x,point.y]).join(',');\n return this;\n },\n\n // only valid for map services\n layer: function(layer){\n this.path = layer + '/query';\n return this;\n },\n\n _cleanParams: function(){\n delete this.params.returnIdsOnly;\n delete this.params.returnExtentOnly;\n delete this.params.returnCountOnly;\n },\n\n _setGeometry: function(geometry) {\n this.params.inSr = 4326;\n\n // convert bounds to extent and finish\n if ( geometry instanceof L.LatLngBounds ) {\n // set geometry + geometryType\n this.params.geometry = EsriLeaflet.Util.boundsToExtent(geometry);\n this.params.geometryType = 'esriGeometryEnvelope';\n return;\n }\n\n // convert L.Marker > L.LatLng\n if(geometry.getLatLng){\n geometry = geometry.getLatLng();\n }\n\n // convert L.LatLng to a geojson point and continue;\n if (geometry instanceof L.LatLng) {\n geometry = {\n type: 'Point',\n coordinates: [geometry.lng, geometry.lat]\n };\n }\n\n // handle L.GeoJSON, pull out the first geometry\n if ( geometry instanceof L.GeoJSON ) {\n //reassign geometry to the GeoJSON value (we are assuming that only one feature is present)\n geometry = geometry.getLayers()[0].feature.geometry;\n this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry);\n this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type);\n }\n\n // Handle L.Polyline and L.Polygon\n if (geometry.toGeoJSON) {\n geometry = geometry.toGeoJSON();\n }\n\n // handle GeoJSON feature by pulling out the geometry\n if ( geometry.type === 'Feature' ) {\n // get the geometry of the geojson feature\n geometry = geometry.geometry;\n }\n\n // confirm that our GeoJSON is a point, line or polygon\n if ( geometry.type === 'Point' || geometry.type === 'LineString' || geometry.type === 'Polygon') {\n this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry);\n this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type);\n return;\n }\n\n // warn the user if we havn't found a\n /* global console */\n if(console && console.warn) {\n console.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');\n }\n\n return;\n }\n});\n\nEsriLeaflet.Tasks.query = function(url, params){\n return new EsriLeaflet.Tasks.Query(url, params);\n};","EsriLeaflet.Tasks.Find = EsriLeaflet.Tasks.Task.extend({\n setters: {\n // method name > param name\n 'contains': 'contains',\n 'text': 'searchText',\n 'fields': 'searchFields[]', // denote an array or single string\n 'spatialReference': 'sr',\n 'sr': 'sr',\n 'layers': 'layers[]',\n 'returnGeometry': 'returnGeometry',\n 'maxAllowableOffset': 'maxAllowableOffset',\n 'precision': 'geometryPrecision',\n 'dynamicLayers': 'dynamicLayers',\n 'returnZ' : 'returnZ',\n 'returnM' : 'returnM',\n 'gdbVersion' : 'gdbVersion',\n 'token' : 'token'\n },\n\n path: 'find',\n\n params: {\n sr: 4326,\n contains: true,\n returnGeometry: true,\n returnZ: true,\n returnM: false\n },\n\n layerDefs: function (id, where) {\n this.params.layerDefs = (this.params.layerDefs) ? this.params.layerDefs + ';' : '';\n this.params.layerDefs += ([id, where]).join(':');\n return this;\n },\n\n simplify: function(map, factor){\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\n return this;\n },\n\n run: function (callback, context) {\n return this.request(function(error, response){\n callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response);\n }, context);\n }\n});\n\nEsriLeaflet.Tasks.find = function (url, params) {\n return new EsriLeaflet.Tasks.Find(url, params);\n};","EsriLeaflet.Layers.RasterLayer = L.Class.extend({\n includes: L.Mixin.Events,\n\n options: {\n opacity: 1,\n position: 'front',\n f: 'image'\n },\n\n onAdd: function (map) {\n this._map = map;\n\n this._update = L.Util.limitExecByInterval(this._update, this.options.updateInterval, this);\n\n if (map.options.crs && map.options.crs.code) {\n var sr = map.options.crs.code.split(':')[1];\n this.options.bboxSR = sr;\n this.options.imageSR = sr;\n }\n\n map.on('moveend', this._update, this);\n\n this._update();\n\n if(this._popup){\n this._map.on('click', this._getPopupData, this);\n this._map.on('dblclick', this._resetPopupState, this);\n }\n },\n\n bindPopup: function(fn, popupOptions){\n this._shouldRenderPopup = false;\n this._lastClick = false;\n this._popup = L.popup(popupOptions);\n this._popupFunction = fn;\n if(this._map){\n this._map.on('click', this._getPopupData, this);\n this._map.on('dblclick', this._resetPopupState, this);\n }\n return this;\n },\n\n unbindPopup: function(){\n if(this._map){\n this._map.closePopup(this._popup);\n this._map.off('click', this._getPopupData, this);\n this._map.off('dblclick', this._resetPopupState, this);\n }\n this._popup = false;\n return this;\n },\n\n onRemove: function (map) {\n\n if (this._currentImage) {\n this._map.removeLayer(this._currentImage);\n }\n\n if(this._popup){\n this._map.off('click', this._getPopupData, this);\n this._map.off('dblclick', this._resetPopupState, this);\n }\n\n this._map.off('moveend', this._update, this);\n this._map = null;\n },\n\n addTo: function(map){\n map.addLayer(this);\n return this;\n },\n\n removeFrom: function(map){\n map.removeLayer(this);\n return this;\n },\n\n bringToFront: function(){\n this.options.position = 'front';\n if(this._currentImage){\n this._currentImage.bringToFront();\n }\n return this;\n },\n\n bringToBack: function(){\n this.options.position = 'back';\n if(this._currentImage){\n this._currentImage.bringToBack();\n }\n return this;\n },\n\n getAttribution: function () {\n return this.options.attribution;\n },\n\n getOpacity: function(){\n return this.options.opacity;\n },\n\n setOpacity: function(opacity){\n this.options.opacity = opacity;\n this._currentImage.setOpacity(opacity);\n return this;\n },\n\n getTimeRange: function(){\n return [this.options.from, this.options.to];\n },\n\n setTimeRange: function(from, to){\n this.options.from = from;\n this.options.to = to;\n this._update();\n return this;\n },\n\n metadata: function(callback, context){\n this._service.metadata(callback, context);\n return this;\n },\n\n authenticate: function(token){\n this._service.authenticate(token);\n return this;\n },\n\n _renderImage: function(url, bounds){\n if(this._map){\n var image = new L.ImageOverlay(url, bounds, {\n opacity: 0\n }).addTo(this._map);\n\n image.once('load', function(e){\n var newImage = e.target;\n var oldImage = this._currentImage;\n if(newImage._bounds.equals(bounds)){\n this._currentImage = newImage;\n\n if(this.options.position === 'front'){\n this.bringToFront();\n } else {\n this.bringToBack();\n }\n\n if(this._map && this._currentImage._map){\n this._currentImage.setOpacity(this.options.opacity);\n } else {\n this._currentImage._map.removeLayer(this._currentImage);\n }\n\n if(oldImage){\n this._map.removeLayer(oldImage);\n }\n\n } else {\n this._map.removeLayer(newImage);\n }\n\n this.fire('load', {\n bounds: bounds\n });\n\n }, this);\n\n this.fire('loading', {\n bounds: bounds\n });\n }\n },\n\n _update: function () {\n if(!this._map){\n return;\n }\n\n var zoom = this._map.getZoom();\n var bounds = this._map.getBounds();\n\n if(this._animatingZoom){\n return;\n }\n\n if (this._map._panTransition && this._map._panTransition._inProgress) {\n return;\n }\n\n if (zoom > this.options.maxZoom || zoom < this.options.minZoom) {\n return;\n }\n var params = this._buildExportParams();\n\n this._requestExport(params, bounds);\n },\n\n // TODO: refactor these into raster layer\n _renderPopup: function(latlng, error, results, response){\n latlng = L.latLng(latlng);\n if(this._shouldRenderPopup && this._lastClick.equals(latlng)){\n //add the popup to the map where the mouse was clicked at\n var content = this._popupFunction(error, results, response);\n if (content) {\n this._popup.setLatLng(latlng).setContent(content).openOn(this._map);\n }\n }\n },\n\n _resetPopupState: function(e){\n this._shouldRenderPopup = false;\n this._lastClick = e.latlng;\n },\n\n // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js\n // @TODO remove at Leaflet 0.8\n _propagateEvent: function (e) {\n e = L.extend({\n layer: e.target,\n target: this\n }, e);\n this.fire(e.type, e);\n }\n});","EsriLeaflet.Layers.DynamicMapLayer = EsriLeaflet.Layers.RasterLayer.extend({\n\n options: {\n updateInterval: 150,\n layers: false,\n layerDefs: false,\n timeOptions: false,\n format: 'png24',\n transparent: true\n },\n\n initialize: function (url, options) {\n this.url = EsriLeaflet.Util.cleanUrl(url);\n this._service = new EsriLeaflet.Services.MapService(this.url, options);\n this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', this._propagateEvent, this);\n L.Util.setOptions(this, options);\n },\n\n getLayers: function(){\n return this.options.layers;\n },\n\n setLayers: function(layers){\n this.options.layers = layers;\n this._update();\n return this;\n },\n\n getLayerDefs: function(){\n return this.options.layerDefs;\n },\n\n setLayerDefs: function(layerDefs){\n this.options.layerDefs = layerDefs;\n this._update();\n return this;\n },\n\n getTimeOptions: function(){\n return this.options.timeOptions;\n },\n\n setTimeOptions: function(timeOptions){\n this.options.timeOptions = timeOptions;\n this._update();\n return this;\n },\n\n query: function(){\n return this._service.query();\n },\n\n identify: function(){\n return this._service.identify();\n },\n\n find: function(){\n return this._service.find();\n },\n\n _getPopupData: function(e){\n var callback = L.Util.bind(function(error, featureCollection, response) {\n setTimeout(L.Util.bind(function(){\n this._renderPopup(e.latlng, error, featureCollection, response);\n }, this), 300);\n }, this);\n\n var identifyRequest = this.identify().on(this._map).at(e.latlng);\n\n if(this.options.layers){\n identifyRequest.layers('visible:' + this.options.layers.join(','));\n } else {\n identifyRequest.layers('visible');\n }\n\n identifyRequest.run(callback);\n\n // set the flags to show the popup\n this._shouldRenderPopup = true;\n this._lastClick = e.latlng;\n },\n\n _buildExportParams: function () {\n var bounds = this._map.getBounds();\n var size = this._map.getSize();\n var ne = this._map.options.crs.project(bounds._northEast);\n var sw = this._map.options.crs.project(bounds._southWest);\n\n var params = {\n bbox: [sw.x, sw.y, ne.x, ne.y].join(','),\n size: size.x + ',' + size.y,\n dpi: 96,\n format: this.options.format,\n transparent: this.options.transparent,\n bboxSR: this.options.bboxSR,\n imageSR: this.options.imageSR\n };\n\n if(this.options.layers){\n params.layers = 'show:' + this.options.layers.join(',');\n }\n\n if(this.options.layerDefs){\n params.layerDefs = JSON.stringify(this.options.layerDefs);\n }\n\n if(this.options.timeOptions){\n params.timeOptions = JSON.stringify(this.options.timeOptions);\n }\n\n if(this.options.from && this.options.to){\n params.time = this.options.from.valueOf() + ',' + this.options.to.valueOf();\n }\n\n if(this._service.options.token) {\n params.token = this._service.options.token;\n }\n\n return params;\n },\n\n _requestExport: function (params, bounds) {\n if(this.options.f === 'json'){\n this._service.get('export', params, function(error, response){\n this._renderImage(response.href, bounds);\n }, this);\n } else {\n params.f = 'image';\n this._renderImage(this.url + 'export' + L.Util.getParamString(params), bounds);\n }\n }\n});\n\nEsriLeaflet.DynamicMapLayer = EsriLeaflet.Layers.DynamicMapLayer;\n\nEsriLeaflet.Layers.dynamicMapLayer = function(url, options){\n return new EsriLeaflet.Layers.DynamicMapLayer(url, options);\n};\n\nEsriLeaflet.dynamicMapLayer = function(url, options){\n return new EsriLeaflet.Layers.DynamicMapLayer(url, options);\n};","EsriLeaflet.Layers.TiledMapLayer = L.TileLayer.extend({\n initialize: function(url, options){\n options = L.Util.setOptions(this, options);\n\n // set the urls\n this.url = L.esri.Util.cleanUrl(url);\n this.tileUrl = L.esri.Util.cleanUrl(url) + 'tile/{z}/{y}/{x}';\n this._service = new L.esri.Services.MapService(this.url, options);\n this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', this._propagateEvent, this);\n\n //if this is looking at the AGO tiles subdomain insert the subdomain placeholder\n if(this.tileUrl.match('://tiles.arcgisonline.com')){\n this.tileUrl = this.tileUrl.replace('://tiles.arcgisonline.com', '://tiles{s}.arcgisonline.com');\n options.subdomains = ['1', '2', '3', '4'];\n }\n\n if(this.options.token) {\n this.tileUrl += ('?token=' + this.options.token);\n }\n\n // init layer by calling TileLayers initialize method\n L.TileLayer.prototype.initialize.call(this, this.tileUrl, options);\n },\n\n metadata: function(callback, context){\n this._service.metadata(callback, context);\n return this;\n },\n\n identify: function(){\n return this._service.identify();\n },\n\n authenticate: function(token){\n var tokenQs = '?token=' + token;\n this.tileUrl = (this.options.token) ? this.tileUrl.replace(/\\?token=(.+)/g, tokenQs) : this.tileUrl + tokenQs;\n this.options.token = token;\n this._service.authenticate(token);\n return this;\n },\n\n // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js\n // @TODO remove at Leaflet 0.8\n _propagateEvent: function (e) {\n e = L.extend({\n layer: e.target,\n target: this\n }, e);\n this.fire(e.type, e);\n }\n});\n\nL.esri.TiledMapLayer = L.esri.Layers.tiledMapLayer;\n\nL.esri.Layers.tiledMapLayer = function(url, options){\n return new L.esri.Layers.TiledMapLayer(url, options);\n};\n\nL.esri.tiledMapLayer = function(url, options){\n return new L.esri.Layers.TiledMapLayer(url, options);\n};"]} \ No newline at end of file diff --git a/dist/builds/map-service/esri-leaflet-map-service.js b/dist/builds/map-service/esri-leaflet-map-service.js new file mode 100644 index 000000000..77e76be58 --- /dev/null +++ b/dist/builds/map-service/esri-leaflet-map-service.js @@ -0,0 +1,24 @@ +/*! esri-leaflet - v1.0.0-rc.3 - 2014-11-04 +* Copyright (c) 2014 Environmental Systems Research Institute, Inc. +* Apache License*/ +(function (factory) { + //define an AMD module that relies on 'leaflet' + if (typeof define === 'function' && define.amd) { + define(['leaflet'], function (L) { + return factory(L); + }); + //define a common js module that relies on 'leaflet' + } else if (typeof module === 'object' && typeof module.exports === 'object') { + module.exports = factory(require('leaflet')); + } + + if(typeof window !== 'undefined' && window.L){ + factory(window.L); + } +}(function (L) { + +var EsriLeaflet={VERSION:"1.0.0-rc.2",Layers:{},Services:{},Controls:{},Tasks:{},Util:{},Support:{CORS:!!(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),pointerEvents:""===document.documentElement.style.pointerEvents}};"undefined"!=typeof window&&window.L&&(window.L.esri=EsriLeaflet),function(a){function b(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function c(a,b){for(var c=0;cd;d++)b=a[d+1],c+=(b[0]-f[0])*(b[1]+f[1]),f=b;return c>=0}function f(a,b,c,d){var e=(d[0]-c[0])*(a[1]-c[1])-(d[1]-c[1])*(a[0]-c[0]),f=(b[0]-a[0])*(a[1]-c[1])-(b[1]-a[1])*(a[0]-c[0]),g=(d[1]-c[1])*(b[0]-a[0])-(d[0]-c[0])*(b[1]-a[1]);if(0!==g){var h=e/g,i=f/g;if(h>=0&&1>=h&&i>=0&&1>=i)return!0}return!1}function g(a,b){for(var c=0;c=0;b--)if(c=h[b][0],i(c,f)){h[b].push(f),o=!0;break}o||n.push(f)}for(;n.length;){f=n.pop();var p=!1;for(b=h.length-1;b>=0;b--)if(c=h[b][0],g(c,f)){h[b].push(f),p=!0;break}p||h.push([f.reverse()])}return 1===h.length?{type:"Polygon",coordinates:h[0]}:{type:"MultiPolygon",coordinates:h}}function k(a){var b=[],c=a.slice(0),f=d(c.shift().slice(0));if(f.length>=4){e(f)||f.reverse(),b.push(f);for(var g=0;g=4&&(e(h)&&h.reverse(),b.push(h))}}return b}function l(a){for(var b=[],c=0;c=0;e--){var f=d[e].slice(0);b.push(f)}return b}a.Util.extentToBounds=function(a){var b=new L.LatLng(a.ymin,a.xmin),c=new L.LatLng(a.ymax,a.xmax);return new L.LatLngBounds(b,c)},a.Util.boundsToExtent=function(a){return a=L.latLngBounds(a),{xmin:a.getSouthWest().lng,ymin:a.getSouthWest().lat,xmax:a.getNorthEast().lng,ymax:a.getNorthEast().lat,spatialReference:{wkid:4326}}},a.Util.arcgisToGeojson=function(c,d){var e={};return"number"==typeof c.x&&"number"==typeof c.y&&(e.type="Point",e.coordinates=[c.x,c.y]),c.points&&(e.type="MultiPoint",e.coordinates=c.points.slice(0)),c.paths&&(1===c.paths.length?(e.type="LineString",e.coordinates=c.paths[0].slice(0)):(e.type="MultiLineString",e.coordinates=c.paths.slice(0))),c.rings&&(e=j(c.rings.slice(0))),(c.geometry||c.attributes)&&(e.type="Feature",e.geometry=c.geometry?a.Util.arcgisToGeojson(c.geometry):null,e.properties=c.attributes?b(c.attributes):null,c.attributes&&(e.id=c.attributes[d]||c.attributes.OBJECTID||c.attributes.FID)),e},a.Util.geojsonToArcGIS=function(c,d){d=d||"OBJECTID";var e,f={wkid:4326},g={};switch(c.type){case"Point":g.x=c.coordinates[0],g.y=c.coordinates[1],g.spatialReference=f;break;case"MultiPoint":g.points=c.coordinates.slice(0),g.spatialReference=f;break;case"LineString":g.paths=[c.coordinates.slice(0)],g.spatialReference=f;break;case"MultiLineString":g.paths=c.coordinates.slice(0),g.spatialReference=f;break;case"Polygon":g.rings=k(c.coordinates.slice(0)),g.spatialReference=f;break;case"MultiPolygon":g.rings=l(c.coordinates.slice(0)),g.spatialReference=f;break;case"Feature":c.geometry&&(g.geometry=a.Util.geojsonToArcGIS(c.geometry,d)),g.attributes=c.properties?b(c.properties):{},c.id&&(g.attributes[d]=c.id);break;case"FeatureCollection":for(g=[],e=0;e=0;h--)f.features.push(a.Util.arcgisToGeojson(g[h],d));return f},a.Util.cleanUrl=function(a){return a=a.replace(/\s\s*/g,""),"/"!==a[a.length-1]&&(a+="/"),a},a.Util.geojsonTypeToArcGIS=function(a){var b;switch(a){case"Point":b="esriGeometryPoint";break;case"MultiPoint":b="esriGeometryMultipoint";break;case"LineString":b="esriGeometryPolyline";break;case"MultiLineString":b="esriGeometryPolyline";break;case"Polygon":b="esriGeometryPolygon";break;case"MultiPolygon":b="esriGeometryPolygon"}return b}}(EsriLeaflet),function(a){function b(a){var b="";a.f="json";for(var c in a)if(a.hasOwnProperty(c)){var d,e=a[c],f=Object.prototype.toString.call(e);b.length&&(b+="&"),d="[object Array]"===f||"[object Object]"===f?JSON.stringify(e):"[object Date]"===f?e.valueOf():e,b+=encodeURIComponent(c)+"="+encodeURIComponent(d)}return b}function c(a,b){var c=new XMLHttpRequest;return c.onerror=function(){a.call(b,{error:{code:500,message:"XMLHttpRequest error"}},null)},c.onreadystatechange=function(){var d,e;if(4===c.readyState){try{d=JSON.parse(c.responseText)}catch(f){d=null,e={code:500,message:"Could not parse response as JSON."}}!e&&d.error&&(e=d.error,d=null),a.call(b,e,d)}},c}var d=0;window._EsriLeafletCallbacks={},a.Request={request:function(a,d,e,f){var g=b(d),h=c(e,f),i=(a+"?"+g).length;if(2e3>=i&&L.esri.Support.CORS)h.open("GET",a+"?"+g),h.send(null);else if(i>2e3&&L.esri.Support.CORS)h.open("POST",a),h.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),h.send(g);else{if(2e3>=i&&!L.esri.Support.CORS)return L.esri.Request.get.JSONP(a,d,e,f);if(console&&console.warn)return void console.warn("a request to "+a+" 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")}return h},post:{XMLHTTP:function(a,d,e,f){var g=c(e,f);return g.open("POST",a),g.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),g.send(b(d)),g}},get:{CORS:function(a,d,e,f){var g=c(e,f);return g.open("GET",a+"?"+b(d),!0),g.send(null),g},JSONP:function(a,c,e,f){var g="c"+d;c.callback="window._EsriLeafletCallbacks."+g;var h=L.DomUtil.create("script",null,document.body);return h.type="text/javascript",h.src=a+"?"+b(c),h.id=g,window._EsriLeafletCallbacks[g]=function(a){if(window._EsriLeafletCallbacks[g]!==!0){var b,c=Object.prototype.toString.call(a);"[object Object]"!==c&&"[object Array]"!==c&&(b={error:{code:500,message:"Expected array or object as JSONP response"}},a=null),!b&&a.error&&(b=a,a=null),e.call(f,b,a),window._EsriLeafletCallbacks[g]=!0}},d++,{id:g,url:h.src,abort:function(){window._EsriLeafletCallbacks._callback[g]({code:0,message:"Request aborted."})}}}}},a.get=a.Support.CORS?a.Request.get.CORS:a.Request.get.JSONP,a.post=a.Request.post.XMLHTTP,a.request=a.Request.request}(EsriLeaflet),EsriLeaflet.Services.Service=L.Class.extend({includes:L.Mixin.Events,options:{proxy:!1,useCors:EsriLeaflet.Support.CORS},initialize:function(a,b){this.url=EsriLeaflet.Util.cleanUrl(a),this._requestQueue=[],this._authenticating=!1,L.Util.setOptions(this,b)},get:function(a,b,c,d){return this._request("get",a,b,c,d)},post:function(a,b,c,d){return this._request("post",a,b,c,d)},request:function(a,b,c,d){return this._request("request",a,b,c,d)},metadata:function(a,b){return this._request("get","",{},a,b)},authenticate:function(a){return this._authenticating=!1,this.options.token=a,this._runQueue(),this},_request:function(a,b,c,d,e){this.fire("requeststart",{url:this.url+b,params:c,method:a});var f=this._createServiceCallback(a,b,c,d,e);if(this.options.token&&(c.token=this.options.token),this._authenticating)return void this._requestQueue.push([a,b,c,d,e]);var g=this.options.proxy?this.options.proxy+"?"+this.url+b:this.url+b;return"get"!==a&&"request"!==a||this.options.useCors?EsriLeaflet[a](g,c,f):EsriLeaflet.Request.get.JSONP(g,c,f)},_createServiceCallback:function(a,b,c,d,e){var f=[a,b,c,d,e];return L.Util.bind(function(g,h){!g||499!==g.code&&498!==g.code?(d.call(e,g,h),g?this.fire("requesterror",{url:this.url+b,params:c,message:g.message,code:g.code,method:a}):this.fire("requestsuccess",{url:this.url+b,params:c,response:h,method:a}),this.fire("requestend",{url:this.url+b,params:c,method:a})):(this._authenticating=!0,this._requestQueue.push(f),this.fire("authenticationrequired",{authenticate:L.Util.bind(this.authenticate,this)}))},this)},_runQueue:function(){for(var a=this._requestQueue.length-1;a>=0;a--){var b=this._requestQueue[a],c=b.shift();this[c].apply(this,b)}this._requestQueue=[]}}),EsriLeaflet.Services.service=function(a,b){return new EsriLeaflet.Services.Service(a,b)},EsriLeaflet.Services.MapService=EsriLeaflet.Services.Service.extend({identify:function(){return new EsriLeaflet.Tasks.identifyFeatures(this)},find:function(){return new EsriLeaflet.Tasks.Find(this)},query:function(){return new EsriLeaflet.Tasks.Query(this)}}),EsriLeaflet.Services.mapService=function(a,b){return new EsriLeaflet.Services.MapService(a,b)},EsriLeaflet.Tasks.Task=L.Class.extend({options:{proxy:!1,useCors:EsriLeaflet.Support.CORS},generateSetter:function(a,b){var c=a.match(/([a-zA-Z]+)\[\]/);return a=c?c[1]:a,c?L.Util.bind(function(b){return this.params[a]=L.Util.isArray(b)?b.join(","):b,this},b):L.Util.bind(function(b){return this.params[a]=b,this},b)},initialize:function(a,b){if(a.url&&a.request?(this._service=a,this.url=a.url):this.url=EsriLeaflet.Util.cleanUrl(a),this.params=L.Util.extend({},this.params||{}),this.setters)for(var c in this.setters){var d=this.setters[c];this[c]=this.generateSetter(d,this)}L.Util.setOptions(this,b)},token:function(a){return this._service?this._service.authenticate(a):this.params.token=a,this},request:function(a,b){return this._service?this._service.request(this.path,this.params,a,b):this._request("request",this.path,this.params,a,b)},_request:function(a,b,c,d,e){var f=this.options.proxy?this.options.proxy+"?"+this.url+b:this.url+b;return"get"!==a&&"request"!==a||this.options.useCors?EsriLeaflet[a](f,c,d,e):EsriLeaflet.Request.get.JSONP(f,c,d,e)}}),EsriLeaflet.Tasks.Identify=EsriLeaflet.Tasks.Task.extend({path:"identify",between:function(a,b){return this.params.time=[a.valueOf(),b.valueOf()].join(","),this},returnGeometry:function(a){return this.params.returnGeometry=a,this}}),EsriLeaflet.Tasks.IdentifyFeatures=EsriLeaflet.Tasks.Identify.extend({setters:{layers:"layers",precision:"geometryPrecision",tolerance:"tolerance"},params:{sr:4326,layers:"all",tolerance:3,returnGeometry:!0},on:function(a){var b=EsriLeaflet.Util.boundsToExtent(a.getBounds()),c=a.getSize();return this.params.imageDisplay=[c.x,c.y,96].join(","),this.params.mapExtent=[b.xmin,b.ymin,b.xmax,b.ymax].join(","),this},at:function(a){return a=L.latLng(a),this.params.geometry=[a.lng,a.lat].join(","),this.params.geometryType="esriGeometryPoint",this},layerDef:function(a,b){return this.params.layerDefs=this.params.layerDefs?this.params.layerDefs+";":"",this.params.layerDefs+=[a,b].join(":"),this},simplify:function(a,b){var c=Math.abs(a.getBounds().getWest()-a.getBounds().getEast());return this.params.maxAllowableOffset=c/a.getSize().y*(1-b),this},run:function(a,b){return this.request(function(c,d){a.call(b,c,d&&EsriLeaflet.Util.responseToFeatureCollection(d),d)},b)}}),EsriLeaflet.Tasks.identifyFeatures=function(a,b){return new EsriLeaflet.Tasks.IdentifyFeatures(a,b)},EsriLeaflet.Tasks.Query=EsriLeaflet.Tasks.Task.extend({setters:{offset:"offset",limit:"limit",outFields:"fields[]",precision:"geometryPrecision",featureIds:"objectIds[]",returnGeometry:"returnGeometry",token:"token"},path:"query",params:{returnGeometry:!0,where:"1=1",outSr:4326,outFields:"*"},within:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelContains",this},intersects:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelIntersects",this},contains:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelWithin",this},overlaps:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelOverlaps",this},nearby:function(a,b){return a=L.latLng(a),this.params.geometry=[a.lng,a.lat].join(","),this.params.geometryType="esriGeometryPoint",this.params.spatialRel="esriSpatialRelIntersects",this.params.units="esriSRUnit_Meter",this.params.distance=b,this.params.inSr=4326,this},where:function(a){return this.params.where=a.replace(/"/g,"'"),this},between:function(a,b){return this.params.time=[a.valueOf(),b.valueOf()].join(),this},fields:function(a){return this.params.outFields=L.Util.isArray(a)?a.join(","):a,this},simplify:function(a,b){var c=Math.abs(a.getBounds().getWest()-a.getBounds().getEast());return this.params.maxAllowableOffset=c/a.getSize().y*b,this},orderBy:function(a,b){return b=b||"ASC",this.params.orderByFields=this.params.orderByFields?this.params.orderByFields+",":"",this.params.orderByFields+=[a,b].join(" "),this},returnGeometry:function(a){return this.params.returnGeometry=a,this},run:function(a,b){return this._cleanParams(),this.request(function(c,d){a.call(b,c,d&&EsriLeaflet.Util.responseToFeatureCollection(d),d)},b)},count:function(a,b){return this._cleanParams(),this.params.returnCountOnly=!0,this.request(function(b,c){a.call(this,b,c&&c.count,c)},b)},ids:function(a,b){return this._cleanParams(),this.params.returnIdsOnly=!0,this.request(function(b,c){a.call(this,b,c&&c.objectIds,c)},b)},bounds:function(a,b){return this._cleanParams(),this.params.returnExtentOnly=!0,this.request(function(c,d){a.call(b,c,d&&d.extent&&EsriLeaflet.Util.extentToBounds(d.extent),d)},b)},pixelSize:function(a){return a=L.point(a),this.params.pixelSize=[a.x,a.y].join(","),this},layer:function(a){return this.path=a+"/query",this},_cleanParams:function(){delete this.params.returnIdsOnly,delete this.params.returnExtentOnly,delete this.params.returnCountOnly},_setGeometry:function(a){return this.params.inSr=4326,a instanceof L.LatLngBounds?(this.params.geometry=EsriLeaflet.Util.boundsToExtent(a),void(this.params.geometryType="esriGeometryEnvelope")):(a.getLatLng&&(a=a.getLatLng()),a instanceof L.LatLng&&(a={type:"Point",coordinates:[a.lng,a.lat]}),a instanceof L.GeoJSON&&(a=a.getLayers()[0].feature.geometry,this.params.geometry=EsriLeaflet.Util.geojsonToArcGIS(a),this.params.geometryType=EsriLeaflet.Util.geojsonTypeToArcGIS(a.type)),a.toGeoJSON&&(a=a.toGeoJSON()),"Feature"===a.type&&(a=a.geometry),"Point"===a.type||"LineString"===a.type||"Polygon"===a.type?(this.params.geometry=EsriLeaflet.Util.geojsonToArcGIS(a),void(this.params.geometryType=EsriLeaflet.Util.geojsonTypeToArcGIS(a.type))):void(console&&console.warn&&console.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")))}}),EsriLeaflet.Tasks.query=function(a,b){return new EsriLeaflet.Tasks.Query(a,b)},EsriLeaflet.Tasks.Find=EsriLeaflet.Tasks.Task.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(a,b){return this.params.layerDefs=this.params.layerDefs?this.params.layerDefs+";":"",this.params.layerDefs+=[a,b].join(":"),this},simplify:function(a,b){var c=Math.abs(a.getBounds().getWest()-a.getBounds().getEast());return this.params.maxAllowableOffset=c/a.getSize().y*b,this},run:function(a,b){return this.request(function(c,d){a.call(b,c,d&&EsriLeaflet.Util.responseToFeatureCollection(d),d)},b)}}),EsriLeaflet.Tasks.find=function(a,b){return new EsriLeaflet.Tasks.Find(a,b)},EsriLeaflet.Layers.RasterLayer=L.Class.extend({includes:L.Mixin.Events,options:{opacity:1,position:"front",f:"image"},onAdd:function(a){if(this._map=a,this._update=L.Util.limitExecByInterval(this._update,this.options.updateInterval,this),a.options.crs&&a.options.crs.code){var b=a.options.crs.code.split(":")[1];this.options.bboxSR=b,this.options.imageSR=b}a.on("moveend",this._update,this),this._update(),this._popup&&(this._map.on("click",this._getPopupData,this),this._map.on("dblclick",this._resetPopupState,this))},bindPopup:function(a,b){return this._shouldRenderPopup=!1,this._lastClick=!1,this._popup=L.popup(b),this._popupFunction=a,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},onRemove:function(){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),this._map=null},addTo:function(a){return a.addLayer(this),this},removeFrom:function(a){return a.removeLayer(this),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(a){return this.options.opacity=a,this._currentImage.setOpacity(a),this},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(a,b){return this.options.from=a,this.options.to=b,this._update(),this},metadata:function(a,b){return this._service.metadata(a,b),this},authenticate:function(a){return this._service.authenticate(a),this},_renderImage:function(a,b){if(this._map){var c=new L.ImageOverlay(a,b,{opacity:0}).addTo(this._map);c.once("load",function(a){var c=a.target,d=this._currentImage;c._bounds.equals(b)?(this._currentImage=c,"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),d&&this._map.removeLayer(d)):this._map.removeLayer(c),this.fire("load",{bounds:b})},this),this.fire("loading",{bounds:b})}},_update:function(){if(this._map){var a=this._map.getZoom(),b=this._map.getBounds();if(!this._animatingZoom&&!(this._map._panTransition&&this._map._panTransition._inProgress||a>this.options.maxZoom||a= 0);\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L504-L519\n function vertexIntersectsVertex(a1, a2, b1, b2) {\n var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]);\n var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]);\n var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]);\n\n if ( uB !== 0 ) {\n var ua = uaT / uB;\n var ub = ubT / uB;\n\n if ( 0 <= ua && ua <= 1 && 0 <= ub && ub <= 1 ) {\n return true;\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L521-L531\n function arrayIntersectsArray(a, b) {\n for (var i = 0; i < a.length - 1; i++) {\n for (var j = 0; j < b.length - 1; j++) {\n if (vertexIntersectsVertex(a[i], a[i + 1], b[j], b[j + 1])) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L470-L480\n function coordinatesContainPoint(coordinates, point) {\n var contains = false;\n for(var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) {\n if (((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1]) ||\n (coordinates[j][1] <= point[1] && point[1] < coordinates[i][1])) &&\n (point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0])) {\n contains = !contains;\n }\n }\n return contains;\n }\n\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L106-L113\n function coordinatesContainCoordinates(outer, inner){\n var intersects = arrayIntersectsArray(outer, inner);\n var contains = coordinatesContainPoint(outer, inner[0]);\n if(!intersects && contains){\n return true;\n }\n return false;\n }\n\n // do any polygons in this array contain any other polygons in this array?\n // used for checking for holes in arcgis rings\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L117-L172\n function convertRingsToGeoJSON(rings){\n var outerRings = [];\n var holes = [];\n var x; // iterator\n var outerRing; // current outer ring being evaluated\n var hole; // current hole being evaluated\n\n // for each ring\n for (var r = 0; r < rings.length; r++) {\n var ring = closeRing(rings[r].slice(0));\n if(ring.length < 4){\n continue;\n }\n // is this ring an outer ring? is it clockwise?\n if(ringIsClockwise(ring)){\n var polygon = [ ring ];\n outerRings.push(polygon); // push to outer rings\n } else {\n holes.push(ring); // counterclockwise push to holes\n }\n }\n\n var uncontainedHoles = [];\n\n // while there are holes left...\n while(holes.length){\n // pop a hole off out stack\n hole = holes.pop();\n\n // loop over all outer rings and see if they contain our hole.\n var contained = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(coordinatesContainCoordinates(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n contained = true;\n break;\n }\n }\n\n // ring is not contained in any outer ring\n // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320\n if(!contained){\n uncontainedHoles.push(hole);\n }\n }\n\n // if we couldn't match any holes using contains we can try intersects...\n while(uncontainedHoles.length){\n // pop a hole off out stack\n hole = uncontainedHoles.pop();\n\n // loop over all outer rings and see if any intersect our hole.\n var intersects = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(arrayIntersectsArray(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n intersects = true;\n break;\n }\n }\n\n if(!intersects) {\n outerRings.push([hole.reverse()]);\n }\n }\n\n if(outerRings.length === 1){\n return {\n type: 'Polygon',\n coordinates: outerRings[0]\n };\n } else {\n return {\n type: 'MultiPolygon',\n coordinates: outerRings\n };\n }\n }\n\n // This function ensures that rings are oriented in the right directions\n // outer rings are clockwise, holes are counterclockwise\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function orientRings(poly){\n var output = [];\n var polygon = poly.slice(0);\n var outerRing = closeRing(polygon.shift().slice(0));\n if(outerRing.length >= 4){\n if(!ringIsClockwise(outerRing)){\n outerRing.reverse();\n }\n\n output.push(outerRing);\n\n for (var i = 0; i < polygon.length; i++) {\n var hole = closeRing(polygon[i].slice(0));\n if(hole.length >= 4){\n if(ringIsClockwise(hole)){\n hole.reverse();\n }\n output.push(hole);\n }\n }\n }\n\n return output;\n }\n\n // This function flattens holes in multipolygons to one array of polygons\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function flattenMultiPolygonRings(rings){\n var output = [];\n for (var i = 0; i < rings.length; i++) {\n var polygon = orientRings(rings[i]);\n for (var x = polygon.length - 1; x >= 0; x--) {\n var ring = polygon[x].slice(0);\n output.push(ring);\n }\n }\n return output;\n }\n\n // convert an extent (ArcGIS) to LatLngBounds (Leaflet)\n EsriLeaflet.Util.extentToBounds = function(extent){\n var sw = new L.LatLng(extent.ymin, extent.xmin);\n var ne = new L.LatLng(extent.ymax, extent.xmax);\n return new L.LatLngBounds(sw, ne);\n };\n\n // convert an LatLngBounds (Leaflet) to extent (ArcGIS)\n EsriLeaflet.Util.boundsToExtent = function(bounds) {\n bounds = L.latLngBounds(bounds);\n return {\n 'xmin': bounds.getSouthWest().lng,\n 'ymin': bounds.getSouthWest().lat,\n 'xmax': bounds.getNorthEast().lng,\n 'ymax': bounds.getNorthEast().lat,\n 'spatialReference': {\n 'wkid' : 4326\n }\n };\n };\n\n EsriLeaflet.Util.arcgisToGeojson = function (arcgis, idAttribute){\n var geojson = {};\n\n if(typeof arcgis.x === 'number' && typeof arcgis.y === 'number'){\n geojson.type = 'Point';\n geojson.coordinates = [arcgis.x, arcgis.y];\n }\n\n if(arcgis.points){\n geojson.type = 'MultiPoint';\n geojson.coordinates = arcgis.points.slice(0);\n }\n\n if(arcgis.paths) {\n if(arcgis.paths.length === 1){\n geojson.type = 'LineString';\n geojson.coordinates = arcgis.paths[0].slice(0);\n } else {\n geojson.type = 'MultiLineString';\n geojson.coordinates = arcgis.paths.slice(0);\n }\n }\n\n if(arcgis.rings) {\n geojson = convertRingsToGeoJSON(arcgis.rings.slice(0));\n }\n\n if(arcgis.geometry || arcgis.attributes) {\n geojson.type = 'Feature';\n geojson.geometry = (arcgis.geometry) ? EsriLeaflet.Util.arcgisToGeojson(arcgis.geometry) : null;\n geojson.properties = (arcgis.attributes) ? clone(arcgis.attributes) : null;\n if(arcgis.attributes) {\n geojson.id = arcgis.attributes[idAttribute] || arcgis.attributes.OBJECTID || arcgis.attributes.FID;\n }\n }\n\n return geojson;\n };\n\n // GeoJSON -> ArcGIS\n EsriLeaflet.Util.geojsonToArcGIS = function(geojson, idAttribute){\n idAttribute = idAttribute || 'OBJECTID';\n var spatialReference = { wkid: 4326 };\n var result = {};\n var i;\n\n switch(geojson.type){\n case 'Point':\n result.x = geojson.coordinates[0];\n result.y = geojson.coordinates[1];\n result.spatialReference = spatialReference;\n break;\n case 'MultiPoint':\n result.points = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'LineString':\n result.paths = [geojson.coordinates.slice(0)];\n result.spatialReference = spatialReference;\n break;\n case 'MultiLineString':\n result.paths = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'Polygon':\n result.rings = orientRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'MultiPolygon':\n result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'Feature':\n if(geojson.geometry) {\n result.geometry = EsriLeaflet.Util.geojsonToArcGIS(geojson.geometry, idAttribute);\n }\n result.attributes = (geojson.properties) ? clone(geojson.properties) : {};\n if(geojson.id){\n result.attributes[idAttribute] = geojson.id;\n }\n break;\n case 'FeatureCollection':\n result = [];\n for (i = 0; i < geojson.features.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.features[i], idAttribute));\n }\n break;\n case 'GeometryCollection':\n result = [];\n for (i = 0; i < geojson.geometries.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.geometries[i], idAttribute));\n }\n break;\n }\n\n return result;\n };\n\n EsriLeaflet.Util.responseToFeatureCollection = function(response, idAttribute){\n var objectIdField;\n\n if(idAttribute){\n objectIdField = idAttribute;\n } else if(response.objectIdFieldName){\n objectIdField = response.objectIdFieldName;\n } else if(response.fields) {\n for (var j = 0; j <= response.fields.length - 1; j++) {\n if(response.fields[j].type === 'esriFieldTypeOID') {\n objectIdField = response.fields[j].name;\n break;\n }\n }\n } else {\n objectIdField = 'OBJECTID';\n }\n\n var featureCollection = {\n type: 'FeatureCollection',\n features: []\n };\n var features = response.features || response.results;\n if(features.length){\n for (var i = features.length - 1; i >= 0; i--) {\n featureCollection.features.push(EsriLeaflet.Util.arcgisToGeojson(features[i], objectIdField));\n }\n }\n\n return featureCollection;\n };\n\n // trim whitespace and add a tailing slash is needed to a url\n EsriLeaflet.Util.cleanUrl = function(url){\n url = url.replace(/\\s\\s*/g, '');\n\n //add a trailing slash to the url if the user omitted it\n if(url[url.length-1] !== '/'){\n url += '/';\n }\n\n return url;\n };\n\n EsriLeaflet.Util.geojsonTypeToArcGIS = function (geoJsonType) {\n var arcgisGeometryType;\n switch (geoJsonType) {\n case 'Point':\n arcgisGeometryType = 'esriGeometryPoint';\n break;\n case 'MultiPoint':\n arcgisGeometryType = 'esriGeometryMultipoint';\n break;\n case 'LineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'MultiLineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'Polygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n case 'MultiPolygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n }\n return arcgisGeometryType;\n };\n\n})(EsriLeaflet);","(function(EsriLeaflet){\n\n var callbacks = 0;\n\n window._EsriLeafletCallbacks = {};\n\n function serialize(params){\n var data = '';\n\n params.f = 'json';\n\n for (var key in params){\n if(params.hasOwnProperty(key)){\n var param = params[key];\n var type = Object.prototype.toString.call(param);\n var value;\n\n if(data.length){\n data += '&';\n }\n\n if(type === '[object Array]' || type === '[object Object]'){\n value = JSON.stringify(param);\n } else if (type === '[object Date]'){\n value = param.valueOf();\n } else {\n value = param;\n }\n\n data += encodeURIComponent(key) + '=' + encodeURIComponent(value);\n }\n }\n\n return data;\n }\n\n function createRequest(callback, context){\n var httpRequest = new XMLHttpRequest();\n\n httpRequest.onerror = function(e) {\n callback.call(context, {\n error: {\n code: 500,\n message: 'XMLHttpRequest error'\n }\n }, null);\n };\n\n httpRequest.onreadystatechange = function(){\n var response;\n var error;\n\n if (httpRequest.readyState === 4) {\n try {\n response = JSON.parse(httpRequest.responseText);\n } catch(e) {\n response = null;\n error = {\n code: 500,\n message: 'Could not parse response as JSON.'\n };\n }\n\n if (!error && response.error) {\n error = response.error;\n response = null;\n }\n\n callback.call(context, error, response);\n }\n };\n\n return httpRequest;\n }\n\n // AJAX handlers for CORS (modern browsers) or JSONP (older browsers)\n EsriLeaflet.Request = {\n request: function(url, params, callback, context){\n var paramString = serialize(params);\n var httpRequest = createRequest(callback, context);\n var requestLength = (url + '?' + paramString).length;\n\n // request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest\n if(requestLength <= 2000 && L.esri.Support.CORS){\n httpRequest.open('GET', url + '?' + paramString);\n httpRequest.send(null);\n\n // request is less more then 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest\n } else if (requestLength > 2000 && L.esri.Support.CORS){\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(paramString);\n\n // request is less more then 2000 characters and the browser does not support CORS, make a JSONP request\n } else if(requestLength <= 2000 && !L.esri.Support.CORS){\n return L.esri.Request.get.JSONP(url, params, callback, context);\n\n // request is longer then 2000 characters and the browser does not support CORS, log a warning\n } else {\n if(console && console.warn){\n console.warn('a request to ' + url + ' 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');\n return;\n }\n }\n\n return httpRequest;\n },\n post: {\n XMLHTTP: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(serialize(params));\n\n return httpRequest;\n }\n },\n\n get: {\n CORS: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n\n httpRequest.open('GET', url + '?' + serialize(params), true);\n httpRequest.send(null);\n\n return httpRequest;\n },\n JSONP: function(url, params, callback, context){\n var callbackId = 'c' + callbacks;\n\n params.callback = 'window._EsriLeafletCallbacks.' + callbackId;\n\n var script = L.DomUtil.create('script', null, document.body);\n script.type = 'text/javascript';\n script.src = url + '?' + serialize(params);\n script.id = callbackId;\n\n window._EsriLeafletCallbacks[callbackId] = function(response){\n if(window._EsriLeafletCallbacks[callbackId] !== true){\n var error;\n var responseType = Object.prototype.toString.call(response);\n\n if(!(responseType === '[object Object]' || responseType === '[object Array]')){\n error = {\n error: {\n code: 500,\n message: 'Expected array or object as JSONP response'\n }\n };\n response = null;\n }\n\n if (!error && response.error) {\n error = response;\n response = null;\n }\n\n callback.call(context, error, response);\n window._EsriLeafletCallbacks[callbackId] = true;\n }\n };\n\n callbacks++;\n\n return {\n id: callbackId,\n url: script.src,\n abort: function(){\n window._EsriLeafletCallbacks._callback[callbackId]({\n code: 0,\n message: 'Request aborted.'\n });\n }\n };\n }\n }\n };\n\n // Choose the correct AJAX handler depending on CORS support\n EsriLeaflet.get = (EsriLeaflet.Support.CORS) ? EsriLeaflet.Request.get.CORS : EsriLeaflet.Request.get.JSONP;\n\n // Always use XMLHttpRequest for posts\n EsriLeaflet.post = EsriLeaflet.Request.post.XMLHTTP;\n\n // expose a common request method the uses GET\\POST based on request length\n EsriLeaflet.request = EsriLeaflet.Request.request;\n\n})(EsriLeaflet);","EsriLeaflet.Services.Service = L.Class.extend({\n\n includes: L.Mixin.Events,\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n initialize: function (url, options) {\n this.url = EsriLeaflet.Util.cleanUrl(url);\n this._requestQueue = [];\n this._authenticating = false;\n L.Util.setOptions(this, options);\n },\n\n get: function (path, params, callback, context) {\n return this._request('get', path, params, callback, context);\n },\n\n post: function (path, params, callback, context) {\n return this._request('post', path, params, callback, context);\n },\n\n request: function (path, params, callback, context) {\n return this._request('request', path, params, callback, context);\n },\n\n metadata: function (callback, context) {\n return this._request('get', '', {}, callback, context);\n },\n\n authenticate: function(token){\n this._authenticating = false;\n this.options.token = token;\n this._runQueue();\n return this;\n },\n\n _request: function(method, path, params, callback, context){\n this.fire('requeststart', {\n url: this.url + path,\n params: params,\n method: method\n });\n\n var wrappedCallback = this._createServiceCallback(method, path, params, callback, context);\n\n if (this.options.token) {\n params.token = this.options.token;\n }\n\n if (this._authenticating) {\n this._requestQueue.push([method, path, params, callback, context]);\n return;\n } else {\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, wrappedCallback);\n } else {\n return EsriLeaflet[method](url, params, wrappedCallback);\n }\n }\n },\n\n _createServiceCallback: function(method, path, params, callback, context){\n var request = [method, path, params, callback, context];\n\n return L.Util.bind(function(error, response){\n\n if (error && (error.code === 499 || error.code === 498)) {\n this._authenticating = true;\n\n this._requestQueue.push(request);\n\n this.fire('authenticationrequired', {\n authenticate: L.Util.bind(this.authenticate, this)\n });\n } else {\n callback.call(context, error, response);\n\n if(error) {\n this.fire('requesterror', {\n url: this.url + path,\n params: params,\n message: error.message,\n code: error.code,\n method: method\n });\n } else {\n this.fire('requestsuccess', {\n url: this.url + path,\n params: params,\n response: response,\n method: method\n });\n }\n\n this.fire('requestend', {\n url: this.url + path,\n params: params,\n method: method\n });\n }\n }, this);\n },\n\n _runQueue: function(){\n for (var i = this._requestQueue.length - 1; i >= 0; i--) {\n var request = this._requestQueue[i];\n var method = request.shift();\n this[method].apply(this, request);\n }\n this._requestQueue = [];\n }\n\n});\n\nEsriLeaflet.Services.service = function(url, params){\n return new EsriLeaflet.Services.Service(url, params);\n};","EsriLeaflet.Services.MapService = EsriLeaflet.Services.Service.extend({\n\n identify: function () {\n return new EsriLeaflet.Tasks.identifyFeatures(this);\n },\n\n find: function () {\n return new EsriLeaflet.Tasks.Find(this);\n },\n\n query: function () {\n return new EsriLeaflet.Tasks.Query(this);\n }\n\n});\n\nEsriLeaflet.Services.mapService = function(url, params){\n return new EsriLeaflet.Services.MapService(url, params);\n};","EsriLeaflet.Tasks.Task = L.Class.extend({\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n //Generate a method for each methodName:paramName in the setters for this task.\n generateSetter: function(param, context){\n var isArray = param.match(/([a-zA-Z]+)\\[\\]/);\n\n param = (isArray) ? isArray[1] : param;\n\n if(isArray){\n return L.Util.bind(function(value){\n // this.params[param] = (this.params[param]) ? this.params[param] + ',' : '';\n if (L.Util.isArray(value)) {\n this.params[param] = value.join(',');\n } else {\n this.params[param] = value;\n }\n return this;\n }, context);\n } else {\n return L.Util.bind(function(value){\n this.params[param] = value;\n return this;\n }, context);\n }\n },\n\n initialize: function(endpoint, options){\n // endpoint can be either a url to an ArcGIS Rest Service or an instance of EsriLeaflet.Service\n if(endpoint.url && endpoint.request){\n this._service = endpoint;\n this.url = endpoint.url;\n } else {\n this.url = EsriLeaflet.Util.cleanUrl(endpoint);\n }\n\n // clone default params into this object\n this.params = L.Util.extend({}, this.params || {});\n\n // generate setter methods based on the setters object implimented a child class\n if(this.setters){\n for (var setter in this.setters){\n var param = this.setters[setter];\n this[setter] = this.generateSetter(param, this);\n }\n }\n\n L.Util.setOptions(this, options);\n },\n\n token: function(token){\n if(this._service){\n this._service.authenticate(token);\n } else {\n this.params.token = token;\n }\n return this;\n },\n\n request: function(callback, context){\n if(this._service){\n return this._service.request(this.path, this.params, callback, context);\n } else {\n return this._request('request', this.path, this.params, callback, context);\n }\n },\n\n _request: function(method, path, params, callback, context){\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, callback, context);\n } else{\n return EsriLeaflet[method](url, params, callback, context);\n }\n }\n});","EsriLeaflet.Tasks.Identify = EsriLeaflet.Tasks.Task.extend({\n path: 'identify',\n\n between: function(start, end){\n this.params.time = ([start.valueOf(), end.valueOf()]).join(',');\n return this;\n },\n\n returnGeometry: function (returnGeometry) {\n this.params.returnGeometry = returnGeometry;\n return this;\n }\n});\n","EsriLeaflet.Tasks.IdentifyFeatures = EsriLeaflet.Tasks.Identify.extend({\n setters: {\n 'layers': 'layers',\n 'precision': 'geometryPrecision',\n 'tolerance': 'tolerance'\n },\n\n params: {\n sr: 4326,\n layers: 'all',\n tolerance: 3,\n returnGeometry: true\n },\n\n on: function(map){\n var extent = EsriLeaflet.Util.boundsToExtent(map.getBounds());\n var size = map.getSize();\n this.params.imageDisplay = [size.x, size.y, 96].join(',');\n this.params.mapExtent=([extent.xmin, extent.ymin, extent.xmax, extent.ymax]).join(',');\n return this;\n },\n\n at: function(latlng){\n latlng = L.latLng(latlng);\n this.params.geometry = ([latlng.lng, latlng.lat]).join(',');\n this.params.geometryType = 'esriGeometryPoint';\n return this;\n },\n\n layerDef: function (id, where){\n this.params.layerDefs = (this.params.layerDefs) ? this.params.layerDefs + ';' : '';\n this.params.layerDefs += ([id, where]).join(':');\n return this;\n },\n\n simplify: function(map, factor){\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * (1 - factor);\n return this;\n },\n\n run: function (callback, context){\n return this.request(function(error, response){\n callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response);\n }, context);\n }\n\n});\n\nEsriLeaflet.Tasks.identifyFeatures = function(url, params){\n return new EsriLeaflet.Tasks.IdentifyFeatures(url, params);\n};","EsriLeaflet.Tasks.Query = EsriLeaflet.Tasks.Task.extend({\n setters: {\n 'offset': 'offset',\n 'limit': 'limit',\n 'outFields': 'fields[]',\n 'precision': 'geometryPrecision',\n 'featureIds': 'objectIds[]',\n 'returnGeometry': 'returnGeometry',\n 'token': 'token'\n },\n\n path: 'query',\n\n params: {\n returnGeometry: true,\n where: '1=1',\n outSr: 4326,\n outFields: '*'\n },\n\n within: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelContains'; // will make code read layer within geometry, to the api this will reads geometry contains layer\n return this;\n },\n\n intersects: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelIntersects';\n return this;\n },\n\n contains: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelWithin'; // will make code read layer contains geometry, to the api this will reads geometry within layer\n return this;\n },\n\n // crosses: function(geometry){\n // this._setGeometry(geometry);\n // this.params.spatialRel = 'esriSpatialRelCrosses';\n // return this;\n // },\n\n // touches: function(geometry){\n // this._setGeometry(geometry);\n // this.params.spatialRel = 'esriSpatialRelTouches';\n // return this;\n // },\n\n overlaps: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelOverlaps';\n return this;\n },\n\n // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online\n nearby: function(latlng, radius){\n latlng = L.latLng(latlng);\n this.params.geometry = ([latlng.lng,latlng.lat]).join(',');\n this.params.geometryType = 'esriGeometryPoint';\n this.params.spatialRel = 'esriSpatialRelIntersects';\n this.params.units = 'esriSRUnit_Meter';\n this.params.distance = radius;\n this.params.inSr = 4326;\n return this;\n },\n\n where: function(string){\n this.params.where = string.replace(/\"/g, \"\\'\"); // jshint ignore:line\n return this;\n },\n\n between: function(start, end){\n this.params.time = ([start.valueOf(), end.valueOf()]).join();\n return this;\n },\n\n fields: function (fields) {\n if (L.Util.isArray(fields)) {\n this.params.outFields = fields.join(',');\n } else {\n this.params.outFields = fields;\n }\n return this;\n },\n\n simplify: function(map, factor){\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\n return this;\n },\n\n orderBy: function(fieldName, order){\n order = order || 'ASC';\n this.params.orderByFields = (this.params.orderByFields) ? this.params.orderByFields + ',' : '';\n this.params.orderByFields += ([fieldName, order]).join(' ');\n return this;\n },\n\n returnGeometry: function(bool){\n this.params.returnGeometry = bool;\n return this;\n },\n\n run: function(callback, context){\n this._cleanParams();\n return this.request(function(error, response){\n callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response);\n }, context);\n },\n\n count: function(callback, context){\n this._cleanParams();\n this.params.returnCountOnly = true;\n return this.request(function(error, response){\n callback.call(this, error, (response && response.count), response);\n }, context);\n },\n\n ids: function(callback, context){\n this._cleanParams();\n this.params.returnIdsOnly = true;\n return this.request(function(error, response){\n callback.call(this, error, (response && response.objectIds), response);\n }, context);\n },\n\n // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online\n bounds: function(callback, context){\n this._cleanParams();\n this.params.returnExtentOnly = true;\n return this.request(function(error, response){\n callback.call(context, error, (response && response.extent && EsriLeaflet.Util.extentToBounds(response.extent)), response);\n }, context);\n },\n\n // only valid for image services\n pixelSize: function(point){\n point = L.point(point);\n this.params.pixelSize = ([point.x,point.y]).join(',');\n return this;\n },\n\n // only valid for map services\n layer: function(layer){\n this.path = layer + '/query';\n return this;\n },\n\n _cleanParams: function(){\n delete this.params.returnIdsOnly;\n delete this.params.returnExtentOnly;\n delete this.params.returnCountOnly;\n },\n\n _setGeometry: function(geometry) {\n this.params.inSr = 4326;\n\n // convert bounds to extent and finish\n if ( geometry instanceof L.LatLngBounds ) {\n // set geometry + geometryType\n this.params.geometry = EsriLeaflet.Util.boundsToExtent(geometry);\n this.params.geometryType = 'esriGeometryEnvelope';\n return;\n }\n\n // convert L.Marker > L.LatLng\n if(geometry.getLatLng){\n geometry = geometry.getLatLng();\n }\n\n // convert L.LatLng to a geojson point and continue;\n if (geometry instanceof L.LatLng) {\n geometry = {\n type: 'Point',\n coordinates: [geometry.lng, geometry.lat]\n };\n }\n\n // handle L.GeoJSON, pull out the first geometry\n if ( geometry instanceof L.GeoJSON ) {\n //reassign geometry to the GeoJSON value (we are assuming that only one feature is present)\n geometry = geometry.getLayers()[0].feature.geometry;\n this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry);\n this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type);\n }\n\n // Handle L.Polyline and L.Polygon\n if (geometry.toGeoJSON) {\n geometry = geometry.toGeoJSON();\n }\n\n // handle GeoJSON feature by pulling out the geometry\n if ( geometry.type === 'Feature' ) {\n // get the geometry of the geojson feature\n geometry = geometry.geometry;\n }\n\n // confirm that our GeoJSON is a point, line or polygon\n if ( geometry.type === 'Point' || geometry.type === 'LineString' || geometry.type === 'Polygon') {\n this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry);\n this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type);\n return;\n }\n\n // warn the user if we havn't found a\n /* global console */\n if(console && console.warn) {\n console.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');\n }\n\n return;\n }\n});\n\nEsriLeaflet.Tasks.query = function(url, params){\n return new EsriLeaflet.Tasks.Query(url, params);\n};","EsriLeaflet.Tasks.Find = EsriLeaflet.Tasks.Task.extend({\n setters: {\n // method name > param name\n 'contains': 'contains',\n 'text': 'searchText',\n 'fields': 'searchFields[]', // denote an array or single string\n 'spatialReference': 'sr',\n 'sr': 'sr',\n 'layers': 'layers[]',\n 'returnGeometry': 'returnGeometry',\n 'maxAllowableOffset': 'maxAllowableOffset',\n 'precision': 'geometryPrecision',\n 'dynamicLayers': 'dynamicLayers',\n 'returnZ' : 'returnZ',\n 'returnM' : 'returnM',\n 'gdbVersion' : 'gdbVersion',\n 'token' : 'token'\n },\n\n path: 'find',\n\n params: {\n sr: 4326,\n contains: true,\n returnGeometry: true,\n returnZ: true,\n returnM: false\n },\n\n layerDefs: function (id, where) {\n this.params.layerDefs = (this.params.layerDefs) ? this.params.layerDefs + ';' : '';\n this.params.layerDefs += ([id, where]).join(':');\n return this;\n },\n\n simplify: function(map, factor){\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\n return this;\n },\n\n run: function (callback, context) {\n return this.request(function(error, response){\n callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response);\n }, context);\n }\n});\n\nEsriLeaflet.Tasks.find = function (url, params) {\n return new EsriLeaflet.Tasks.Find(url, params);\n};","EsriLeaflet.Layers.RasterLayer = L.Class.extend({\n includes: L.Mixin.Events,\n\n options: {\n opacity: 1,\n position: 'front',\n f: 'image'\n },\n\n onAdd: function (map) {\n this._map = map;\n\n this._update = L.Util.limitExecByInterval(this._update, this.options.updateInterval, this);\n\n if (map.options.crs && map.options.crs.code) {\n var sr = map.options.crs.code.split(':')[1];\n this.options.bboxSR = sr;\n this.options.imageSR = sr;\n }\n\n map.on('moveend', this._update, this);\n\n this._update();\n\n if(this._popup){\n this._map.on('click', this._getPopupData, this);\n this._map.on('dblclick', this._resetPopupState, this);\n }\n },\n\n bindPopup: function(fn, popupOptions){\n this._shouldRenderPopup = false;\n this._lastClick = false;\n this._popup = L.popup(popupOptions);\n this._popupFunction = fn;\n if(this._map){\n this._map.on('click', this._getPopupData, this);\n this._map.on('dblclick', this._resetPopupState, this);\n }\n return this;\n },\n\n unbindPopup: function(){\n if(this._map){\n this._map.closePopup(this._popup);\n this._map.off('click', this._getPopupData, this);\n this._map.off('dblclick', this._resetPopupState, this);\n }\n this._popup = false;\n return this;\n },\n\n onRemove: function (map) {\n\n if (this._currentImage) {\n this._map.removeLayer(this._currentImage);\n }\n\n if(this._popup){\n this._map.off('click', this._getPopupData, this);\n this._map.off('dblclick', this._resetPopupState, this);\n }\n\n this._map.off('moveend', this._update, this);\n this._map = null;\n },\n\n addTo: function(map){\n map.addLayer(this);\n return this;\n },\n\n removeFrom: function(map){\n map.removeLayer(this);\n return this;\n },\n\n bringToFront: function(){\n this.options.position = 'front';\n if(this._currentImage){\n this._currentImage.bringToFront();\n }\n return this;\n },\n\n bringToBack: function(){\n this.options.position = 'back';\n if(this._currentImage){\n this._currentImage.bringToBack();\n }\n return this;\n },\n\n getAttribution: function () {\n return this.options.attribution;\n },\n\n getOpacity: function(){\n return this.options.opacity;\n },\n\n setOpacity: function(opacity){\n this.options.opacity = opacity;\n this._currentImage.setOpacity(opacity);\n return this;\n },\n\n getTimeRange: function(){\n return [this.options.from, this.options.to];\n },\n\n setTimeRange: function(from, to){\n this.options.from = from;\n this.options.to = to;\n this._update();\n return this;\n },\n\n metadata: function(callback, context){\n this._service.metadata(callback, context);\n return this;\n },\n\n authenticate: function(token){\n this._service.authenticate(token);\n return this;\n },\n\n _renderImage: function(url, bounds){\n if(this._map){\n var image = new L.ImageOverlay(url, bounds, {\n opacity: 0\n }).addTo(this._map);\n\n image.once('load', function(e){\n var newImage = e.target;\n var oldImage = this._currentImage;\n if(newImage._bounds.equals(bounds)){\n this._currentImage = newImage;\n\n if(this.options.position === 'front'){\n this.bringToFront();\n } else {\n this.bringToBack();\n }\n\n if(this._map && this._currentImage._map){\n this._currentImage.setOpacity(this.options.opacity);\n } else {\n this._currentImage._map.removeLayer(this._currentImage);\n }\n\n if(oldImage){\n this._map.removeLayer(oldImage);\n }\n\n } else {\n this._map.removeLayer(newImage);\n }\n\n this.fire('load', {\n bounds: bounds\n });\n\n }, this);\n\n this.fire('loading', {\n bounds: bounds\n });\n }\n },\n\n _update: function () {\n if(!this._map){\n return;\n }\n\n var zoom = this._map.getZoom();\n var bounds = this._map.getBounds();\n\n if(this._animatingZoom){\n return;\n }\n\n if (this._map._panTransition && this._map._panTransition._inProgress) {\n return;\n }\n\n if (zoom > this.options.maxZoom || zoom < this.options.minZoom) {\n return;\n }\n var params = this._buildExportParams();\n\n this._requestExport(params, bounds);\n },\n\n // TODO: refactor these into raster layer\n _renderPopup: function(latlng, error, results, response){\n latlng = L.latLng(latlng);\n if(this._shouldRenderPopup && this._lastClick.equals(latlng)){\n //add the popup to the map where the mouse was clicked at\n var content = this._popupFunction(error, results, response);\n if (content) {\n this._popup.setLatLng(latlng).setContent(content).openOn(this._map);\n }\n }\n },\n\n _resetPopupState: function(e){\n this._shouldRenderPopup = false;\n this._lastClick = e.latlng;\n },\n\n // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js\n // @TODO remove at Leaflet 0.8\n _propagateEvent: function (e) {\n e = L.extend({\n layer: e.target,\n target: this\n }, e);\n this.fire(e.type, e);\n }\n});","EsriLeaflet.Layers.DynamicMapLayer = EsriLeaflet.Layers.RasterLayer.extend({\n\n options: {\n updateInterval: 150,\n layers: false,\n layerDefs: false,\n timeOptions: false,\n format: 'png24',\n transparent: true\n },\n\n initialize: function (url, options) {\n this.url = EsriLeaflet.Util.cleanUrl(url);\n this._service = new EsriLeaflet.Services.MapService(this.url, options);\n this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', this._propagateEvent, this);\n L.Util.setOptions(this, options);\n },\n\n getLayers: function(){\n return this.options.layers;\n },\n\n setLayers: function(layers){\n this.options.layers = layers;\n this._update();\n return this;\n },\n\n getLayerDefs: function(){\n return this.options.layerDefs;\n },\n\n setLayerDefs: function(layerDefs){\n this.options.layerDefs = layerDefs;\n this._update();\n return this;\n },\n\n getTimeOptions: function(){\n return this.options.timeOptions;\n },\n\n setTimeOptions: function(timeOptions){\n this.options.timeOptions = timeOptions;\n this._update();\n return this;\n },\n\n query: function(){\n return this._service.query();\n },\n\n identify: function(){\n return this._service.identify();\n },\n\n find: function(){\n return this._service.find();\n },\n\n _getPopupData: function(e){\n var callback = L.Util.bind(function(error, featureCollection, response) {\n setTimeout(L.Util.bind(function(){\n this._renderPopup(e.latlng, error, featureCollection, response);\n }, this), 300);\n }, this);\n\n var identifyRequest = this.identify().on(this._map).at(e.latlng);\n\n if(this.options.layers){\n identifyRequest.layers('visible:' + this.options.layers.join(','));\n } else {\n identifyRequest.layers('visible');\n }\n\n identifyRequest.run(callback);\n\n // set the flags to show the popup\n this._shouldRenderPopup = true;\n this._lastClick = e.latlng;\n },\n\n _buildExportParams: function () {\n var bounds = this._map.getBounds();\n var size = this._map.getSize();\n var ne = this._map.options.crs.project(bounds._northEast);\n var sw = this._map.options.crs.project(bounds._southWest);\n\n var params = {\n bbox: [sw.x, sw.y, ne.x, ne.y].join(','),\n size: size.x + ',' + size.y,\n dpi: 96,\n format: this.options.format,\n transparent: this.options.transparent,\n bboxSR: this.options.bboxSR,\n imageSR: this.options.imageSR\n };\n\n if(this.options.layers){\n params.layers = 'show:' + this.options.layers.join(',');\n }\n\n if(this.options.layerDefs){\n params.layerDefs = JSON.stringify(this.options.layerDefs);\n }\n\n if(this.options.timeOptions){\n params.timeOptions = JSON.stringify(this.options.timeOptions);\n }\n\n if(this.options.from && this.options.to){\n params.time = this.options.from.valueOf() + ',' + this.options.to.valueOf();\n }\n\n if(this._service.options.token) {\n params.token = this._service.options.token;\n }\n\n return params;\n },\n\n _requestExport: function (params, bounds) {\n if(this.options.f === 'json'){\n this._service.get('export', params, function(error, response){\n this._renderImage(response.href, bounds);\n }, this);\n } else {\n params.f = 'image';\n this._renderImage(this.url + 'export' + L.Util.getParamString(params), bounds);\n }\n }\n});\n\nEsriLeaflet.DynamicMapLayer = EsriLeaflet.Layers.DynamicMapLayer;\n\nEsriLeaflet.Layers.dynamicMapLayer = function(url, options){\n return new EsriLeaflet.Layers.DynamicMapLayer(url, options);\n};\n\nEsriLeaflet.dynamicMapLayer = function(url, options){\n return new EsriLeaflet.Layers.DynamicMapLayer(url, options);\n};","EsriLeaflet.Layers.TiledMapLayer = L.TileLayer.extend({\n initialize: function(url, options){\n options = L.Util.setOptions(this, options);\n\n // set the urls\n this.url = L.esri.Util.cleanUrl(url);\n this.tileUrl = L.esri.Util.cleanUrl(url) + 'tile/{z}/{y}/{x}';\n this._service = new L.esri.Services.MapService(this.url, options);\n this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', this._propagateEvent, this);\n\n //if this is looking at the AGO tiles subdomain insert the subdomain placeholder\n if(this.tileUrl.match('://tiles.arcgisonline.com')){\n this.tileUrl = this.tileUrl.replace('://tiles.arcgisonline.com', '://tiles{s}.arcgisonline.com');\n options.subdomains = ['1', '2', '3', '4'];\n }\n\n if(this.options.token) {\n this.tileUrl += ('?token=' + this.options.token);\n }\n\n // init layer by calling TileLayers initialize method\n L.TileLayer.prototype.initialize.call(this, this.tileUrl, options);\n },\n\n metadata: function(callback, context){\n this._service.metadata(callback, context);\n return this;\n },\n\n identify: function(){\n return this._service.identify();\n },\n\n authenticate: function(token){\n var tokenQs = '?token=' + token;\n this.tileUrl = (this.options.token) ? this.tileUrl.replace(/\\?token=(.+)/g, tokenQs) : this.tileUrl + tokenQs;\n this.options.token = token;\n this._service.authenticate(token);\n return this;\n },\n\n // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js\n // @TODO remove at Leaflet 0.8\n _propagateEvent: function (e) {\n e = L.extend({\n layer: e.target,\n target: this\n }, e);\n this.fire(e.type, e);\n }\n});\n\nL.esri.TiledMapLayer = L.esri.Layers.tiledMapLayer;\n\nL.esri.Layers.tiledMapLayer = function(url, options){\n return new L.esri.Layers.TiledMapLayer(url, options);\n};\n\nL.esri.tiledMapLayer = function(url, options){\n return new L.esri.Layers.TiledMapLayer(url, options);\n};"]} \ No newline at end of file diff --git a/dist/esri-leaflet-src.js b/dist/esri-leaflet-src.js new file mode 100644 index 000000000..64adf137d --- /dev/null +++ b/dist/esri-leaflet-src.js @@ -0,0 +1,3335 @@ +/*! esri-leaflet - v1.0.0-rc.3 - 2014-11-04 +* Copyright (c) 2014 Environmental Systems Research Institute, Inc. +* Apache License*/ +(function (factory) { + //define an AMD module that relies on 'leaflet' + if (typeof define === 'function' && define.amd) { + define(['leaflet'], function (L) { + return factory(L); + }); + //define a common js module that relies on 'leaflet' + } else if (typeof module === 'object' && typeof module.exports === 'object') { + module.exports = factory(require('leaflet')); + } + + if(typeof window !== 'undefined' && window.L){ + factory(window.L); + } +}(function (L) { +var EsriLeaflet = { //jshint ignore:line + VERSION: '1.0.0-rc.2', + Layers: {}, + Services: {}, + Controls: {}, + Tasks: {}, + Util: {}, + Support: { + CORS: !!(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()), + pointerEvents: document.documentElement.style.pointerEvents === '' + } +}; + +if(typeof window !== 'undefined' && window.L){ + window.L.esri = EsriLeaflet; +} + +(function(EsriLeaflet){ + + // shallow object clone for feature properties and attributes + // from http://jsperf.com/cloning-an-object/2 + function clone(obj) { + var target = {}; + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + target[i] = obj[i]; + } + } + return target; + } + + // checks if 2 x,y points are equal + function pointsEqual(a, b) { + for (var i = 0; i < a.length; i++) { + if (a[i] !== b[i]) { + return false; + } + } + return true; + } + + // checks if the first and last points of a ring are equal and closes the ring + function closeRing(coordinates) { + if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) { + coordinates.push(coordinates[0]); + } + return coordinates; + } + + // determine if polygon ring coordinates are clockwise. clockwise signifies outer ring, counter-clockwise an inner ring + // or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon- + // points-are-in-clockwise-order + function ringIsClockwise(ringToTest) { + var total = 0,i = 0; + var rLength = ringToTest.length; + var pt1 = ringToTest[i]; + var pt2; + for (i; i < rLength - 1; i++) { + pt2 = ringToTest[i + 1]; + total += (pt2[0] - pt1[0]) * (pt2[1] + pt1[1]); + pt1 = pt2; + } + return (total >= 0); + } + + // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L504-L519 + function vertexIntersectsVertex(a1, a2, b1, b2) { + var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]); + var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]); + var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]); + + if ( uB !== 0 ) { + var ua = uaT / uB; + var ub = ubT / uB; + + if ( 0 <= ua && ua <= 1 && 0 <= ub && ub <= 1 ) { + return true; + } + } + + return false; + } + + // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L521-L531 + function arrayIntersectsArray(a, b) { + for (var i = 0; i < a.length - 1; i++) { + for (var j = 0; j < b.length - 1; j++) { + if (vertexIntersectsVertex(a[i], a[i + 1], b[j], b[j + 1])) { + return true; + } + } + } + + return false; + } + + // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L470-L480 + function coordinatesContainPoint(coordinates, point) { + var contains = false; + for(var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) { + if (((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1]) || + (coordinates[j][1] <= point[1] && point[1] < coordinates[i][1])) && + (point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0])) { + contains = !contains; + } + } + return contains; + } + + // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L106-L113 + function coordinatesContainCoordinates(outer, inner){ + var intersects = arrayIntersectsArray(outer, inner); + var contains = coordinatesContainPoint(outer, inner[0]); + if(!intersects && contains){ + return true; + } + return false; + } + + // do any polygons in this array contain any other polygons in this array? + // used for checking for holes in arcgis rings + // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L117-L172 + function convertRingsToGeoJSON(rings){ + var outerRings = []; + var holes = []; + var x; // iterator + var outerRing; // current outer ring being evaluated + var hole; // current hole being evaluated + + // for each ring + for (var r = 0; r < rings.length; r++) { + var ring = closeRing(rings[r].slice(0)); + if(ring.length < 4){ + continue; + } + // is this ring an outer ring? is it clockwise? + if(ringIsClockwise(ring)){ + var polygon = [ ring ]; + outerRings.push(polygon); // push to outer rings + } else { + holes.push(ring); // counterclockwise push to holes + } + } + + var uncontainedHoles = []; + + // while there are holes left... + while(holes.length){ + // pop a hole off out stack + hole = holes.pop(); + + // loop over all outer rings and see if they contain our hole. + var contained = false; + for (x = outerRings.length - 1; x >= 0; x--) { + outerRing = outerRings[x][0]; + if(coordinatesContainCoordinates(outerRing, hole)){ + // the hole is contained push it into our polygon + outerRings[x].push(hole); + contained = true; + break; + } + } + + // ring is not contained in any outer ring + // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320 + if(!contained){ + uncontainedHoles.push(hole); + } + } + + // if we couldn't match any holes using contains we can try intersects... + while(uncontainedHoles.length){ + // pop a hole off out stack + hole = uncontainedHoles.pop(); + + // loop over all outer rings and see if any intersect our hole. + var intersects = false; + for (x = outerRings.length - 1; x >= 0; x--) { + outerRing = outerRings[x][0]; + if(arrayIntersectsArray(outerRing, hole)){ + // the hole is contained push it into our polygon + outerRings[x].push(hole); + intersects = true; + break; + } + } + + if(!intersects) { + outerRings.push([hole.reverse()]); + } + } + + if(outerRings.length === 1){ + return { + type: 'Polygon', + coordinates: outerRings[0] + }; + } else { + return { + type: 'MultiPolygon', + coordinates: outerRings + }; + } + } + + // This function ensures that rings are oriented in the right directions + // outer rings are clockwise, holes are counterclockwise + // used for converting GeoJSON Polygons to ArcGIS Polygons + function orientRings(poly){ + var output = []; + var polygon = poly.slice(0); + var outerRing = closeRing(polygon.shift().slice(0)); + if(outerRing.length >= 4){ + if(!ringIsClockwise(outerRing)){ + outerRing.reverse(); + } + + output.push(outerRing); + + for (var i = 0; i < polygon.length; i++) { + var hole = closeRing(polygon[i].slice(0)); + if(hole.length >= 4){ + if(ringIsClockwise(hole)){ + hole.reverse(); + } + output.push(hole); + } + } + } + + return output; + } + + // This function flattens holes in multipolygons to one array of polygons + // used for converting GeoJSON Polygons to ArcGIS Polygons + function flattenMultiPolygonRings(rings){ + var output = []; + for (var i = 0; i < rings.length; i++) { + var polygon = orientRings(rings[i]); + for (var x = polygon.length - 1; x >= 0; x--) { + var ring = polygon[x].slice(0); + output.push(ring); + } + } + return output; + } + + // convert an extent (ArcGIS) to LatLngBounds (Leaflet) + EsriLeaflet.Util.extentToBounds = function(extent){ + var sw = new L.LatLng(extent.ymin, extent.xmin); + var ne = new L.LatLng(extent.ymax, extent.xmax); + return new L.LatLngBounds(sw, ne); + }; + + // convert an LatLngBounds (Leaflet) to extent (ArcGIS) + EsriLeaflet.Util.boundsToExtent = function(bounds) { + bounds = L.latLngBounds(bounds); + return { + 'xmin': bounds.getSouthWest().lng, + 'ymin': bounds.getSouthWest().lat, + 'xmax': bounds.getNorthEast().lng, + 'ymax': bounds.getNorthEast().lat, + 'spatialReference': { + 'wkid' : 4326 + } + }; + }; + + EsriLeaflet.Util.arcgisToGeojson = function (arcgis, idAttribute){ + var geojson = {}; + + if(typeof arcgis.x === 'number' && typeof arcgis.y === 'number'){ + geojson.type = 'Point'; + geojson.coordinates = [arcgis.x, arcgis.y]; + } + + if(arcgis.points){ + geojson.type = 'MultiPoint'; + geojson.coordinates = arcgis.points.slice(0); + } + + if(arcgis.paths) { + if(arcgis.paths.length === 1){ + geojson.type = 'LineString'; + geojson.coordinates = arcgis.paths[0].slice(0); + } else { + geojson.type = 'MultiLineString'; + geojson.coordinates = arcgis.paths.slice(0); + } + } + + if(arcgis.rings) { + geojson = convertRingsToGeoJSON(arcgis.rings.slice(0)); + } + + if(arcgis.geometry || arcgis.attributes) { + geojson.type = 'Feature'; + geojson.geometry = (arcgis.geometry) ? EsriLeaflet.Util.arcgisToGeojson(arcgis.geometry) : null; + geojson.properties = (arcgis.attributes) ? clone(arcgis.attributes) : null; + if(arcgis.attributes) { + geojson.id = arcgis.attributes[idAttribute] || arcgis.attributes.OBJECTID || arcgis.attributes.FID; + } + } + + return geojson; + }; + + // GeoJSON -> ArcGIS + EsriLeaflet.Util.geojsonToArcGIS = function(geojson, idAttribute){ + idAttribute = idAttribute || 'OBJECTID'; + var spatialReference = { wkid: 4326 }; + var result = {}; + var i; + + switch(geojson.type){ + case 'Point': + result.x = geojson.coordinates[0]; + result.y = geojson.coordinates[1]; + result.spatialReference = spatialReference; + break; + case 'MultiPoint': + result.points = geojson.coordinates.slice(0); + result.spatialReference = spatialReference; + break; + case 'LineString': + result.paths = [geojson.coordinates.slice(0)]; + result.spatialReference = spatialReference; + break; + case 'MultiLineString': + result.paths = geojson.coordinates.slice(0); + result.spatialReference = spatialReference; + break; + case 'Polygon': + result.rings = orientRings(geojson.coordinates.slice(0)); + result.spatialReference = spatialReference; + break; + case 'MultiPolygon': + result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0)); + result.spatialReference = spatialReference; + break; + case 'Feature': + if(geojson.geometry) { + result.geometry = EsriLeaflet.Util.geojsonToArcGIS(geojson.geometry, idAttribute); + } + result.attributes = (geojson.properties) ? clone(geojson.properties) : {}; + if(geojson.id){ + result.attributes[idAttribute] = geojson.id; + } + break; + case 'FeatureCollection': + result = []; + for (i = 0; i < geojson.features.length; i++){ + result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.features[i], idAttribute)); + } + break; + case 'GeometryCollection': + result = []; + for (i = 0; i < geojson.geometries.length; i++){ + result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.geometries[i], idAttribute)); + } + break; + } + + return result; + }; + + EsriLeaflet.Util.responseToFeatureCollection = function(response, idAttribute){ + var objectIdField; + + if(idAttribute){ + objectIdField = idAttribute; + } else if(response.objectIdFieldName){ + objectIdField = response.objectIdFieldName; + } else if(response.fields) { + for (var j = 0; j <= response.fields.length - 1; j++) { + if(response.fields[j].type === 'esriFieldTypeOID') { + objectIdField = response.fields[j].name; + break; + } + } + } else { + objectIdField = 'OBJECTID'; + } + + var featureCollection = { + type: 'FeatureCollection', + features: [] + }; + var features = response.features || response.results; + if(features.length){ + for (var i = features.length - 1; i >= 0; i--) { + featureCollection.features.push(EsriLeaflet.Util.arcgisToGeojson(features[i], objectIdField)); + } + } + + return featureCollection; + }; + + // trim whitespace and add a tailing slash is needed to a url + EsriLeaflet.Util.cleanUrl = function(url){ + url = url.replace(/\s\s*/g, ''); + + //add a trailing slash to the url if the user omitted it + if(url[url.length-1] !== '/'){ + url += '/'; + } + + return url; + }; + + EsriLeaflet.Util.geojsonTypeToArcGIS = function (geoJsonType) { + var arcgisGeometryType; + switch (geoJsonType) { + case 'Point': + arcgisGeometryType = 'esriGeometryPoint'; + break; + case 'MultiPoint': + arcgisGeometryType = 'esriGeometryMultipoint'; + break; + case 'LineString': + arcgisGeometryType = 'esriGeometryPolyline'; + break; + case 'MultiLineString': + arcgisGeometryType = 'esriGeometryPolyline'; + break; + case 'Polygon': + arcgisGeometryType = 'esriGeometryPolygon'; + break; + case 'MultiPolygon': + arcgisGeometryType = 'esriGeometryPolygon'; + break; + } + return arcgisGeometryType; + }; + +})(EsriLeaflet); + +(function(EsriLeaflet){ + + var callbacks = 0; + + window._EsriLeafletCallbacks = {}; + + function serialize(params){ + var data = ''; + + params.f = 'json'; + + for (var key in params){ + if(params.hasOwnProperty(key)){ + var param = params[key]; + var type = Object.prototype.toString.call(param); + var value; + + if(data.length){ + data += '&'; + } + + if(type === '[object Array]' || type === '[object Object]'){ + value = JSON.stringify(param); + } else if (type === '[object Date]'){ + value = param.valueOf(); + } else { + value = param; + } + + data += encodeURIComponent(key) + '=' + encodeURIComponent(value); + } + } + + return data; + } + + function createRequest(callback, context){ + var httpRequest = new XMLHttpRequest(); + + httpRequest.onerror = function(e) { + callback.call(context, { + error: { + code: 500, + message: 'XMLHttpRequest error' + } + }, null); + }; + + httpRequest.onreadystatechange = function(){ + var response; + var error; + + if (httpRequest.readyState === 4) { + try { + response = JSON.parse(httpRequest.responseText); + } catch(e) { + response = null; + error = { + code: 500, + message: 'Could not parse response as JSON.' + }; + } + + if (!error && response.error) { + error = response.error; + response = null; + } + + callback.call(context, error, response); + } + }; + + return httpRequest; + } + + // AJAX handlers for CORS (modern browsers) or JSONP (older browsers) + EsriLeaflet.Request = { + request: function(url, params, callback, context){ + var paramString = serialize(params); + var httpRequest = createRequest(callback, context); + var requestLength = (url + '?' + paramString).length; + + // request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest + if(requestLength <= 2000 && L.esri.Support.CORS){ + httpRequest.open('GET', url + '?' + paramString); + httpRequest.send(null); + + // request is less more then 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest + } else if (requestLength > 2000 && L.esri.Support.CORS){ + httpRequest.open('POST', url); + httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + httpRequest.send(paramString); + + // request is less more then 2000 characters and the browser does not support CORS, make a JSONP request + } else if(requestLength <= 2000 && !L.esri.Support.CORS){ + return L.esri.Request.get.JSONP(url, params, callback, context); + + // request is longer then 2000 characters and the browser does not support CORS, log a warning + } else { + if(console && console.warn){ + console.warn('a request to ' + url + ' 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'); + return; + } + } + + return httpRequest; + }, + post: { + XMLHTTP: function (url, params, callback, context) { + var httpRequest = createRequest(callback, context); + httpRequest.open('POST', url); + httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + httpRequest.send(serialize(params)); + + return httpRequest; + } + }, + + get: { + CORS: function (url, params, callback, context) { + var httpRequest = createRequest(callback, context); + + httpRequest.open('GET', url + '?' + serialize(params), true); + httpRequest.send(null); + + return httpRequest; + }, + JSONP: function(url, params, callback, context){ + 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){ + if(window._EsriLeafletCallbacks[callbackId] !== true){ + var error; + var responseType = Object.prototype.toString.call(response); + + if(!(responseType === '[object Object]' || responseType === '[object Array]')){ + error = { + error: { + code: 500, + message: 'Expected array or object as JSONP response' + } + }; + response = null; + } + + if (!error && response.error) { + error = response; + response = null; + } + + callback.call(context, error, response); + window._EsriLeafletCallbacks[callbackId] = true; + } + }; + + callbacks++; + + return { + id: callbackId, + url: script.src, + abort: function(){ + window._EsriLeafletCallbacks._callback[callbackId]({ + code: 0, + message: 'Request aborted.' + }); + } + }; + } + } + }; + + // Choose the correct AJAX handler depending on CORS support + EsriLeaflet.get = (EsriLeaflet.Support.CORS) ? EsriLeaflet.Request.get.CORS : EsriLeaflet.Request.get.JSONP; + + // Always use XMLHttpRequest for posts + EsriLeaflet.post = EsriLeaflet.Request.post.XMLHTTP; + + // expose a common request method the uses GET\POST based on request length + EsriLeaflet.request = EsriLeaflet.Request.request; + +})(EsriLeaflet); + +EsriLeaflet.Services.Service = L.Class.extend({ + + includes: L.Mixin.Events, + + options: { + proxy: false, + useCors: EsriLeaflet.Support.CORS + }, + + initialize: function (url, options) { + this.url = EsriLeaflet.Util.cleanUrl(url); + this._requestQueue = []; + this._authenticating = false; + L.Util.setOptions(this, options); + }, + + get: function (path, params, callback, context) { + return this._request('get', path, params, callback, context); + }, + + post: function (path, params, callback, context) { + return this._request('post', path, params, callback, context); + }, + + request: function (path, params, callback, context) { + return this._request('request', path, params, callback, context); + }, + + metadata: function (callback, context) { + return this._request('get', '', {}, callback, context); + }, + + authenticate: function(token){ + this._authenticating = false; + this.options.token = token; + this._runQueue(); + return this; + }, + + _request: function(method, path, params, callback, context){ + this.fire('requeststart', { + url: this.url + path, + params: params, + method: method + }); + + var wrappedCallback = this._createServiceCallback(method, path, params, callback, context); + + if (this.options.token) { + params.token = this.options.token; + } + + if (this._authenticating) { + this._requestQueue.push([method, path, params, callback, context]); + return; + } else { + var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path; + + if((method === 'get' || method === 'request') && !this.options.useCors){ + return EsriLeaflet.Request.get.JSONP(url, params, wrappedCallback); + } else { + return EsriLeaflet[method](url, params, wrappedCallback); + } + } + }, + + _createServiceCallback: function(method, path, params, callback, context){ + var request = [method, path, params, callback, context]; + + return L.Util.bind(function(error, response){ + + if (error && (error.code === 499 || error.code === 498)) { + this._authenticating = true; + + this._requestQueue.push(request); + + this.fire('authenticationrequired', { + authenticate: L.Util.bind(this.authenticate, this) + }); + } else { + callback.call(context, error, response); + + if(error) { + this.fire('requesterror', { + url: this.url + path, + params: params, + message: error.message, + code: error.code, + method: method + }); + } else { + this.fire('requestsuccess', { + url: this.url + path, + params: params, + response: response, + method: method + }); + } + + this.fire('requestend', { + url: this.url + path, + params: params, + method: method + }); + } + }, this); + }, + + _runQueue: function(){ + for (var i = this._requestQueue.length - 1; i >= 0; i--) { + var request = this._requestQueue[i]; + var method = request.shift(); + this[method].apply(this, request); + } + this._requestQueue = []; + } + +}); + +EsriLeaflet.Services.service = function(url, params){ + return new EsriLeaflet.Services.Service(url, params); +}; + +EsriLeaflet.Services.FeatureLayer = EsriLeaflet.Services.Service.extend({ + + options: { + idAttribute: 'OBJECTID' + }, + + query: function(){ + return new EsriLeaflet.Tasks.Query(this); + }, + + addFeature: function(feature, callback, context) { + delete feature.id; + + feature = EsriLeaflet.Util.geojsonToArcGIS(feature); + + return this.post('addFeatures', { + features: [feature] + }, function(error, response){ + var result = (response && response.addResults) ? response.addResults[0] : undefined; + if(callback){ + callback.call(this, error || response.addResults[0].error, result); + } + }, context); + }, + + updateFeature: function(feature, callback, context) { + feature = EsriLeaflet.Util.geojsonToArcGIS(feature, this.options.idAttribute); + + return this.post('updateFeatures', { + features: [feature] + }, function(error, response){ + var result = (response && response.updateResults) ? response.updateResults[0] : undefined; + if(callback){ + callback.call(context, error || response.updateResults[0].error, result); + } + }, context); + }, + + deleteFeature: function(id, callback, context) { + return this.post('deleteFeatures', { + objectIds: id + }, function(error, response){ + var result = (response && response.deleteResults) ? response.deleteResults[0] : undefined; + if(callback){ + callback.call(context, error || response.deleteResults[0].error, result); + } + }, context); + } + +}); + +EsriLeaflet.Services.featureLayer = function(url, options) { + return new EsriLeaflet.Services.FeatureLayer(url, options); +}; + +EsriLeaflet.Services.MapService = EsriLeaflet.Services.Service.extend({ + + identify: function () { + return new EsriLeaflet.Tasks.identifyFeatures(this); + }, + + find: function () { + return new EsriLeaflet.Tasks.Find(this); + }, + + query: function () { + return new EsriLeaflet.Tasks.Query(this); + } + +}); + +EsriLeaflet.Services.mapService = function(url, params){ + return new EsriLeaflet.Services.MapService(url, params); +}; + +EsriLeaflet.Services.ImageService = EsriLeaflet.Services.Service.extend({ + + query: function () { + return new EsriLeaflet.Tasks.Query(this); + }, + + identify: function() { + return new EsriLeaflet.Tasks.IdentifyImage(this); + } +}); + +EsriLeaflet.Services.imageService = function(url, params){ + return new EsriLeaflet.Services.ImageService(url, params); +}; + +EsriLeaflet.Tasks.Task = L.Class.extend({ + + options: { + proxy: false, + useCors: EsriLeaflet.Support.CORS + }, + + //Generate a method for each methodName:paramName in the setters for this task. + generateSetter: function(param, context){ + var isArray = param.match(/([a-zA-Z]+)\[\]/); + + param = (isArray) ? isArray[1] : param; + + if(isArray){ + return L.Util.bind(function(value){ + // this.params[param] = (this.params[param]) ? this.params[param] + ',' : ''; + if (L.Util.isArray(value)) { + this.params[param] = value.join(','); + } else { + this.params[param] = value; + } + return this; + }, context); + } else { + return L.Util.bind(function(value){ + this.params[param] = value; + return this; + }, context); + } + }, + + initialize: function(endpoint, options){ + // endpoint can be either a url to an ArcGIS Rest Service or an instance of EsriLeaflet.Service + if(endpoint.url && endpoint.request){ + this._service = endpoint; + this.url = endpoint.url; + } else { + this.url = EsriLeaflet.Util.cleanUrl(endpoint); + } + + // clone default params into this object + this.params = L.Util.extend({}, this.params || {}); + + // generate setter methods based on the setters object implimented a child class + if(this.setters){ + for (var setter in this.setters){ + var param = this.setters[setter]; + this[setter] = this.generateSetter(param, this); + } + } + + L.Util.setOptions(this, options); + }, + + token: function(token){ + if(this._service){ + this._service.authenticate(token); + } else { + this.params.token = token; + } + return this; + }, + + request: function(callback, context){ + if(this._service){ + return this._service.request(this.path, this.params, callback, context); + } else { + return this._request('request', this.path, this.params, callback, context); + } + }, + + _request: function(method, path, params, callback, context){ + var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path; + if((method === 'get' || method === 'request') && !this.options.useCors){ + return EsriLeaflet.Request.get.JSONP(url, params, callback, context); + } else{ + return EsriLeaflet[method](url, params, callback, context); + } + } +}); + +EsriLeaflet.Tasks.Query = EsriLeaflet.Tasks.Task.extend({ + setters: { + 'offset': 'offset', + 'limit': 'limit', + 'outFields': 'fields[]', + 'precision': 'geometryPrecision', + 'featureIds': 'objectIds[]', + 'returnGeometry': 'returnGeometry', + 'token': 'token' + }, + + path: 'query', + + params: { + returnGeometry: true, + where: '1=1', + outSr: 4326, + outFields: '*' + }, + + within: function(geometry){ + this._setGeometry(geometry); + this.params.spatialRel = 'esriSpatialRelContains'; // will make code read layer within geometry, to the api this will reads geometry contains layer + return this; + }, + + intersects: function(geometry){ + this._setGeometry(geometry); + this.params.spatialRel = 'esriSpatialRelIntersects'; + return this; + }, + + contains: function(geometry){ + this._setGeometry(geometry); + this.params.spatialRel = 'esriSpatialRelWithin'; // will make code read layer contains geometry, to the api this will reads geometry within layer + return this; + }, + + // crosses: function(geometry){ + // this._setGeometry(geometry); + // this.params.spatialRel = 'esriSpatialRelCrosses'; + // return this; + // }, + + // touches: function(geometry){ + // this._setGeometry(geometry); + // this.params.spatialRel = 'esriSpatialRelTouches'; + // return this; + // }, + + overlaps: function(geometry){ + this._setGeometry(geometry); + this.params.spatialRel = 'esriSpatialRelOverlaps'; + return this; + }, + + // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online + nearby: function(latlng, radius){ + latlng = L.latLng(latlng); + this.params.geometry = ([latlng.lng,latlng.lat]).join(','); + this.params.geometryType = 'esriGeometryPoint'; + this.params.spatialRel = 'esriSpatialRelIntersects'; + this.params.units = 'esriSRUnit_Meter'; + this.params.distance = radius; + this.params.inSr = 4326; + return this; + }, + + where: function(string){ + this.params.where = string.replace(/"/g, "\'"); // jshint ignore:line + return this; + }, + + between: function(start, end){ + this.params.time = ([start.valueOf(), end.valueOf()]).join(); + return this; + }, + + fields: function (fields) { + if (L.Util.isArray(fields)) { + this.params.outFields = fields.join(','); + } else { + this.params.outFields = fields; + } + return this; + }, + + simplify: function(map, factor){ + var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast()); + this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor; + return this; + }, + + orderBy: function(fieldName, order){ + order = order || 'ASC'; + this.params.orderByFields = (this.params.orderByFields) ? this.params.orderByFields + ',' : ''; + this.params.orderByFields += ([fieldName, order]).join(' '); + return this; + }, + + returnGeometry: function(bool){ + this.params.returnGeometry = bool; + return this; + }, + + run: function(callback, context){ + this._cleanParams(); + return this.request(function(error, response){ + callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response); + }, context); + }, + + count: function(callback, context){ + this._cleanParams(); + this.params.returnCountOnly = true; + return this.request(function(error, response){ + callback.call(this, error, (response && response.count), response); + }, context); + }, + + ids: function(callback, context){ + this._cleanParams(); + this.params.returnIdsOnly = true; + return this.request(function(error, response){ + callback.call(this, error, (response && response.objectIds), response); + }, context); + }, + + // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online + bounds: function(callback, context){ + this._cleanParams(); + this.params.returnExtentOnly = true; + return this.request(function(error, response){ + callback.call(context, error, (response && response.extent && EsriLeaflet.Util.extentToBounds(response.extent)), response); + }, context); + }, + + // only valid for image services + pixelSize: function(point){ + point = L.point(point); + this.params.pixelSize = ([point.x,point.y]).join(','); + return this; + }, + + // only valid for map services + layer: function(layer){ + this.path = layer + '/query'; + return this; + }, + + _cleanParams: function(){ + delete this.params.returnIdsOnly; + delete this.params.returnExtentOnly; + delete this.params.returnCountOnly; + }, + + _setGeometry: function(geometry) { + this.params.inSr = 4326; + + // convert bounds to extent and finish + if ( geometry instanceof L.LatLngBounds ) { + // set geometry + geometryType + this.params.geometry = EsriLeaflet.Util.boundsToExtent(geometry); + this.params.geometryType = 'esriGeometryEnvelope'; + return; + } + + // convert L.Marker > L.LatLng + if(geometry.getLatLng){ + geometry = geometry.getLatLng(); + } + + // convert L.LatLng to a geojson point and continue; + if (geometry instanceof L.LatLng) { + geometry = { + type: 'Point', + coordinates: [geometry.lng, geometry.lat] + }; + } + + // handle L.GeoJSON, pull out the first geometry + if ( geometry instanceof L.GeoJSON ) { + //reassign geometry to the GeoJSON value (we are assuming that only one feature is present) + geometry = geometry.getLayers()[0].feature.geometry; + this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry); + this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type); + } + + // Handle L.Polyline and L.Polygon + if (geometry.toGeoJSON) { + geometry = geometry.toGeoJSON(); + } + + // handle GeoJSON feature by pulling out the geometry + if ( geometry.type === 'Feature' ) { + // get the geometry of the geojson feature + geometry = geometry.geometry; + } + + // confirm that our GeoJSON is a point, line or polygon + if ( geometry.type === 'Point' || geometry.type === 'LineString' || geometry.type === 'Polygon') { + this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry); + this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type); + return; + } + + // warn the user if we havn't found a + /* global console */ + if(console && console.warn) { + console.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'); + } + + return; + } +}); + +EsriLeaflet.Tasks.query = function(url, params){ + return new EsriLeaflet.Tasks.Query(url, params); +}; + +EsriLeaflet.Tasks.Find = EsriLeaflet.Tasks.Task.extend({ + setters: { + // method name > param name + 'contains': 'contains', + 'text': 'searchText', + 'fields': 'searchFields[]', // denote an array or single string + '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: true, + returnGeometry: true, + returnZ: true, + returnM: false + }, + + layerDefs: function (id, where) { + this.params.layerDefs = (this.params.layerDefs) ? this.params.layerDefs + ';' : ''; + this.params.layerDefs += ([id, where]).join(':'); + return this; + }, + + simplify: function(map, factor){ + var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast()); + this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor; + return this; + }, + + run: function (callback, context) { + return this.request(function(error, response){ + callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response); + }, context); + } +}); + +EsriLeaflet.Tasks.find = function (url, params) { + return new EsriLeaflet.Tasks.Find(url, params); +}; + +EsriLeaflet.Tasks.Identify = EsriLeaflet.Tasks.Task.extend({ + path: 'identify', + + between: function(start, end){ + this.params.time = ([start.valueOf(), end.valueOf()]).join(','); + return this; + }, + + returnGeometry: function (returnGeometry) { + this.params.returnGeometry = returnGeometry; + return this; + } +}); + + +EsriLeaflet.Tasks.IdentifyImage = EsriLeaflet.Tasks.Identify.extend({ + setters: { + 'setMosaicRule': 'mosaicRule', + 'setRenderingRule': 'renderingRule', + 'returnCatalogItems': 'returnCatalogItems' + }, + + params: { + returnGeometry: false + }, + + at: function(latlng){ + latlng = L.latLng(latlng); + this.params.geometry = JSON.stringify({ + x: latlng.lng, + y: latlng.lat, + spatialReference:{ + wkid: 4326 + } + }); + this.params.geometryType = 'esriGeometryPoint'; + return this; + }, + + getMosaicRule: function() { + return this.params.mosaicRule; + }, + + getRenderingRule: function() { + return this.params.renderingRule; + }, + + setPixelSize: function(pixelSize) { + this.params.pixelSize = pixelSize.join ? pixelSize.join(',') : pixelSize; + return this; + }, + + getPixelSize: function() { + return this.params.pixelSize; + }, + + run: function (callback, context){ + return this.request(function(error, response){ + callback.call(context, error, (response && this._responseToGeoJSON(response)), response); + }, this); + }, + + // get pixel data and return as geoJSON point + // populate catalog items (if any) + // merging in any catalogItemVisibilities as a propery of each feature + _responseToGeoJSON: function(response) { + var location = response.location; + var catalogItems = response.catalogItems; + var catalogItemVisibilities = response.catalogItemVisibilities; + var geoJSON = { + 'pixel': { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [location.x, location.y] + }, + 'crs': { + 'type': 'EPSG', + 'properties': { + 'code': location.spatialReference.wkid + } + }, + 'properties': { + 'OBJECTID': response.objectId, + 'name': response.name, + 'value': response.value + }, + 'id': response.objectId + } + }; + if (response.properties && response.properties.Values) { + geoJSON.pixel.properties.values = response.properties.Values; + } + if (catalogItems && catalogItems.features) { + geoJSON.catalogItems = EsriLeaflet.Util.responseToFeatureCollection(catalogItems); + if (catalogItemVisibilities && catalogItemVisibilities.length === geoJSON.catalogItems.features.length) { + for (var i = catalogItemVisibilities.length - 1; i >= 0; i--) { + geoJSON.catalogItems.features[i].properties.catalogItemVisibility = catalogItemVisibilities[i]; + } + } + } + return geoJSON; + } + +}); + +EsriLeaflet.Tasks.identifyImage = function(url, params){ + return new EsriLeaflet.Tasks.IdentifyImage(url, params); +}; + +EsriLeaflet.Tasks.IdentifyFeatures = EsriLeaflet.Tasks.Identify.extend({ + setters: { + 'layers': 'layers', + 'precision': 'geometryPrecision', + 'tolerance': 'tolerance' + }, + + params: { + sr: 4326, + layers: 'all', + tolerance: 3, + returnGeometry: true + }, + + on: function(map){ + var extent = EsriLeaflet.Util.boundsToExtent(map.getBounds()); + var size = map.getSize(); + this.params.imageDisplay = [size.x, size.y, 96].join(','); + this.params.mapExtent=([extent.xmin, extent.ymin, extent.xmax, extent.ymax]).join(','); + return this; + }, + + at: function(latlng){ + latlng = L.latLng(latlng); + this.params.geometry = ([latlng.lng, latlng.lat]).join(','); + this.params.geometryType = 'esriGeometryPoint'; + return this; + }, + + layerDef: function (id, where){ + this.params.layerDefs = (this.params.layerDefs) ? this.params.layerDefs + ';' : ''; + this.params.layerDefs += ([id, where]).join(':'); + return this; + }, + + simplify: function(map, factor){ + var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast()); + this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * (1 - factor); + return this; + }, + + run: function (callback, context){ + return this.request(function(error, response){ + callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response); + }, context); + } + +}); + +EsriLeaflet.Tasks.identifyFeatures = function(url, params){ + return new EsriLeaflet.Tasks.IdentifyFeatures(url, params); +}; + +(function(EsriLeaflet){ + + var tileProtocol = (window.location.protocol !== 'https:') ? 'http:' : 'https:'; + + EsriLeaflet.Layers.BasemapLayer = L.TileLayer.extend({ + statics: { + TILES: { + Streets: { + urlTemplate: tileProtocol + '//{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: false, + logoPosition: 'bottomright', + minZoom: 1, + maxZoom: 19, + subdomains: ['server', 'services'], + attribution: 'Esri' + } + }, + Topographic: { + urlTemplate: tileProtocol + '//{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: false, + logoPosition: 'bottomright', + minZoom: 1, + maxZoom: 19, + subdomains: ['server', 'services'], + attribution: 'Esri' + } + }, + Oceans: { + urlTemplate: tileProtocol + '//{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: false, + logoPosition: 'bottomright', + minZoom: 1, + maxZoom: 16, + subdomains: ['server', 'services'], + attribution: 'Esri' + } + }, + OceansLabels: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: true, + logoPosition: 'bottomright', + //pane: 'esri-label', + minZoom: 1, + maxZoom: 16, + subdomains: ['server', 'services'] + } + }, + NationalGeographic: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: false, + logoPosition: 'bottomright', + minZoom: 1, + maxZoom: 16, + subdomains: ['server', 'services'], + attribution: 'Esri' + } + }, + DarkGray: { + urlTemplate: tileProtocol + '//tiles{s}.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Dark_Gray_Base_Beta/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: false, + logoPosition: 'bottomright', + minZoom: 1, + maxZoom: 10, + subdomains: ['1', '2'], + attribution: 'Esri, DeLorme, HERE' + } + }, + DarkGrayLabels: { + urlTemplate: tileProtocol + '//tiles{s}.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Dark_Gray_Reference_Beta/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: true, + logoPosition: 'bottomright', + //pane: 'esri-label', + minZoom: 1, + maxZoom: 10, + subdomains: ['1', '2'] + } + }, + Gray: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: false, + logoPosition: 'bottomright', + minZoom: 1, + maxZoom: 16, + subdomains: ['server', 'services'], + attribution: 'Esri, NAVTEQ, DeLorme' + } + }, + GrayLabels: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: true, + logoPosition: 'bottomright', + //pane: 'esri-label', + minZoom: 1, + maxZoom: 16, + subdomains: ['server', 'services'] + } + }, + Imagery: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: false, + 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: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: true, + logoPosition: 'bottomright', + //pane: 'esri-label', + minZoom: 1, + maxZoom: 19, + subdomains: ['server', 'services'] + } + }, + ImageryTransportation: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}', + //pane: 'esri-label', + options: { + hideLogo: true, + logoPosition: 'bottomright', + minZoom: 1, + maxZoom: 19, + subdomains: ['server', 'services'] + } + }, + ShadedRelief: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: false, + logoPosition: 'bottomright', + minZoom: 1, + maxZoom: 13, + subdomains: ['server', 'services'], + attribution: 'ESRI, NAVTEQ, DeLorme' + } + }, + ShadedReliefLabels: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: true, + logoPosition: 'bottomright', + //pane: 'esri-label', + minZoom: 1, + maxZoom: 12, + subdomains: ['server', 'services'] + } + }, + Terrain: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: false, + logoPosition: 'bottomright', + minZoom: 1, + maxZoom: 13, + subdomains: ['server', 'services'], + attribution: 'Esri, USGS, NOAA' + } + }, + TerrainLabels: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}', + options: { + hideLogo: true, + logoPosition: 'bottomright', + //pane: 'esri-label', + minZoom: 1, + maxZoom: 13, + subdomains: ['server', 'services'] + } + } + } + }, + initialize: function(key, options){ + var config; + + // set the config variable with the appropriate config object + if (typeof key === 'object' && key.urlTemplate && key.options){ + config = key; + } else if(typeof key === 'string' && EsriLeaflet.BasemapLayer.TILES[key]){ + config = EsriLeaflet.BasemapLayer.TILES[key]; + } else { + 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"'); + } + + // merge passed options into the config options + var tileOptions = L.Util.extend(config.options, options); + + // call the initialize method on L.TileLayer to set everything up + L.TileLayer.prototype.initialize.call(this, config.urlTemplate, L.Util.setOptions(this, tileOptions)); + + // if this basemap requires dynamic attribution set it up + if(config.attributionUrl){ + this._getAttributionData(config.attributionUrl); + } + }, + onAdd: function(map){ + if(!this.options.hideLogo){ + this._logo = new EsriLeaflet.Controls.Logo({ + position: this.options.logoPosition + }).addTo(map); + } + + // if(this.options.pane && EsriLeaflet.Support.pointerEvents){ + // this._initPane(); + // } + + L.TileLayer.prototype.onAdd.call(this, map); + + map.on('moveend', this._updateMapAttribution, this); + }, + onRemove: function(map){ + if(this._logo){ + map.removeControl(this._logo); + } + + L.TileLayer.prototype.onRemove.call(this, map); + + map.off('moveend', this._updateMapAttribution, this); + }, + getAttribution:function(){ + var attribution = '' + this.options.attribution + ''/* + logo*/; + return attribution; + }, + // _initPane: function(){ + // if(!this._map.getPane(this.options.pane)){ + // var pane = this._map.createPane(this.options.pane); + // pane.style.pointerEvents = 'none'; + // pane.style.zIndex = 5; + // } + // }, + _getAttributionData: function(url){ + EsriLeaflet.get(url, {}, function(error, attributions){ + this._attributions = []; + for (var c = 0; c < attributions.contributors.length; c++) { + var contributor = attributions.contributors[c]; + for (var i = 0; i < contributor.coverageAreas.length; i++) { + var coverageArea = contributor.coverageAreas[i]; + var southWest = new L.LatLng(coverageArea.bbox[0], coverageArea.bbox[1]); + var northEast = new L.LatLng(coverageArea.bbox[2], coverageArea.bbox[3]); + this._attributions.push({ + attribution: contributor.attribution, + score: coverageArea.score, + bounds: new L.LatLngBounds(southWest, northEast), + minZoom: coverageArea.zoomMin, + maxZoom: coverageArea.zoomMax + }); + } + } + + this._attributions.sort(function(a, b){ + return b.score - a.score; + }); + + this._updateMapAttribution(); + }, this); + }, + _updateMapAttribution: function(){ + if(this._map && this._map.attributionControl && this._attributions){ + var newAttributions = ''; + var bounds = this._map.getBounds(); + var zoom = this._map.getZoom(); + + for (var i = 0; i < this._attributions.length; i++) { + var attribution = this._attributions[i]; + var text = attribution.attribution; + if(!newAttributions.match(text) && bounds.intersects(attribution.bounds) && zoom >= attribution.minZoom && zoom <= attribution.maxZoom) { + newAttributions += (', ' + text); + } + } + newAttributions = newAttributions.substr(2); + var attributionElement = this._map.attributionControl._container.querySelector('.esri-attributions'); + attributionElement.innerHTML = newAttributions; + attributionElement.style.maxWidth = (this._map.getSize().x * 0.65) + 'px'; + this.fire('attributionupdated', { + attribution: newAttributions + }); + } + } + }); + + EsriLeaflet.BasemapLayer = EsriLeaflet.Layers.BasemapLayer; + + EsriLeaflet.Layers.basemapLayer = function(key, options){ + return new EsriLeaflet.Layers.BasemapLayer(key, options); + }; + + EsriLeaflet.basemapLayer = function(key, options){ + return new EsriLeaflet.Layers.BasemapLayer(key, options); + }; + +})(EsriLeaflet); + +EsriLeaflet.Layers.RasterLayer = L.Class.extend({ + includes: L.Mixin.Events, + + options: { + opacity: 1, + position: 'front', + f: 'image' + }, + + onAdd: function (map) { + this._map = map; + + this._update = L.Util.limitExecByInterval(this._update, this.options.updateInterval, this); + + if (map.options.crs && map.options.crs.code) { + var sr = map.options.crs.code.split(':')[1]; + this.options.bboxSR = sr; + this.options.imageSR = sr; + } + + map.on('moveend', this._update, this); + + this._update(); + + if(this._popup){ + this._map.on('click', this._getPopupData, this); + this._map.on('dblclick', this._resetPopupState, this); + } + }, + + bindPopup: function(fn, popupOptions){ + this._shouldRenderPopup = false; + this._lastClick = false; + this._popup = L.popup(popupOptions); + this._popupFunction = fn; + if(this._map){ + this._map.on('click', this._getPopupData, this); + this._map.on('dblclick', this._resetPopupState, this); + } + return this; + }, + + unbindPopup: function(){ + if(this._map){ + this._map.closePopup(this._popup); + this._map.off('click', this._getPopupData, this); + this._map.off('dblclick', this._resetPopupState, this); + } + this._popup = false; + return this; + }, + + onRemove: function (map) { + + if (this._currentImage) { + this._map.removeLayer(this._currentImage); + } + + if(this._popup){ + this._map.off('click', this._getPopupData, this); + this._map.off('dblclick', this._resetPopupState, this); + } + + this._map.off('moveend', this._update, this); + this._map = null; + }, + + addTo: function(map){ + map.addLayer(this); + return this; + }, + + removeFrom: function(map){ + map.removeLayer(this); + return this; + }, + + bringToFront: function(){ + this.options.position = 'front'; + if(this._currentImage){ + this._currentImage.bringToFront(); + } + return this; + }, + + bringToBack: function(){ + this.options.position = 'back'; + if(this._currentImage){ + this._currentImage.bringToBack(); + } + return this; + }, + + getAttribution: function () { + return this.options.attribution; + }, + + getOpacity: function(){ + return this.options.opacity; + }, + + setOpacity: function(opacity){ + this.options.opacity = opacity; + this._currentImage.setOpacity(opacity); + return this; + }, + + getTimeRange: function(){ + return [this.options.from, this.options.to]; + }, + + setTimeRange: function(from, to){ + this.options.from = from; + this.options.to = to; + this._update(); + return this; + }, + + metadata: function(callback, context){ + this._service.metadata(callback, context); + return this; + }, + + authenticate: function(token){ + this._service.authenticate(token); + return this; + }, + + _renderImage: function(url, bounds){ + if(this._map){ + var image = new L.ImageOverlay(url, bounds, { + opacity: 0 + }).addTo(this._map); + + image.once('load', function(e){ + var newImage = e.target; + var oldImage = this._currentImage; + if(newImage._bounds.equals(bounds)){ + this._currentImage = newImage; + + if(this.options.position === 'front'){ + this.bringToFront(); + } else { + this.bringToBack(); + } + + if(this._map && this._currentImage._map){ + this._currentImage.setOpacity(this.options.opacity); + } else { + this._currentImage._map.removeLayer(this._currentImage); + } + + if(oldImage){ + this._map.removeLayer(oldImage); + } + + } else { + this._map.removeLayer(newImage); + } + + this.fire('load', { + bounds: bounds + }); + + }, this); + + this.fire('loading', { + bounds: bounds + }); + } + }, + + _update: function () { + if(!this._map){ + return; + } + + var zoom = this._map.getZoom(); + var bounds = this._map.getBounds(); + + if(this._animatingZoom){ + return; + } + + if (this._map._panTransition && this._map._panTransition._inProgress) { + return; + } + + if (zoom > this.options.maxZoom || zoom < this.options.minZoom) { + return; + } + var params = this._buildExportParams(); + + this._requestExport(params, bounds); + }, + + // TODO: refactor these into raster layer + _renderPopup: function(latlng, error, results, response){ + latlng = L.latLng(latlng); + if(this._shouldRenderPopup && this._lastClick.equals(latlng)){ + //add the popup to the map where the mouse was clicked at + var content = this._popupFunction(error, results, response); + if (content) { + this._popup.setLatLng(latlng).setContent(content).openOn(this._map); + } + } + }, + + _resetPopupState: function(e){ + this._shouldRenderPopup = false; + this._lastClick = e.latlng; + }, + + // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js + // @TODO remove at Leaflet 0.8 + _propagateEvent: function (e) { + e = L.extend({ + layer: e.target, + target: this + }, e); + this.fire(e.type, e); + } +}); + +EsriLeaflet.Layers.DynamicMapLayer = EsriLeaflet.Layers.RasterLayer.extend({ + + options: { + updateInterval: 150, + layers: false, + layerDefs: false, + timeOptions: false, + format: 'png24', + transparent: true + }, + + initialize: function (url, options) { + this.url = EsriLeaflet.Util.cleanUrl(url); + this._service = new EsriLeaflet.Services.MapService(this.url, options); + this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', this._propagateEvent, this); + L.Util.setOptions(this, options); + }, + + getLayers: function(){ + return this.options.layers; + }, + + setLayers: function(layers){ + this.options.layers = layers; + this._update(); + return this; + }, + + getLayerDefs: function(){ + return this.options.layerDefs; + }, + + setLayerDefs: function(layerDefs){ + this.options.layerDefs = layerDefs; + this._update(); + return this; + }, + + getTimeOptions: function(){ + return this.options.timeOptions; + }, + + setTimeOptions: function(timeOptions){ + this.options.timeOptions = timeOptions; + this._update(); + return this; + }, + + query: function(){ + return this._service.query(); + }, + + identify: function(){ + return this._service.identify(); + }, + + find: function(){ + return this._service.find(); + }, + + _getPopupData: function(e){ + var callback = L.Util.bind(function(error, featureCollection, response) { + setTimeout(L.Util.bind(function(){ + this._renderPopup(e.latlng, error, featureCollection, response); + }, this), 300); + }, this); + + var identifyRequest = this.identify().on(this._map).at(e.latlng); + + if(this.options.layers){ + identifyRequest.layers('visible:' + this.options.layers.join(',')); + } else { + identifyRequest.layers('visible'); + } + + identifyRequest.run(callback); + + // set the flags to show the popup + this._shouldRenderPopup = true; + this._lastClick = e.latlng; + }, + + _buildExportParams: function () { + var bounds = this._map.getBounds(); + var size = this._map.getSize(); + var ne = this._map.options.crs.project(bounds._northEast); + var sw = this._map.options.crs.project(bounds._southWest); + + var params = { + bbox: [sw.x, sw.y, ne.x, ne.y].join(','), + size: size.x + ',' + size.y, + dpi: 96, + format: this.options.format, + transparent: this.options.transparent, + bboxSR: this.options.bboxSR, + imageSR: this.options.imageSR + }; + + if(this.options.layers){ + params.layers = 'show:' + this.options.layers.join(','); + } + + if(this.options.layerDefs){ + params.layerDefs = JSON.stringify(this.options.layerDefs); + } + + if(this.options.timeOptions){ + params.timeOptions = JSON.stringify(this.options.timeOptions); + } + + if(this.options.from && this.options.to){ + params.time = this.options.from.valueOf() + ',' + this.options.to.valueOf(); + } + + if(this._service.options.token) { + params.token = this._service.options.token; + } + + return params; + }, + + _requestExport: function (params, bounds) { + if(this.options.f === 'json'){ + this._service.get('export', params, function(error, response){ + this._renderImage(response.href, bounds); + }, this); + } else { + params.f = 'image'; + this._renderImage(this.url + 'export' + L.Util.getParamString(params), bounds); + } + } +}); + +EsriLeaflet.DynamicMapLayer = EsriLeaflet.Layers.DynamicMapLayer; + +EsriLeaflet.Layers.dynamicMapLayer = function(url, options){ + return new EsriLeaflet.Layers.DynamicMapLayer(url, options); +}; + +EsriLeaflet.dynamicMapLayer = function(url, options){ + return new EsriLeaflet.Layers.DynamicMapLayer(url, options); +}; + +EsriLeaflet.Layers.ImageMapLayer = EsriLeaflet.Layers.RasterLayer.extend({ + + options: { + updateInterval: 150, + format: 'jpgpng' + }, + + query: function(){ + return this._service.query(); + }, + + identify: function(){ + return this._service.identify(); + }, + + initialize: function (url, options) { + this.url = EsriLeaflet.Util.cleanUrl(url); + this._service = new EsriLeaflet.Services.ImageService(this.url, options); + this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', this._propagateEvent, this); + L.Util.setOptions(this, options); + }, + + setPixelType: function (pixelType) { + this.options.pixelType = pixelType; + this._update(); + return this; + }, + + getPixelType: function () { + return this.options.pixelType; + }, + + setBandIds: function (bandIds) { + if (L.Util.isArray(bandIds)) { + this.options.bandIds = bandIds.join(','); + } else { + this.options.bandIds = bandIds.toString(); + } + this._update(); + return this; + }, + + getBandIds: function () { + return this.options.bandIds; + }, + + setNoData: function (noData, noDataInterpretation) { + if (L.Util.isArray(noData)) { + this.options.noData = noData.join(','); + } else { + this.options.noData = noData.toString(); + } + if (noDataInterpretation) { + this.options.noDataInterpretation = noDataInterpretation; + } + this._update(); + return this; + }, + + getNoData: function () { + return this.options.noData; + }, + + getNoDataInterpretation: function () { + return this.options.noDataInterpretation; + }, + + setRenderingRule: function(renderingRule) { + this.options.renderingRule = renderingRule; + this._update(); + }, + + getRenderingRule: function() { + return this.options.renderingRule; + }, + + setMosaicRule: function(mosaicRule) { + this.options.mosaicRule = mosaicRule; + this._update(); + }, + + getMosaicRule: function() { + return this.options.mosaicRule; + }, + + _getPopupData: function(e){ + var callback = L.Util.bind(function(error, results, response) { + setTimeout(L.Util.bind(function(){ + this._renderPopup(e.latlng, error, results, response); + }, this), 300); + }, this); + + var identifyRequest = this.identify().at(e.latlng); + + // set mosaic rule for identify task if it is set for layer + if (this.options.mosaicRule) { + identifyRequest.setMosaicRule(this.options.mosaicRule); + // @TODO: force return catalog items too? + } + + // @TODO: set rendering rule? Not sure, + // sometimes you want raw pixel values + // if (this.options.renderingRule) { + // identifyRequest.setRenderingRule(this.options.renderingRule); + // } + + identifyRequest.run(callback); + + // set the flags to show the popup + this._shouldRenderPopup = true; + this._lastClick = e.latlng; + }, + + _buildExportParams: function () { + var bounds = this._map.getBounds(); + var size = this._map.getSize(); + var ne = this._map.options.crs.project(bounds._northEast); + var sw = this._map.options.crs.project(bounds._southWest); + + var params = { + bbox: [sw.x, sw.y, ne.x, ne.y].join(','), + size: size.x + ',' + size.y, + format: this.options.format, + bboxSR: this.options.bboxSR, + imageSR: this.options.imageSR + }; + + if (this.options.from && this.options.to) { + params.time = this.options.from.valueOf() + ',' + this.options.to.valueOf(); + } + + if (this.options.pixelType) { + params.pixelType = this.options.pixelType; + } + + if (this.options.interpolation) { + params.interpolation = this.options.interpolation; + } + + if (this.options.compressionQuality) { + params.compressionQuality = this.options.compressionQuality; + } + + if (this.options.bandIds) { + params.bandIds = this.options.bandIds; + } + + if (this.options.noData) { + params.noData = this.options.noData; + } + + if (this.options.noDataInterpretation) { + params.noDataInterpretation = this.options.noDataInterpretation; + } + + if (this._service.options.token) { + params.token = this._service.options.token; + } + + if(this.options.renderingRule) { + params.renderingRule = JSON.stringify(this.options.renderingRule); + } + + if(this.options.mosaicRule) { + params.mosaicRule = JSON.stringify(this.options.mosaicRule); + } + + return params; + }, + + _requestExport: function (params, bounds) { + if (this.options.f === 'json') { + this._service.get('exportImage', params, function(error, response){ + this._renderImage(response.href, bounds); + }, this); + } else { + params.f = 'image'; + this._renderImage(this.url + 'exportImage' + L.Util.getParamString(params), bounds); + } + } +}); + +EsriLeaflet.ImageMapLayer = EsriLeaflet.Layers.ImageMapLayer; + +EsriLeaflet.Layers.imageMapLayer = function (url, options) { + return new EsriLeaflet.Layers.ImageMapLayer(url, options); +}; + +EsriLeaflet.imageMapLayer = function (url, options) { + return new EsriLeaflet.Layers.ImageMapLayer(url, options); +}; + +EsriLeaflet.Layers.TiledMapLayer = L.TileLayer.extend({ + initialize: function(url, options){ + options = L.Util.setOptions(this, options); + + // set the urls + this.url = L.esri.Util.cleanUrl(url); + this.tileUrl = L.esri.Util.cleanUrl(url) + 'tile/{z}/{y}/{x}'; + this._service = new L.esri.Services.MapService(this.url, options); + this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', this._propagateEvent, this); + + //if this is looking at the AGO tiles subdomain insert the subdomain placeholder + if(this.tileUrl.match('://tiles.arcgisonline.com')){ + this.tileUrl = this.tileUrl.replace('://tiles.arcgisonline.com', '://tiles{s}.arcgisonline.com'); + options.subdomains = ['1', '2', '3', '4']; + } + + if(this.options.token) { + this.tileUrl += ('?token=' + this.options.token); + } + + // init layer by calling TileLayers initialize method + L.TileLayer.prototype.initialize.call(this, this.tileUrl, options); + }, + + metadata: function(callback, context){ + this._service.metadata(callback, context); + return this; + }, + + identify: function(){ + return this._service.identify(); + }, + + authenticate: function(token){ + var tokenQs = '?token=' + token; + this.tileUrl = (this.options.token) ? this.tileUrl.replace(/\?token=(.+)/g, tokenQs) : this.tileUrl + tokenQs; + this.options.token = token; + this._service.authenticate(token); + return this; + }, + + // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js + // @TODO remove at Leaflet 0.8 + _propagateEvent: function (e) { + e = L.extend({ + layer: e.target, + target: this + }, e); + this.fire(e.type, e); + } +}); + +L.esri.TiledMapLayer = L.esri.Layers.tiledMapLayer; + +L.esri.Layers.tiledMapLayer = function(url, options){ + return new L.esri.Layers.TiledMapLayer(url, options); +}; + +L.esri.tiledMapLayer = function(url, options){ + return new L.esri.Layers.TiledMapLayer(url, options); +}; + +EsriLeaflet.Layers.FeatureGrid = L.Class.extend({ + + includes: L.Mixin.Events, + + options: { + cellSize: 512, + updateInterval: 150 + }, + + initialize: function (options) { + options = L.setOptions(this, options); + }, + + onAdd: function (map) { + this._map = map; + this._update = L.Util.limitExecByInterval(this._update, this.options.updateInterval, this); + + // @TODO remove for leaflet 0.8 + this._map.addEventListener(this.getEvents(), this); + + this._reset(); + this._update(); + }, + + onRemove: function(){ + this._map.removeEventListener(this.getEvents(), this); + this._removeCells(); + }, + + getEvents: function () { + var events = { + viewreset: this._reset, + moveend: this._update + }; + + return events; + }, + + addTo: function(map){ + map.addLayer(this); + return this; + }, + + removeFrom: function(map){ + map.removeLayer(this); + return this; + }, + + _reset: function () { + this._removeCells(); + + this._cells = {}; + this._activeCells = {}; + this._cellsToLoad = 0; + this._cellsTotal = 0; + + // @TODO enable at Leaflet 0.8 + // this._cellNumBounds = this._getCellNumBounds(); + + this._resetWrap(); + }, + + _resetWrap: function () { + var map = this._map, + crs = map.options.crs; + + if (crs.infinite) { return; } + + var cellSize = this._getCellSize(); + + if (crs.wrapLng) { + this._wrapLng = [ + Math.floor(map.project([0, crs.wrapLng[0]]).x / cellSize), + Math.ceil(map.project([0, crs.wrapLng[1]]).x / cellSize) + ]; + } + + if (crs.wrapLat) { + this._wrapLat = [ + Math.floor(map.project([crs.wrapLat[0], 0]).y / cellSize), + Math.ceil(map.project([crs.wrapLat[1], 0]).y / cellSize) + ]; + } + }, + + _getCellSize: function () { + return this.options.cellSize; + }, + + _update: function () { + if (!this._map) { return; } + + var bounds = this._map.getPixelBounds(), + zoom = this._map.getZoom(), + cellSize = this._getCellSize(); + + if (zoom > this.options.maxZoom || + zoom < this.options.minZoom) { return; } + + // cell coordinates range for the current view + var cellBounds = L.bounds( + bounds.min.divideBy(cellSize).floor(), + bounds.max.divideBy(cellSize).floor()); + + this._addCells(cellBounds); + this._removeOtherCells(cellBounds); + }, + + _addCells: function (bounds) { + var queue = [], + center = bounds.getCenter(), + zoom = this._map.getZoom(); + + var j, i, coords; + // create a queue of coordinates to load cells from + for (j = bounds.min.y; j <= bounds.max.y; j++) { + for (i = bounds.min.x; i <= bounds.max.x; i++) { + coords = new L.Point(i, j); + coords.z = zoom; + + // @TODO enable at Leaflet 0.8 + // if (this._isValidCell(coords)) { + // queue.push(coords); + // } + + queue.push(coords); + } + } + var cellsToLoad = queue.length; + + if (cellsToLoad === 0) { return; } + + this._cellsToLoad += cellsToLoad; + this._cellsTotal += cellsToLoad; + + // sort cell queue to load cells in order of their distance to center + queue.sort(function (a, b) { + return a.distanceTo(center) - b.distanceTo(center); + }); + + for (i = 0; i < cellsToLoad; i++) { + this._addCell(queue[i]); + } + }, + + // @TODO enable at Leaflet 0.8 + // _isValidCell: function (coords) { + // var crs = this._map.options.crs; + + // if (!crs.infinite) { + // // don't load cell if it's out of bounds and not wrapped + // var bounds = this._cellNumBounds; + // if ( + // (!crs.wrapLng && (coords.x < bounds.min.x || coords.x > bounds.max.x)) || + // (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y)) + // ) { + // return false; + // } + // } + + // if (!this.options.bounds) { + // return true; + // } + + // // don't load cell if it doesn't intersect the bounds in options + // var cellBounds = this._cellCoordsToBounds(coords); + // return L.latLngBounds(this.options.bounds).intersects(cellBounds); + // }, + + // converts cell coordinates to its geographical bounds + _cellCoordsToBounds: function (coords) { + var map = this._map, + cellSize = this.options.cellSize, + + nwPoint = coords.multiplyBy(cellSize), + sePoint = nwPoint.add([cellSize, cellSize]), + + // @TODO for Leaflet 0.8 + // nw = map.wrapLatLng(map.unproject(nwPoint, coords.z)), + // se = map.wrapLatLng(map.unproject(sePoint, coords.z)); + + nw = map.unproject(nwPoint, coords.z).wrap(), + se = map.unproject(sePoint, coords.z).wrap(); + + return new L.LatLngBounds(nw, se); + }, + + // converts cell coordinates to key for the cell cache + _cellCoordsToKey: function (coords) { + return coords.x + ':' + coords.y; + }, + + // converts cell cache key to coordiantes + _keyToCellCoords: function (key) { + var kArr = key.split(':'), + x = parseInt(kArr[0], 10), + y = parseInt(kArr[1], 10); + + return new L.Point(x, y); + }, + + // remove any present cells that are off the specified bounds + _removeOtherCells: function (bounds) { + for (var key in this._cells) { + if (!bounds.contains(this._keyToCellCoords(key))) { + this._removeCell(key); + } + } + }, + + _removeCell: function (key) { + var cell = this._activeCells[key]; + if(cell){ + delete this._activeCells[key]; + + if (this.cellLeave) { + this.cellLeave(cell.bounds, cell.coords); + } + + this.fire('cellleave', { + bounds: cell.bounds, + coords: cell.coords + }); + } + }, + + _removeCells: function(){ + for (var key in this._cells) { + var bounds = this._cells[key].bounds; + var coords = this._cells[key].coords; + + if (this.cellLeave) { + this.cellLeave(bounds, coords); + } + + this.fire('cellleave', { + bounds: bounds, + coords: coords + }); + } + }, + + _addCell: function (coords) { + + // wrap cell coords if necessary (depending on CRS) + this._wrapCoords(coords); + + // generate the cell key + var key = this._cellCoordsToKey(coords); + + // get the cell from the cache + var cell = this._cells[key]; + // if this cell should be shown as isnt active yet (enter) + + if (cell && !this._activeCells[key]) { + if (this.cellEnter) { + this.cellEnter(cell.bounds, coords); + } + + this.fire('cellenter', { + bounds: cell.bounds, + coords: coords + }); + + this._activeCells[key] = cell; + } + + // if we dont have this cell in the cache yet (create) + if (!cell) { + cell = { + coords: coords, + bounds: this._cellCoordsToBounds(coords) + }; + + this._cells[key] = cell; + this._activeCells[key] = cell; + + if(this.createCell){ + this.createCell(cell.bounds, coords); + } + + this.fire('cellcreate', { + bounds: cell.bounds, + coords: coords + }); + } + }, + + _wrapCoords: function (coords) { + coords.x = this._wrapLng ? L.Util.wrapNum(coords.x, this._wrapLng) : coords.x; + coords.y = this._wrapLat ? L.Util.wrapNum(coords.y, this._wrapLat) : coords.y; + } + + // get the global cell coordinates range for the current zoom + // @TODO enable at Leaflet 0.8 + // _getCellNumBounds: function () { + // // @TODO for Leaflet 0.8 + // // var bounds = this._map.getPixelWorldBounds(), + // // size = this._getCellSize(); + // // + // // return bounds ? L.bounds( + // // bounds.min.divideBy(size).floor(), + // // bounds.max.divideBy(size).ceil().subtract([1, 1])) : null; + // } + +}); + +(function(EsriLeaflet){ + + EsriLeaflet.Layers.FeatureManager = EsriLeaflet.Layers.FeatureGrid.extend({ + + /** + * Options + */ + + options: { + where: '1=1', + fields: ['*'], + from: false, + to: false, + timeField: false, + timeFilterMode: 'server', + simplifyFactor: 0, + precision: 6 + }, + + /** + * Constructor + */ + + initialize: function (url, options) { + EsriLeaflet.Layers.FeatureGrid.prototype.initialize.call(this, options); + + options = L.setOptions(this, options); + + this.url = EsriLeaflet.Util.cleanUrl(url); + + this._service = new EsriLeaflet.Services.FeatureLayer(this.url, options); + + //use case insensitive regex to look for common fieldnames used for indexing + /*global console */ + if (this.options.fields[0] !== '*'){ + var oidCheck = false; + for (var i = 0; i < this.options.fields.length; i++){ + if (this.options.fields[i].match(/^(OBJECTID|FID|OID|ID)$/i)){ + oidCheck = true; + } + } + if (oidCheck === false && console && console.warn){ + console.warn('no known esriFieldTypeOID field detected in fields Array. Please add an attribute field containing unique IDs to ensure the layer can be drawn correctly.'); + } + } + + // Leaflet 0.8 change to new propagation + this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', function (e) { + e = L.extend({ + target: this + }, e); + this.fire(e.type, e); + }, this); + + if(this.options.timeField.start && this.options.timeField.end){ + this._startTimeIndex = new BinarySearchIndex(); + this._endTimeIndex = new BinarySearchIndex(); + } else if(this.options.timeField){ + this._timeIndex = new BinarySearchIndex(); + } + + this._currentSnapshot = []; // cache of what layers should be active + this._activeRequests = 0; + this._pendingRequests = []; + }, + + /** + * Layer Interface + */ + + onAdd: function(map){ + return EsriLeaflet.Layers.FeatureGrid.prototype.onAdd.call(this, map); + }, + + onRemove: function(map){ + return EsriLeaflet.Layers.FeatureGrid.prototype.onRemove.call(this, map); + }, + + getAttribution: function () { + return this.options.attribution; + }, + + /** + * Feature Managment + */ + + createCell: function(bounds, coords){ + this._requestFeatures(bounds, coords); + }, + + _requestFeatures: function(bounds, coords, callback){ + this._activeRequests++; + + // our first active request fires loading + if(this._activeRequests === 1){ + this.fire('loading', { + bounds: bounds + }); + } + + return this._buildQuery(bounds).run(function(error, featureCollection, response){ + if(response && response.exceededTransferLimit){ + this.fire('drawlimitexceeded'); + } + + //deincriment the request counter + this._activeRequests--; + + if(!error && featureCollection.features.length){ + this._addFeatures(featureCollection.features, coords); + } + + if(callback){ + callback.call(this, error, featureCollection); + } + + // if there are no more active requests fire a load event for this view + if(this._activeRequests <= 0){ + this.fire('load', { + bounds: bounds + }); + } + }, this); + }, + + _addFeatures: function(features){ + for (var i = features.length - 1; i >= 0; i--) { + var id = features[i].id; + this._currentSnapshot.push(id); + } + + if(this.options.timeField){ + this._buildTimeIndexes(features); + } + + this.createLayers(features); + }, + + _buildQuery: function(bounds){ + var query = this._service.query().intersects(bounds).where(this.options.where).fields(this.options.fields).precision(this.options.precision); + + if(this.options.simplifyFactor){ + query.simplify(this._map, this.options.simplifyFactor); + } + + if(this.options.timeFilterMode === 'server' && this.options.from && this.options.to){ + query.between(this.options.from, this.options.to); + } + + return query; + }, + + /** + * Where Methods + */ + + setWhere: function(where, callback, context){ + + this.options.where = (where && where.length) ? where : '1=1'; + + var oldSnapshot = []; + var newShapshot = []; + var pendingRequests = 0; + var requestError = null; + var requestCallback = L.Util.bind(function(error, featureCollection){ + if(error){ + requestError = error; + } + + if(featureCollection){ + for (var i = featureCollection.features.length - 1; i >= 0; i--) { + newShapshot.push(featureCollection.features[i].id); + } + } + + pendingRequests--; + + if(pendingRequests <= 0){ + this._currentSnapshot = newShapshot; + this.removeLayers(oldSnapshot); + this.addLayers(newShapshot); + if(callback) { + callback.call(context, requestError); + } + } + }, this); + + for (var i = this._currentSnapshot.length - 1; i >= 0; i--) { + oldSnapshot.push(this._currentSnapshot[i]); + } + + for(var key in this._activeCells){ + pendingRequests++; + var coords = this._keyToCellCoords(key); + var bounds = this._cellCoordsToBounds(coords); + this._requestFeatures(bounds, key, requestCallback); + } + + return this; + }, + + getWhere: function(){ + return this.options.where; + }, + + /** + * Time Range Methods + */ + + getTimeRange: function(){ + return [this.options.from, this.options.to]; + }, + + setTimeRange: function(from, to, callback, context){ + var oldFrom = this.options.from; + var oldTo = this.options.to; + var pendingRequests = 0; + var requestError = null; + var requestCallback = L.Util.bind(function(error){ + if(error){ + requestError = error; + } + this._filterExistingFeatures(oldFrom, oldTo, from, to); + + pendingRequests--; + + if(callback && pendingRequests <= 0){ + callback.call(context, requestError); + } + }, this); + + this.options.from = from; + this.options.to = to; + + this._filterExistingFeatures(oldFrom, oldTo, from, to); + + if(this.options.timeFilterMode === 'server') { + for(var key in this._activeCells){ + pendingRequests++; + var coords = this._keyToCellCoords(key); + var bounds = this._cellCoordsToBounds(coords); + this._requestFeatures(bounds, key, requestCallback); + } + } + }, + + refresh: function(){ + for(var key in this._activeCells){ + var coords = this._keyToCellCoords(key); + var bounds = this._cellCoordsToBounds(coords); + this._requestFeatures(bounds, key); + } + }, + + _filterExistingFeatures: function (oldFrom, oldTo, newFrom, newTo) { + var layersToRemove = (oldFrom && oldTo) ? this._getFeaturesInTimeRange(oldFrom, oldTo) : this._currentSnapshot; + var layersToAdd = this._getFeaturesInTimeRange(newFrom, newTo); + + if(layersToAdd.indexOf){ + for (var i = 0; i < layersToAdd.length; i++) { + var shouldRemoveLayer = layersToRemove.indexOf(layersToAdd[i]); + if(shouldRemoveLayer >= 0){ + layersToRemove.splice(shouldRemoveLayer, 1); + } + } + } + + this.removeLayers(layersToRemove); + this.addLayers(layersToAdd); + }, + + _getFeaturesInTimeRange: function(start, end){ + var ids = []; + var search; + + if(this.options.timeField.start && this.options.timeField.end){ + var startTimes = this._startTimeIndex.between(start, end); + var endTimes = this._endTimeIndex.between(start, end); + search = startTimes.concat(endTimes); + } else { + search = this._timeIndex.between(start, end); + } + + for (var i = search.length - 1; i >= 0; i--) { + ids.push(search[i].id); + } + + return ids; + }, + + _buildTimeIndexes: function(geojson){ + var i; + var feature; + if(this.options.timeField.start && this.options.timeField.end){ + var startTimeEntries = []; + var endTimeEntries = []; + for (i = geojson.length - 1; i >= 0; i--) { + feature = geojson[i]; + startTimeEntries.push( { + id: feature.id, + value: new Date(feature.properties[this.options.timeField.start]) + }); + endTimeEntries.push( { + id: feature.id, + value: new Date(feature.properties[this.options.timeField.end]) + }); + } + this._startTimeIndex.bulkAdd(startTimeEntries); + this._endTimeIndex.bulkAdd(endTimeEntries); + } else { + var timeEntries = []; + for (i = geojson.length - 1; i >= 0; i--) { + feature = geojson[i]; + timeEntries.push( { + id: feature.id, + value: new Date(feature.properties[this.options.timeField]) + }); + } + + this._timeIndex.bulkAdd(timeEntries); + } + }, + + _featureWithinTimeRange: function(feature){ + if(!this.options.from || !this.options.to){ + return true; + } + + var from = +this.options.from.valueOf(); + var to = +this.options.to.valueOf(); + + if(typeof this.options.timeField === 'string'){ + var date = +feature.properties[this.options.timeField]; + return (date >= from) && (date <= to); + } + + if(this.options.timeField.start && this.options.timeField.end){ + var startDate = +feature.properties[this.options.timeField.start]; + var endDate = +feature.properties[this.options.timeField.end]; + return ((startDate >= from) && (startDate <= to)) || ((endDate >= from) && (endDate <= to)); + } + }, + + /** + * Service Methods + */ + + authenticate: function(token){ + this._service.authenticate(token); + return this; + }, + + metadata: function(callback, context){ + this._service.metadata(callback, context); + return this; + }, + + query: function(){ + return this._service.query(); + }, + + addFeature: function(feature, callback, context){ + this._service.addFeature(feature, function(error, response){ + if(!error){ + this.refresh(); + } + if(callback){ + callback.call(context, error, response); + } + }, this); + return this; + }, + + updateFeature: function(feature, callback, context){ + return this._service.updateFeature(feature, function(error, response){ + if(!error){ + this.refresh(); + } + if(callback){ + callback.call(context, error, response); + } + }, this); + }, + + deleteFeature: function(id, callback, context){ + return this._service.deleteFeature(id, function(error, response){ + if(!error && response.objectId){ + this.removeLayers([response.objectId], true); + } + if(callback){ + callback.call(context, error, response); + } + }, this); + } + }); + + /** + * Temporal Binary Search Index + */ + + function BinarySearchIndex(values) { + this.values = values || []; + } + + BinarySearchIndex.prototype._query = function(query){ + var minIndex = 0; + var maxIndex = this.values.length - 1; + var currentIndex; + var currentElement; + var resultIndex; + + while (minIndex <= maxIndex) { + resultIndex = currentIndex = (minIndex + maxIndex) / 2 | 0; + currentElement = this.values[Math.round(currentIndex)]; + if (+currentElement.value < +query) { + minIndex = currentIndex + 1; + } else if (+currentElement.value > +query) { + maxIndex = currentIndex - 1; + } else { + return currentIndex; + } + } + + return ~maxIndex; + }; + + BinarySearchIndex.prototype.sort = function(){ + this.values.sort(function(a, b) { + return +b.value - +a.value; + }).reverse(); + this.dirty = false; + }; + + BinarySearchIndex.prototype.between = function(start, end){ + if(this.dirty){ + this.sort(); + } + + var startIndex = this._query(start); + var endIndex = this._query(end); + + if(startIndex === 0 && endIndex === 0){ + return []; + } + + startIndex = Math.abs(startIndex); + endIndex = (endIndex < 0) ? Math.abs(endIndex): endIndex + 1; + + return this.values.slice(startIndex, endIndex); + }; + + BinarySearchIndex.prototype.bulkAdd = function(items){ + this.dirty = true; + this.values = this.values.concat(items); + }; + +})(EsriLeaflet); + +EsriLeaflet.Layers.FeatureLayer = EsriLeaflet.Layers.FeatureManager.extend({ + + statics: { + EVENTS: 'click dblclick mouseover mouseout mousemove contextmenu popupopen popupclose' + }, + + /** + * Constructor + */ + + initialize: function (url, options) { + EsriLeaflet.Layers.FeatureManager.prototype.initialize.call(this, url, options); + + options = L.setOptions(this, options); + + this._layers = {}; + this._leafletIds = {}; + this._key = 'c'+(Math.random() * 1e9).toString(36).replace('.', '_'); + }, + + /** + * Layer Interface + */ + + onAdd: function(map){ + return EsriLeaflet.Layers.FeatureManager.prototype.onAdd.call(this, map); + }, + + onRemove: function(map){ + + for (var i in this._layers) { + map.removeLayer(this._layers[i]); + } + + return EsriLeaflet.Layers.FeatureManager.prototype.onRemove.call(this, map); + }, + + createNewLayer: function(geojson){ + // @TODO Leaflet 0.8 + //newLayer = L.GeoJSON.geometryToLayer(geojson, this.options); + return L.GeoJSON.geometryToLayer(geojson, this.options.pointToLayer, L.GeoJSON.coordsToLatLng, this.options); + }, + + /** + * Feature Managment Methods + */ + + createLayers: function(features){ + for (var i = features.length - 1; i >= 0; i--) { + + var geojson = features[i]; + + var layer = this._layers[geojson.id]; + var newLayer; + + if(layer && !this._map.hasLayer(layer)){ + this._map.addLayer(layer); + } + + if (layer && layer.setLatLngs) { + // @TODO Leaflet 0.8 + //newLayer = L.GeoJSON.geometryToLayer(geojson, this.options); + + var updateGeo = this.createNewLayer(geojson); + layer.setLatLngs(updateGeo.getLatLngs()); + } + + if(!layer){ + // @TODO Leaflet 0.8 + //newLayer = L.GeoJSON.geometryToLayer(geojson, this.options); + + newLayer = this.createNewLayer(geojson); + newLayer.feature = geojson; + newLayer.defaultOptions = newLayer.options; + newLayer._leaflet_id = this._key + '_' + geojson.id; + + this._leafletIds[newLayer._leaflet_id] = geojson.id; + + // bubble events from layers to this + // @TODO Leaflet 0.8 + // newLayer.addEventParent(this); + + newLayer.on(EsriLeaflet.Layers.FeatureLayer.EVENTS, this._propagateEvent, this); + + // bind a popup if we have one + if(this._popup && newLayer.bindPopup){ + newLayer.bindPopup(this._popup(newLayer.feature, newLayer), this._popupOptions); + } + + if(this.options.onEachFeature){ + this.options.onEachFeature(newLayer.feature, newLayer); + } + + // cache the layer + this._layers[newLayer.feature.id] = newLayer; + + // style the layer + this.resetStyle(newLayer.feature.id); + + this.fire('createfeature', { + feature: newLayer.feature + }); + + // add the layer if it is within the time bounds or our layer is not time enabled + if(!this.options.timeField || (this.options.timeField && this._featureWithinTimeRange(geojson)) ){ + this._map.addLayer(newLayer); + } + } + } + }, + + addLayers: function(ids){ + for (var i = ids.length - 1; i >= 0; i--) { + var layer = this._layers[ids[i]]; + if(layer){ + this.fire('addfeature', { + feature: layer.feature + }); + this._map.addLayer(layer); + } + } + }, + + removeLayers: function(ids, permanent){ + for (var i = ids.length - 1; i >= 0; i--) { + var id = ids[i]; + var layer = this._layers[id]; + if(layer){ + this.fire('removefeature', { + feature: layer.feature, + permanent: permanent + }); + this._map.removeLayer(layer); + } + if(layer && permanent){ + delete this._layers[id]; + } + } + }, + + /** + * Styling Methods + */ + + resetStyle: function (id) { + var layer = this._layers[id]; + + if(layer){ + layer.options = layer.defaultOptions; + this.setFeatureStyle(layer.feature.id, this.options.style); + } + + return this; + }, + + setStyle: function (style) { + this.options.style = style; + this.eachFeature(function (layer) { + this.setFeatureStyle(layer.feature.id, style); + }, this); + return this; + }, + + setFeatureStyle: function (id, style) { + var layer = this._layers[id]; + + if (typeof style === 'function') { + style = style(layer.feature); + } + if (layer.setStyle) { + layer.setStyle(style); + } + }, + + /** + * Popup Methods + */ + + bindPopup: function (fn, options) { + this._popup = fn; + this._popupOptions = options; + for (var i in this._layers) { + var layer = this._layers[i]; + var popupContent = this._popup(layer.feature, layer); + layer.bindPopup(popupContent, options); + } + return this; + }, + + unbindPopup: function () { + this._popup = false; + for (var i in this._layers) { + var layer = this._layers[i]; + if (layer.unbindPopup) { + layer.unbindPopup(); + } else if (layer.getLayers) { + var groupLayers = layer.getLayers(); + for (var j in groupLayers) { + var gLayer = groupLayers[j]; + gLayer.unbindPopup(); + } + } + } + return this; + }, + + /** + * Utility Methods + */ + + eachFeature: function (fn, context) { + for (var i in this._layers) { + fn.call(context, this._layers[i]); + } + return this; + }, + + getFeature: function (id) { + return this._layers[id]; + }, + + // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js + // @TODO remove at Leaflet 0.8 + _propagateEvent: function (e) { + e.layer = this._layers[this._leafletIds[e.target._leaflet_id]]; + e.target = this; + this.fire(e.type, e); + } +}); + +EsriLeaflet.FeatureLayer = EsriLeaflet.Layers.FeatureLayer; + +EsriLeaflet.Layers.featureLayer = function(url, options){ + return new EsriLeaflet.Layers.FeatureLayer(url, options); +}; + +EsriLeaflet.featureLayer = function(url, options){ + return new EsriLeaflet.Layers.FeatureLayer(url, options); +}; + + +EsriLeaflet.Controls.Logo = L.Control.extend({ + options: { + position: 'bottomright', + marginTop: 0, + marginLeft: 0, + marginBottom: 0, + marginRight: 0 + }, + onAdd: function () { + var div = L.DomUtil.create('div', 'esri-leaflet-logo'); + div.style.marginTop = this.options.marginTop; + div.style.marginLeft = this.options.marginLeft; + div.style.marginBottom = this.options.marginBottom; + div.style.marginRight = this.options.marginRight; + div.innerHTML = ''; + return div; + } +}); + +EsriLeaflet.Controls.logo = function(options){ + return new L.esri.Controls.Logo(options); +}; + + + return EsriLeaflet; +})); +//# sourceMappingURL=esri-leaflet-src.js.map \ No newline at end of file diff --git a/dist/esri-leaflet-src.js.map b/dist/esri-leaflet-src.js.map new file mode 100644 index 000000000..499e99cb5 --- /dev/null +++ b/dist/esri-leaflet-src.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/EsriLeaflet.js","../src/Util.js","../src/Request.js","../src/Services/Service.js","../src/Services/FeatureLayer.js","../src/Services/MapService.js","../src/Services/ImageService.js","../src/Tasks/Task.js","../src/Tasks/Query.js","../src/Tasks/Find.js","../src/Tasks/Identify.js","../src/Tasks/IdentifyImage.js","../src/Tasks/IdentifyFeatures.js","../src/Layers/BasemapLayer.js","../src/Layers/RasterLayer.js","../src/Layers/DynamicMapLayer.js","../src/Layers/ImageMapLayer.js","../src/Layers/TiledMapLayer.js","../src/Layers/FeatureLayer/FeatureGrid.js","../src/Layers/FeatureLayer/FeatureManager.js","../src/Layers/FeatureLayer/FeatureLayer.js","../src/Controls/Logo.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,GAAG,CAAC,WAAW,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI;AAAA,EACtC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAAA,EACpB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,IAAI;AAAA,EACJ,OAAO;AAAA,IACL,IAAI,KAAK,MAAM,CAAC,cAAc,KAAK,eAAe,EAAE,EAAE,CAAC,GAAG,CAAC,cAAc;AAAA,IACzE,aAAa,EAAE,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,aAAa;AAAA;AA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G,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,KAAK,CAAC;AAAA,IAC9K,MAAM,CAAC,GAAG;AAAA;AAAA;AAAA;AAId,WAAW,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,OAAO;AAAA,EAC1C,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO;AAAA","file":"esri-leaflet-src.js","sourcesContent":["var EsriLeaflet = { //jshint ignore:line\n VERSION: '1.0.0-rc.2',\n Layers: {},\n Services: {},\n Controls: {},\n Tasks: {},\n Util: {},\n Support: {\n CORS: !!(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()),\n pointerEvents: document.documentElement.style.pointerEvents === ''\n }\n};\n\nif(typeof window !== 'undefined' && window.L){\n window.L.esri = EsriLeaflet;\n}","(function(EsriLeaflet){\n\n // shallow object clone for feature properties and attributes\n // from http://jsperf.com/cloning-an-object/2\n function clone(obj) {\n var target = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n target[i] = obj[i];\n }\n }\n return target;\n }\n\n // checks if 2 x,y points are equal\n function pointsEqual(a, b) {\n for (var i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n }\n\n // checks if the first and last points of a ring are equal and closes the ring\n function closeRing(coordinates) {\n if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) {\n coordinates.push(coordinates[0]);\n }\n return coordinates;\n }\n\n // determine if polygon ring coordinates are clockwise. clockwise signifies outer ring, counter-clockwise an inner ring\n // or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-\n // points-are-in-clockwise-order\n function ringIsClockwise(ringToTest) {\n var total = 0,i = 0;\n var rLength = ringToTest.length;\n var pt1 = ringToTest[i];\n var pt2;\n for (i; i < rLength - 1; i++) {\n pt2 = ringToTest[i + 1];\n total += (pt2[0] - pt1[0]) * (pt2[1] + pt1[1]);\n pt1 = pt2;\n }\n return (total >= 0);\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L504-L519\n function vertexIntersectsVertex(a1, a2, b1, b2) {\n var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]);\n var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]);\n var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]);\n\n if ( uB !== 0 ) {\n var ua = uaT / uB;\n var ub = ubT / uB;\n\n if ( 0 <= ua && ua <= 1 && 0 <= ub && ub <= 1 ) {\n return true;\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L521-L531\n function arrayIntersectsArray(a, b) {\n for (var i = 0; i < a.length - 1; i++) {\n for (var j = 0; j < b.length - 1; j++) {\n if (vertexIntersectsVertex(a[i], a[i + 1], b[j], b[j + 1])) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L470-L480\n function coordinatesContainPoint(coordinates, point) {\n var contains = false;\n for(var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) {\n if (((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1]) ||\n (coordinates[j][1] <= point[1] && point[1] < coordinates[i][1])) &&\n (point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0])) {\n contains = !contains;\n }\n }\n return contains;\n }\n\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L106-L113\n function coordinatesContainCoordinates(outer, inner){\n var intersects = arrayIntersectsArray(outer, inner);\n var contains = coordinatesContainPoint(outer, inner[0]);\n if(!intersects && contains){\n return true;\n }\n return false;\n }\n\n // do any polygons in this array contain any other polygons in this array?\n // used for checking for holes in arcgis rings\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L117-L172\n function convertRingsToGeoJSON(rings){\n var outerRings = [];\n var holes = [];\n var x; // iterator\n var outerRing; // current outer ring being evaluated\n var hole; // current hole being evaluated\n\n // for each ring\n for (var r = 0; r < rings.length; r++) {\n var ring = closeRing(rings[r].slice(0));\n if(ring.length < 4){\n continue;\n }\n // is this ring an outer ring? is it clockwise?\n if(ringIsClockwise(ring)){\n var polygon = [ ring ];\n outerRings.push(polygon); // push to outer rings\n } else {\n holes.push(ring); // counterclockwise push to holes\n }\n }\n\n var uncontainedHoles = [];\n\n // while there are holes left...\n while(holes.length){\n // pop a hole off out stack\n hole = holes.pop();\n\n // loop over all outer rings and see if they contain our hole.\n var contained = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(coordinatesContainCoordinates(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n contained = true;\n break;\n }\n }\n\n // ring is not contained in any outer ring\n // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320\n if(!contained){\n uncontainedHoles.push(hole);\n }\n }\n\n // if we couldn't match any holes using contains we can try intersects...\n while(uncontainedHoles.length){\n // pop a hole off out stack\n hole = uncontainedHoles.pop();\n\n // loop over all outer rings and see if any intersect our hole.\n var intersects = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(arrayIntersectsArray(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n intersects = true;\n break;\n }\n }\n\n if(!intersects) {\n outerRings.push([hole.reverse()]);\n }\n }\n\n if(outerRings.length === 1){\n return {\n type: 'Polygon',\n coordinates: outerRings[0]\n };\n } else {\n return {\n type: 'MultiPolygon',\n coordinates: outerRings\n };\n }\n }\n\n // This function ensures that rings are oriented in the right directions\n // outer rings are clockwise, holes are counterclockwise\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function orientRings(poly){\n var output = [];\n var polygon = poly.slice(0);\n var outerRing = closeRing(polygon.shift().slice(0));\n if(outerRing.length >= 4){\n if(!ringIsClockwise(outerRing)){\n outerRing.reverse();\n }\n\n output.push(outerRing);\n\n for (var i = 0; i < polygon.length; i++) {\n var hole = closeRing(polygon[i].slice(0));\n if(hole.length >= 4){\n if(ringIsClockwise(hole)){\n hole.reverse();\n }\n output.push(hole);\n }\n }\n }\n\n return output;\n }\n\n // This function flattens holes in multipolygons to one array of polygons\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function flattenMultiPolygonRings(rings){\n var output = [];\n for (var i = 0; i < rings.length; i++) {\n var polygon = orientRings(rings[i]);\n for (var x = polygon.length - 1; x >= 0; x--) {\n var ring = polygon[x].slice(0);\n output.push(ring);\n }\n }\n return output;\n }\n\n // convert an extent (ArcGIS) to LatLngBounds (Leaflet)\n EsriLeaflet.Util.extentToBounds = function(extent){\n var sw = new L.LatLng(extent.ymin, extent.xmin);\n var ne = new L.LatLng(extent.ymax, extent.xmax);\n return new L.LatLngBounds(sw, ne);\n };\n\n // convert an LatLngBounds (Leaflet) to extent (ArcGIS)\n EsriLeaflet.Util.boundsToExtent = function(bounds) {\n bounds = L.latLngBounds(bounds);\n return {\n 'xmin': bounds.getSouthWest().lng,\n 'ymin': bounds.getSouthWest().lat,\n 'xmax': bounds.getNorthEast().lng,\n 'ymax': bounds.getNorthEast().lat,\n 'spatialReference': {\n 'wkid' : 4326\n }\n };\n };\n\n EsriLeaflet.Util.arcgisToGeojson = function (arcgis, idAttribute){\n var geojson = {};\n\n if(typeof arcgis.x === 'number' && typeof arcgis.y === 'number'){\n geojson.type = 'Point';\n geojson.coordinates = [arcgis.x, arcgis.y];\n }\n\n if(arcgis.points){\n geojson.type = 'MultiPoint';\n geojson.coordinates = arcgis.points.slice(0);\n }\n\n if(arcgis.paths) {\n if(arcgis.paths.length === 1){\n geojson.type = 'LineString';\n geojson.coordinates = arcgis.paths[0].slice(0);\n } else {\n geojson.type = 'MultiLineString';\n geojson.coordinates = arcgis.paths.slice(0);\n }\n }\n\n if(arcgis.rings) {\n geojson = convertRingsToGeoJSON(arcgis.rings.slice(0));\n }\n\n if(arcgis.geometry || arcgis.attributes) {\n geojson.type = 'Feature';\n geojson.geometry = (arcgis.geometry) ? EsriLeaflet.Util.arcgisToGeojson(arcgis.geometry) : null;\n geojson.properties = (arcgis.attributes) ? clone(arcgis.attributes) : null;\n if(arcgis.attributes) {\n geojson.id = arcgis.attributes[idAttribute] || arcgis.attributes.OBJECTID || arcgis.attributes.FID;\n }\n }\n\n return geojson;\n };\n\n // GeoJSON -> ArcGIS\n EsriLeaflet.Util.geojsonToArcGIS = function(geojson, idAttribute){\n idAttribute = idAttribute || 'OBJECTID';\n var spatialReference = { wkid: 4326 };\n var result = {};\n var i;\n\n switch(geojson.type){\n case 'Point':\n result.x = geojson.coordinates[0];\n result.y = geojson.coordinates[1];\n result.spatialReference = spatialReference;\n break;\n case 'MultiPoint':\n result.points = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'LineString':\n result.paths = [geojson.coordinates.slice(0)];\n result.spatialReference = spatialReference;\n break;\n case 'MultiLineString':\n result.paths = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'Polygon':\n result.rings = orientRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'MultiPolygon':\n result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'Feature':\n if(geojson.geometry) {\n result.geometry = EsriLeaflet.Util.geojsonToArcGIS(geojson.geometry, idAttribute);\n }\n result.attributes = (geojson.properties) ? clone(geojson.properties) : {};\n if(geojson.id){\n result.attributes[idAttribute] = geojson.id;\n }\n break;\n case 'FeatureCollection':\n result = [];\n for (i = 0; i < geojson.features.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.features[i], idAttribute));\n }\n break;\n case 'GeometryCollection':\n result = [];\n for (i = 0; i < geojson.geometries.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.geometries[i], idAttribute));\n }\n break;\n }\n\n return result;\n };\n\n EsriLeaflet.Util.responseToFeatureCollection = function(response, idAttribute){\n var objectIdField;\n\n if(idAttribute){\n objectIdField = idAttribute;\n } else if(response.objectIdFieldName){\n objectIdField = response.objectIdFieldName;\n } else if(response.fields) {\n for (var j = 0; j <= response.fields.length - 1; j++) {\n if(response.fields[j].type === 'esriFieldTypeOID') {\n objectIdField = response.fields[j].name;\n break;\n }\n }\n } else {\n objectIdField = 'OBJECTID';\n }\n\n var featureCollection = {\n type: 'FeatureCollection',\n features: []\n };\n var features = response.features || response.results;\n if(features.length){\n for (var i = features.length - 1; i >= 0; i--) {\n featureCollection.features.push(EsriLeaflet.Util.arcgisToGeojson(features[i], objectIdField));\n }\n }\n\n return featureCollection;\n };\n\n // trim whitespace and add a tailing slash is needed to a url\n EsriLeaflet.Util.cleanUrl = function(url){\n url = url.replace(/\\s\\s*/g, '');\n\n //add a trailing slash to the url if the user omitted it\n if(url[url.length-1] !== '/'){\n url += '/';\n }\n\n return url;\n };\n\n EsriLeaflet.Util.geojsonTypeToArcGIS = function (geoJsonType) {\n var arcgisGeometryType;\n switch (geoJsonType) {\n case 'Point':\n arcgisGeometryType = 'esriGeometryPoint';\n break;\n case 'MultiPoint':\n arcgisGeometryType = 'esriGeometryMultipoint';\n break;\n case 'LineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'MultiLineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'Polygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n case 'MultiPolygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n }\n return arcgisGeometryType;\n };\n\n})(EsriLeaflet);","(function(EsriLeaflet){\n\n var callbacks = 0;\n\n window._EsriLeafletCallbacks = {};\n\n function serialize(params){\n var data = '';\n\n params.f = 'json';\n\n for (var key in params){\n if(params.hasOwnProperty(key)){\n var param = params[key];\n var type = Object.prototype.toString.call(param);\n var value;\n\n if(data.length){\n data += '&';\n }\n\n if(type === '[object Array]' || type === '[object Object]'){\n value = JSON.stringify(param);\n } else if (type === '[object Date]'){\n value = param.valueOf();\n } else {\n value = param;\n }\n\n data += encodeURIComponent(key) + '=' + encodeURIComponent(value);\n }\n }\n\n return data;\n }\n\n function createRequest(callback, context){\n var httpRequest = new XMLHttpRequest();\n\n httpRequest.onerror = function(e) {\n callback.call(context, {\n error: {\n code: 500,\n message: 'XMLHttpRequest error'\n }\n }, null);\n };\n\n httpRequest.onreadystatechange = function(){\n var response;\n var error;\n\n if (httpRequest.readyState === 4) {\n try {\n response = JSON.parse(httpRequest.responseText);\n } catch(e) {\n response = null;\n error = {\n code: 500,\n message: 'Could not parse response as JSON.'\n };\n }\n\n if (!error && response.error) {\n error = response.error;\n response = null;\n }\n\n callback.call(context, error, response);\n }\n };\n\n return httpRequest;\n }\n\n // AJAX handlers for CORS (modern browsers) or JSONP (older browsers)\n EsriLeaflet.Request = {\n request: function(url, params, callback, context){\n var paramString = serialize(params);\n var httpRequest = createRequest(callback, context);\n var requestLength = (url + '?' + paramString).length;\n\n // request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest\n if(requestLength <= 2000 && L.esri.Support.CORS){\n httpRequest.open('GET', url + '?' + paramString);\n httpRequest.send(null);\n\n // request is less more then 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest\n } else if (requestLength > 2000 && L.esri.Support.CORS){\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(paramString);\n\n // request is less more then 2000 characters and the browser does not support CORS, make a JSONP request\n } else if(requestLength <= 2000 && !L.esri.Support.CORS){\n return L.esri.Request.get.JSONP(url, params, callback, context);\n\n // request is longer then 2000 characters and the browser does not support CORS, log a warning\n } else {\n if(console && console.warn){\n console.warn('a request to ' + url + ' 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');\n return;\n }\n }\n\n return httpRequest;\n },\n post: {\n XMLHTTP: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(serialize(params));\n\n return httpRequest;\n }\n },\n\n get: {\n CORS: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n\n httpRequest.open('GET', url + '?' + serialize(params), true);\n httpRequest.send(null);\n\n return httpRequest;\n },\n JSONP: function(url, params, callback, context){\n var callbackId = 'c' + callbacks;\n\n params.callback = 'window._EsriLeafletCallbacks.' + callbackId;\n\n var script = L.DomUtil.create('script', null, document.body);\n script.type = 'text/javascript';\n script.src = url + '?' + serialize(params);\n script.id = callbackId;\n\n window._EsriLeafletCallbacks[callbackId] = function(response){\n if(window._EsriLeafletCallbacks[callbackId] !== true){\n var error;\n var responseType = Object.prototype.toString.call(response);\n\n if(!(responseType === '[object Object]' || responseType === '[object Array]')){\n error = {\n error: {\n code: 500,\n message: 'Expected array or object as JSONP response'\n }\n };\n response = null;\n }\n\n if (!error && response.error) {\n error = response;\n response = null;\n }\n\n callback.call(context, error, response);\n window._EsriLeafletCallbacks[callbackId] = true;\n }\n };\n\n callbacks++;\n\n return {\n id: callbackId,\n url: script.src,\n abort: function(){\n window._EsriLeafletCallbacks._callback[callbackId]({\n code: 0,\n message: 'Request aborted.'\n });\n }\n };\n }\n }\n };\n\n // Choose the correct AJAX handler depending on CORS support\n EsriLeaflet.get = (EsriLeaflet.Support.CORS) ? EsriLeaflet.Request.get.CORS : EsriLeaflet.Request.get.JSONP;\n\n // Always use XMLHttpRequest for posts\n EsriLeaflet.post = EsriLeaflet.Request.post.XMLHTTP;\n\n // expose a common request method the uses GET\\POST based on request length\n EsriLeaflet.request = EsriLeaflet.Request.request;\n\n})(EsriLeaflet);","EsriLeaflet.Services.Service = L.Class.extend({\n\n includes: L.Mixin.Events,\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n initialize: function (url, options) {\n this.url = EsriLeaflet.Util.cleanUrl(url);\n this._requestQueue = [];\n this._authenticating = false;\n L.Util.setOptions(this, options);\n },\n\n get: function (path, params, callback, context) {\n return this._request('get', path, params, callback, context);\n },\n\n post: function (path, params, callback, context) {\n return this._request('post', path, params, callback, context);\n },\n\n request: function (path, params, callback, context) {\n return this._request('request', path, params, callback, context);\n },\n\n metadata: function (callback, context) {\n return this._request('get', '', {}, callback, context);\n },\n\n authenticate: function(token){\n this._authenticating = false;\n this.options.token = token;\n this._runQueue();\n return this;\n },\n\n _request: function(method, path, params, callback, context){\n this.fire('requeststart', {\n url: this.url + path,\n params: params,\n method: method\n });\n\n var wrappedCallback = this._createServiceCallback(method, path, params, callback, context);\n\n if (this.options.token) {\n params.token = this.options.token;\n }\n\n if (this._authenticating) {\n this._requestQueue.push([method, path, params, callback, context]);\n return;\n } else {\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, wrappedCallback);\n } else {\n return EsriLeaflet[method](url, params, wrappedCallback);\n }\n }\n },\n\n _createServiceCallback: function(method, path, params, callback, context){\n var request = [method, path, params, callback, context];\n\n return L.Util.bind(function(error, response){\n\n if (error && (error.code === 499 || error.code === 498)) {\n this._authenticating = true;\n\n this._requestQueue.push(request);\n\n this.fire('authenticationrequired', {\n authenticate: L.Util.bind(this.authenticate, this)\n });\n } else {\n callback.call(context, error, response);\n\n if(error) {\n this.fire('requesterror', {\n url: this.url + path,\n params: params,\n message: error.message,\n code: error.code,\n method: method\n });\n } else {\n this.fire('requestsuccess', {\n url: this.url + path,\n params: params,\n response: response,\n method: method\n });\n }\n\n this.fire('requestend', {\n url: this.url + path,\n params: params,\n method: method\n });\n }\n }, this);\n },\n\n _runQueue: function(){\n for (var i = this._requestQueue.length - 1; i >= 0; i--) {\n var request = this._requestQueue[i];\n var method = request.shift();\n this[method].apply(this, request);\n }\n this._requestQueue = [];\n }\n\n});\n\nEsriLeaflet.Services.service = function(url, params){\n return new EsriLeaflet.Services.Service(url, params);\n};","EsriLeaflet.Services.FeatureLayer = EsriLeaflet.Services.Service.extend({\n\n options: {\n idAttribute: 'OBJECTID'\n },\n\n query: function(){\n return new EsriLeaflet.Tasks.Query(this);\n },\n\n addFeature: function(feature, callback, context) {\n delete feature.id;\n\n feature = EsriLeaflet.Util.geojsonToArcGIS(feature);\n\n return this.post('addFeatures', {\n features: [feature]\n }, function(error, response){\n var result = (response && response.addResults) ? response.addResults[0] : undefined;\n if(callback){\n callback.call(this, error || response.addResults[0].error, result);\n }\n }, context);\n },\n\n updateFeature: function(feature, callback, context) {\n feature = EsriLeaflet.Util.geojsonToArcGIS(feature, this.options.idAttribute);\n\n return this.post('updateFeatures', {\n features: [feature]\n }, function(error, response){\n var result = (response && response.updateResults) ? response.updateResults[0] : undefined;\n if(callback){\n callback.call(context, error || response.updateResults[0].error, result);\n }\n }, context);\n },\n\n deleteFeature: function(id, callback, context) {\n return this.post('deleteFeatures', {\n objectIds: id\n }, function(error, response){\n var result = (response && response.deleteResults) ? response.deleteResults[0] : undefined;\n if(callback){\n callback.call(context, error || response.deleteResults[0].error, result);\n }\n }, context);\n }\n\n});\n\nEsriLeaflet.Services.featureLayer = function(url, options) {\n return new EsriLeaflet.Services.FeatureLayer(url, options);\n};","EsriLeaflet.Services.MapService = EsriLeaflet.Services.Service.extend({\n\n identify: function () {\n return new EsriLeaflet.Tasks.identifyFeatures(this);\n },\n\n find: function () {\n return new EsriLeaflet.Tasks.Find(this);\n },\n\n query: function () {\n return new EsriLeaflet.Tasks.Query(this);\n }\n\n});\n\nEsriLeaflet.Services.mapService = function(url, params){\n return new EsriLeaflet.Services.MapService(url, params);\n};","EsriLeaflet.Services.ImageService = EsriLeaflet.Services.Service.extend({\n\n query: function () {\n return new EsriLeaflet.Tasks.Query(this);\n },\n\n identify: function() {\n return new EsriLeaflet.Tasks.IdentifyImage(this);\n }\n});\n\nEsriLeaflet.Services.imageService = function(url, params){\n return new EsriLeaflet.Services.ImageService(url, params);\n};","EsriLeaflet.Tasks.Task = L.Class.extend({\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n //Generate a method for each methodName:paramName in the setters for this task.\n generateSetter: function(param, context){\n var isArray = param.match(/([a-zA-Z]+)\\[\\]/);\n\n param = (isArray) ? isArray[1] : param;\n\n if(isArray){\n return L.Util.bind(function(value){\n // this.params[param] = (this.params[param]) ? this.params[param] + ',' : '';\n if (L.Util.isArray(value)) {\n this.params[param] = value.join(',');\n } else {\n this.params[param] = value;\n }\n return this;\n }, context);\n } else {\n return L.Util.bind(function(value){\n this.params[param] = value;\n return this;\n }, context);\n }\n },\n\n initialize: function(endpoint, options){\n // endpoint can be either a url to an ArcGIS Rest Service or an instance of EsriLeaflet.Service\n if(endpoint.url && endpoint.request){\n this._service = endpoint;\n this.url = endpoint.url;\n } else {\n this.url = EsriLeaflet.Util.cleanUrl(endpoint);\n }\n\n // clone default params into this object\n this.params = L.Util.extend({}, this.params || {});\n\n // generate setter methods based on the setters object implimented a child class\n if(this.setters){\n for (var setter in this.setters){\n var param = this.setters[setter];\n this[setter] = this.generateSetter(param, this);\n }\n }\n\n L.Util.setOptions(this, options);\n },\n\n token: function(token){\n if(this._service){\n this._service.authenticate(token);\n } else {\n this.params.token = token;\n }\n return this;\n },\n\n request: function(callback, context){\n if(this._service){\n return this._service.request(this.path, this.params, callback, context);\n } else {\n return this._request('request', this.path, this.params, callback, context);\n }\n },\n\n _request: function(method, path, params, callback, context){\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, callback, context);\n } else{\n return EsriLeaflet[method](url, params, callback, context);\n }\n }\n});","EsriLeaflet.Tasks.Query = EsriLeaflet.Tasks.Task.extend({\n setters: {\n 'offset': 'offset',\n 'limit': 'limit',\n 'outFields': 'fields[]',\n 'precision': 'geometryPrecision',\n 'featureIds': 'objectIds[]',\n 'returnGeometry': 'returnGeometry',\n 'token': 'token'\n },\n\n path: 'query',\n\n params: {\n returnGeometry: true,\n where: '1=1',\n outSr: 4326,\n outFields: '*'\n },\n\n within: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelContains'; // will make code read layer within geometry, to the api this will reads geometry contains layer\n return this;\n },\n\n intersects: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelIntersects';\n return this;\n },\n\n contains: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelWithin'; // will make code read layer contains geometry, to the api this will reads geometry within layer\n return this;\n },\n\n // crosses: function(geometry){\n // this._setGeometry(geometry);\n // this.params.spatialRel = 'esriSpatialRelCrosses';\n // return this;\n // },\n\n // touches: function(geometry){\n // this._setGeometry(geometry);\n // this.params.spatialRel = 'esriSpatialRelTouches';\n // return this;\n // },\n\n overlaps: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelOverlaps';\n return this;\n },\n\n // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online\n nearby: function(latlng, radius){\n latlng = L.latLng(latlng);\n this.params.geometry = ([latlng.lng,latlng.lat]).join(',');\n this.params.geometryType = 'esriGeometryPoint';\n this.params.spatialRel = 'esriSpatialRelIntersects';\n this.params.units = 'esriSRUnit_Meter';\n this.params.distance = radius;\n this.params.inSr = 4326;\n return this;\n },\n\n where: function(string){\n this.params.where = string.replace(/\"/g, \"\\'\"); // jshint ignore:line\n return this;\n },\n\n between: function(start, end){\n this.params.time = ([start.valueOf(), end.valueOf()]).join();\n return this;\n },\n\n fields: function (fields) {\n if (L.Util.isArray(fields)) {\n this.params.outFields = fields.join(',');\n } else {\n this.params.outFields = fields;\n }\n return this;\n },\n\n simplify: function(map, factor){\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\n return this;\n },\n\n orderBy: function(fieldName, order){\n order = order || 'ASC';\n this.params.orderByFields = (this.params.orderByFields) ? this.params.orderByFields + ',' : '';\n this.params.orderByFields += ([fieldName, order]).join(' ');\n return this;\n },\n\n returnGeometry: function(bool){\n this.params.returnGeometry = bool;\n return this;\n },\n\n run: function(callback, context){\n this._cleanParams();\n return this.request(function(error, response){\n callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response);\n }, context);\n },\n\n count: function(callback, context){\n this._cleanParams();\n this.params.returnCountOnly = true;\n return this.request(function(error, response){\n callback.call(this, error, (response && response.count), response);\n }, context);\n },\n\n ids: function(callback, context){\n this._cleanParams();\n this.params.returnIdsOnly = true;\n return this.request(function(error, response){\n callback.call(this, error, (response && response.objectIds), response);\n }, context);\n },\n\n // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online\n bounds: function(callback, context){\n this._cleanParams();\n this.params.returnExtentOnly = true;\n return this.request(function(error, response){\n callback.call(context, error, (response && response.extent && EsriLeaflet.Util.extentToBounds(response.extent)), response);\n }, context);\n },\n\n // only valid for image services\n pixelSize: function(point){\n point = L.point(point);\n this.params.pixelSize = ([point.x,point.y]).join(',');\n return this;\n },\n\n // only valid for map services\n layer: function(layer){\n this.path = layer + '/query';\n return this;\n },\n\n _cleanParams: function(){\n delete this.params.returnIdsOnly;\n delete this.params.returnExtentOnly;\n delete this.params.returnCountOnly;\n },\n\n _setGeometry: function(geometry) {\n this.params.inSr = 4326;\n\n // convert bounds to extent and finish\n if ( geometry instanceof L.LatLngBounds ) {\n // set geometry + geometryType\n this.params.geometry = EsriLeaflet.Util.boundsToExtent(geometry);\n this.params.geometryType = 'esriGeometryEnvelope';\n return;\n }\n\n // convert L.Marker > L.LatLng\n if(geometry.getLatLng){\n geometry = geometry.getLatLng();\n }\n\n // convert L.LatLng to a geojson point and continue;\n if (geometry instanceof L.LatLng) {\n geometry = {\n type: 'Point',\n coordinates: [geometry.lng, geometry.lat]\n };\n }\n\n // handle L.GeoJSON, pull out the first geometry\n if ( geometry instanceof L.GeoJSON ) {\n //reassign geometry to the GeoJSON value (we are assuming that only one feature is present)\n geometry = geometry.getLayers()[0].feature.geometry;\n this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry);\n this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type);\n }\n\n // Handle L.Polyline and L.Polygon\n if (geometry.toGeoJSON) {\n geometry = geometry.toGeoJSON();\n }\n\n // handle GeoJSON feature by pulling out the geometry\n if ( geometry.type === 'Feature' ) {\n // get the geometry of the geojson feature\n geometry = geometry.geometry;\n }\n\n // confirm that our GeoJSON is a point, line or polygon\n if ( geometry.type === 'Point' || geometry.type === 'LineString' || geometry.type === 'Polygon') {\n this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry);\n this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type);\n return;\n }\n\n // warn the user if we havn't found a\n /* global console */\n if(console && console.warn) {\n console.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');\n }\n\n return;\n }\n});\n\nEsriLeaflet.Tasks.query = function(url, params){\n return new EsriLeaflet.Tasks.Query(url, params);\n};","EsriLeaflet.Tasks.Find = EsriLeaflet.Tasks.Task.extend({\n setters: {\n // method name > param name\n 'contains': 'contains',\n 'text': 'searchText',\n 'fields': 'searchFields[]', // denote an array or single string\n 'spatialReference': 'sr',\n 'sr': 'sr',\n 'layers': 'layers[]',\n 'returnGeometry': 'returnGeometry',\n 'maxAllowableOffset': 'maxAllowableOffset',\n 'precision': 'geometryPrecision',\n 'dynamicLayers': 'dynamicLayers',\n 'returnZ' : 'returnZ',\n 'returnM' : 'returnM',\n 'gdbVersion' : 'gdbVersion',\n 'token' : 'token'\n },\n\n path: 'find',\n\n params: {\n sr: 4326,\n contains: true,\n returnGeometry: true,\n returnZ: true,\n returnM: false\n },\n\n layerDefs: function (id, where) {\n this.params.layerDefs = (this.params.layerDefs) ? this.params.layerDefs + ';' : '';\n this.params.layerDefs += ([id, where]).join(':');\n return this;\n },\n\n simplify: function(map, factor){\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\n return this;\n },\n\n run: function (callback, context) {\n return this.request(function(error, response){\n callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response);\n }, context);\n }\n});\n\nEsriLeaflet.Tasks.find = function (url, params) {\n return new EsriLeaflet.Tasks.Find(url, params);\n};","EsriLeaflet.Tasks.Identify = EsriLeaflet.Tasks.Task.extend({\n path: 'identify',\n\n between: function(start, end){\n this.params.time = ([start.valueOf(), end.valueOf()]).join(',');\n return this;\n },\n\n returnGeometry: function (returnGeometry) {\n this.params.returnGeometry = returnGeometry;\n return this;\n }\n});\n","EsriLeaflet.Tasks.IdentifyImage = EsriLeaflet.Tasks.Identify.extend({\n setters: {\n 'setMosaicRule': 'mosaicRule',\n 'setRenderingRule': 'renderingRule',\n 'returnCatalogItems': 'returnCatalogItems'\n },\n\n params: {\n returnGeometry: false\n },\n\n at: function(latlng){\n latlng = L.latLng(latlng);\n this.params.geometry = JSON.stringify({\n x: latlng.lng,\n y: latlng.lat,\n spatialReference:{\n wkid: 4326\n }\n });\n this.params.geometryType = 'esriGeometryPoint';\n return this;\n },\n\n getMosaicRule: function() {\n return this.params.mosaicRule;\n },\n\n getRenderingRule: function() {\n return this.params.renderingRule;\n },\n\n setPixelSize: function(pixelSize) {\n this.params.pixelSize = pixelSize.join ? pixelSize.join(',') : pixelSize;\n return this;\n },\n\n getPixelSize: function() {\n return this.params.pixelSize;\n },\n\n run: function (callback, context){\n return this.request(function(error, response){\n callback.call(context, error, (response && this._responseToGeoJSON(response)), response);\n }, this);\n },\n\n // get pixel data and return as geoJSON point\n // populate catalog items (if any)\n // merging in any catalogItemVisibilities as a propery of each feature\n _responseToGeoJSON: function(response) {\n var location = response.location;\n var catalogItems = response.catalogItems;\n var catalogItemVisibilities = response.catalogItemVisibilities;\n var geoJSON = {\n 'pixel': {\n 'type': 'Feature',\n 'geometry': {\n 'type': 'Point',\n 'coordinates': [location.x, location.y]\n },\n 'crs': {\n 'type': 'EPSG',\n 'properties': {\n 'code': location.spatialReference.wkid\n }\n },\n 'properties': {\n 'OBJECTID': response.objectId,\n 'name': response.name,\n 'value': response.value\n },\n 'id': response.objectId\n }\n };\n if (response.properties && response.properties.Values) {\n geoJSON.pixel.properties.values = response.properties.Values;\n }\n if (catalogItems && catalogItems.features) {\n geoJSON.catalogItems = EsriLeaflet.Util.responseToFeatureCollection(catalogItems);\n if (catalogItemVisibilities && catalogItemVisibilities.length === geoJSON.catalogItems.features.length) {\n for (var i = catalogItemVisibilities.length - 1; i >= 0; i--) {\n geoJSON.catalogItems.features[i].properties.catalogItemVisibility = catalogItemVisibilities[i];\n }\n }\n }\n return geoJSON;\n }\n\n});\n\nEsriLeaflet.Tasks.identifyImage = function(url, params){\n return new EsriLeaflet.Tasks.IdentifyImage(url, params);\n};","EsriLeaflet.Tasks.IdentifyFeatures = EsriLeaflet.Tasks.Identify.extend({\n setters: {\n 'layers': 'layers',\n 'precision': 'geometryPrecision',\n 'tolerance': 'tolerance'\n },\n\n params: {\n sr: 4326,\n layers: 'all',\n tolerance: 3,\n returnGeometry: true\n },\n\n on: function(map){\n var extent = EsriLeaflet.Util.boundsToExtent(map.getBounds());\n var size = map.getSize();\n this.params.imageDisplay = [size.x, size.y, 96].join(',');\n this.params.mapExtent=([extent.xmin, extent.ymin, extent.xmax, extent.ymax]).join(',');\n return this;\n },\n\n at: function(latlng){\n latlng = L.latLng(latlng);\n this.params.geometry = ([latlng.lng, latlng.lat]).join(',');\n this.params.geometryType = 'esriGeometryPoint';\n return this;\n },\n\n layerDef: function (id, where){\n this.params.layerDefs = (this.params.layerDefs) ? this.params.layerDefs + ';' : '';\n this.params.layerDefs += ([id, where]).join(':');\n return this;\n },\n\n simplify: function(map, factor){\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * (1 - factor);\n return this;\n },\n\n run: function (callback, context){\n return this.request(function(error, response){\n callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response);\n }, context);\n }\n\n});\n\nEsriLeaflet.Tasks.identifyFeatures = function(url, params){\n return new EsriLeaflet.Tasks.IdentifyFeatures(url, params);\n};","(function(EsriLeaflet){\n\n var tileProtocol = (window.location.protocol !== 'https:') ? 'http:' : 'https:';\n\n EsriLeaflet.Layers.BasemapLayer = L.TileLayer.extend({\n statics: {\n TILES: {\n Streets: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}',\n attributionUrl: 'https://static.arcgis.com/attribution/World_Street_Map',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services'],\n attribution: 'Esri'\n }\n },\n Topographic: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}',\n attributionUrl: 'https://static.arcgis.com/attribution/World_Topo_Map',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services'],\n attribution: 'Esri'\n }\n },\n Oceans: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}',\n attributionUrl: 'https://static.arcgis.com/attribution/Ocean_Basemap',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services'],\n attribution: 'Esri'\n }\n },\n OceansLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services']\n }\n },\n NationalGeographic: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services'],\n attribution: 'Esri'\n }\n },\n DarkGray: {\n urlTemplate: tileProtocol + '//tiles{s}.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Dark_Gray_Base_Beta/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 10,\n subdomains: ['1', '2'],\n attribution: 'Esri, DeLorme, HERE'\n }\n },\n DarkGrayLabels: {\n urlTemplate: tileProtocol + '//tiles{s}.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Dark_Gray_Reference_Beta/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 10,\n subdomains: ['1', '2']\n }\n },\n Gray: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services'],\n attribution: 'Esri, NAVTEQ, DeLorme'\n }\n },\n GrayLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services']\n }\n },\n Imagery: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services'],\n attribution: 'Esri, DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community'\n }\n },\n ImageryLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services']\n }\n },\n ImageryTransportation: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}',\n //pane: 'esri-label',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services']\n }\n },\n ShadedRelief: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 13,\n subdomains: ['server', 'services'],\n attribution: 'ESRI, NAVTEQ, DeLorme'\n }\n },\n ShadedReliefLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 12,\n subdomains: ['server', 'services']\n }\n },\n Terrain: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 13,\n subdomains: ['server', 'services'],\n attribution: 'Esri, USGS, NOAA'\n }\n },\n TerrainLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 13,\n subdomains: ['server', 'services']\n }\n }\n }\n },\n initialize: function(key, options){\n var config;\n\n // set the config variable with the appropriate config object\n if (typeof key === 'object' && key.urlTemplate && key.options){\n config = key;\n } else if(typeof key === 'string' && EsriLeaflet.BasemapLayer.TILES[key]){\n config = EsriLeaflet.BasemapLayer.TILES[key];\n } else {\n 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\"');\n }\n\n // merge passed options into the config options\n var tileOptions = L.Util.extend(config.options, options);\n\n // call the initialize method on L.TileLayer to set everything up\n L.TileLayer.prototype.initialize.call(this, config.urlTemplate, L.Util.setOptions(this, tileOptions));\n\n // if this basemap requires dynamic attribution set it up\n if(config.attributionUrl){\n this._getAttributionData(config.attributionUrl);\n }\n },\n onAdd: function(map){\n if(!this.options.hideLogo){\n this._logo = new EsriLeaflet.Controls.Logo({\n position: this.options.logoPosition\n }).addTo(map);\n }\n\n // if(this.options.pane && EsriLeaflet.Support.pointerEvents){\n // this._initPane();\n // }\n\n L.TileLayer.prototype.onAdd.call(this, map);\n\n map.on('moveend', this._updateMapAttribution, this);\n },\n onRemove: function(map){\n if(this._logo){\n map.removeControl(this._logo);\n }\n\n L.TileLayer.prototype.onRemove.call(this, map);\n\n map.off('moveend', this._updateMapAttribution, this);\n },\n getAttribution:function(){\n var attribution = '' + this.options.attribution + ''/* + logo*/;\n return attribution;\n },\n // _initPane: function(){\n // if(!this._map.getPane(this.options.pane)){\n // var pane = this._map.createPane(this.options.pane);\n // pane.style.pointerEvents = 'none';\n // pane.style.zIndex = 5;\n // }\n // },\n _getAttributionData: function(url){\n EsriLeaflet.get(url, {}, function(error, attributions){\n this._attributions = [];\n for (var c = 0; c < attributions.contributors.length; c++) {\n var contributor = attributions.contributors[c];\n for (var i = 0; i < contributor.coverageAreas.length; i++) {\n var coverageArea = contributor.coverageAreas[i];\n var southWest = new L.LatLng(coverageArea.bbox[0], coverageArea.bbox[1]);\n var northEast = new L.LatLng(coverageArea.bbox[2], coverageArea.bbox[3]);\n this._attributions.push({\n attribution: contributor.attribution,\n score: coverageArea.score,\n bounds: new L.LatLngBounds(southWest, northEast),\n minZoom: coverageArea.zoomMin,\n maxZoom: coverageArea.zoomMax\n });\n }\n }\n\n this._attributions.sort(function(a, b){\n return b.score - a.score;\n });\n\n this._updateMapAttribution();\n }, this);\n },\n _updateMapAttribution: function(){\n if(this._map && this._map.attributionControl && this._attributions){\n var newAttributions = '';\n var bounds = this._map.getBounds();\n var zoom = this._map.getZoom();\n\n for (var i = 0; i < this._attributions.length; i++) {\n var attribution = this._attributions[i];\n var text = attribution.attribution;\n if(!newAttributions.match(text) && bounds.intersects(attribution.bounds) && zoom >= attribution.minZoom && zoom <= attribution.maxZoom) {\n newAttributions += (', ' + text);\n }\n }\n newAttributions = newAttributions.substr(2);\n var attributionElement = this._map.attributionControl._container.querySelector('.esri-attributions');\n attributionElement.innerHTML = newAttributions;\n attributionElement.style.maxWidth = (this._map.getSize().x * 0.65) + 'px';\n this.fire('attributionupdated', {\n attribution: newAttributions\n });\n }\n }\n });\n\n EsriLeaflet.BasemapLayer = EsriLeaflet.Layers.BasemapLayer;\n\n EsriLeaflet.Layers.basemapLayer = function(key, options){\n return new EsriLeaflet.Layers.BasemapLayer(key, options);\n };\n\n EsriLeaflet.basemapLayer = function(key, options){\n return new EsriLeaflet.Layers.BasemapLayer(key, options);\n };\n\n})(EsriLeaflet);","EsriLeaflet.Layers.RasterLayer = L.Class.extend({\n includes: L.Mixin.Events,\n\n options: {\n opacity: 1,\n position: 'front',\n f: 'image'\n },\n\n onAdd: function (map) {\n this._map = map;\n\n this._update = L.Util.limitExecByInterval(this._update, this.options.updateInterval, this);\n\n if (map.options.crs && map.options.crs.code) {\n var sr = map.options.crs.code.split(':')[1];\n this.options.bboxSR = sr;\n this.options.imageSR = sr;\n }\n\n map.on('moveend', this._update, this);\n\n this._update();\n\n if(this._popup){\n this._map.on('click', this._getPopupData, this);\n this._map.on('dblclick', this._resetPopupState, this);\n }\n },\n\n bindPopup: function(fn, popupOptions){\n this._shouldRenderPopup = false;\n this._lastClick = false;\n this._popup = L.popup(popupOptions);\n this._popupFunction = fn;\n if(this._map){\n this._map.on('click', this._getPopupData, this);\n this._map.on('dblclick', this._resetPopupState, this);\n }\n return this;\n },\n\n unbindPopup: function(){\n if(this._map){\n this._map.closePopup(this._popup);\n this._map.off('click', this._getPopupData, this);\n this._map.off('dblclick', this._resetPopupState, this);\n }\n this._popup = false;\n return this;\n },\n\n onRemove: function (map) {\n\n if (this._currentImage) {\n this._map.removeLayer(this._currentImage);\n }\n\n if(this._popup){\n this._map.off('click', this._getPopupData, this);\n this._map.off('dblclick', this._resetPopupState, this);\n }\n\n this._map.off('moveend', this._update, this);\n this._map = null;\n },\n\n addTo: function(map){\n map.addLayer(this);\n return this;\n },\n\n removeFrom: function(map){\n map.removeLayer(this);\n return this;\n },\n\n bringToFront: function(){\n this.options.position = 'front';\n if(this._currentImage){\n this._currentImage.bringToFront();\n }\n return this;\n },\n\n bringToBack: function(){\n this.options.position = 'back';\n if(this._currentImage){\n this._currentImage.bringToBack();\n }\n return this;\n },\n\n getAttribution: function () {\n return this.options.attribution;\n },\n\n getOpacity: function(){\n return this.options.opacity;\n },\n\n setOpacity: function(opacity){\n this.options.opacity = opacity;\n this._currentImage.setOpacity(opacity);\n return this;\n },\n\n getTimeRange: function(){\n return [this.options.from, this.options.to];\n },\n\n setTimeRange: function(from, to){\n this.options.from = from;\n this.options.to = to;\n this._update();\n return this;\n },\n\n metadata: function(callback, context){\n this._service.metadata(callback, context);\n return this;\n },\n\n authenticate: function(token){\n this._service.authenticate(token);\n return this;\n },\n\n _renderImage: function(url, bounds){\n if(this._map){\n var image = new L.ImageOverlay(url, bounds, {\n opacity: 0\n }).addTo(this._map);\n\n image.once('load', function(e){\n var newImage = e.target;\n var oldImage = this._currentImage;\n if(newImage._bounds.equals(bounds)){\n this._currentImage = newImage;\n\n if(this.options.position === 'front'){\n this.bringToFront();\n } else {\n this.bringToBack();\n }\n\n if(this._map && this._currentImage._map){\n this._currentImage.setOpacity(this.options.opacity);\n } else {\n this._currentImage._map.removeLayer(this._currentImage);\n }\n\n if(oldImage){\n this._map.removeLayer(oldImage);\n }\n\n } else {\n this._map.removeLayer(newImage);\n }\n\n this.fire('load', {\n bounds: bounds\n });\n\n }, this);\n\n this.fire('loading', {\n bounds: bounds\n });\n }\n },\n\n _update: function () {\n if(!this._map){\n return;\n }\n\n var zoom = this._map.getZoom();\n var bounds = this._map.getBounds();\n\n if(this._animatingZoom){\n return;\n }\n\n if (this._map._panTransition && this._map._panTransition._inProgress) {\n return;\n }\n\n if (zoom > this.options.maxZoom || zoom < this.options.minZoom) {\n return;\n }\n var params = this._buildExportParams();\n\n this._requestExport(params, bounds);\n },\n\n // TODO: refactor these into raster layer\n _renderPopup: function(latlng, error, results, response){\n latlng = L.latLng(latlng);\n if(this._shouldRenderPopup && this._lastClick.equals(latlng)){\n //add the popup to the map where the mouse was clicked at\n var content = this._popupFunction(error, results, response);\n if (content) {\n this._popup.setLatLng(latlng).setContent(content).openOn(this._map);\n }\n }\n },\n\n _resetPopupState: function(e){\n this._shouldRenderPopup = false;\n this._lastClick = e.latlng;\n },\n\n // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js\n // @TODO remove at Leaflet 0.8\n _propagateEvent: function (e) {\n e = L.extend({\n layer: e.target,\n target: this\n }, e);\n this.fire(e.type, e);\n }\n});","EsriLeaflet.Layers.DynamicMapLayer = EsriLeaflet.Layers.RasterLayer.extend({\n\n options: {\n updateInterval: 150,\n layers: false,\n layerDefs: false,\n timeOptions: false,\n format: 'png24',\n transparent: true\n },\n\n initialize: function (url, options) {\n this.url = EsriLeaflet.Util.cleanUrl(url);\n this._service = new EsriLeaflet.Services.MapService(this.url, options);\n this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', this._propagateEvent, this);\n L.Util.setOptions(this, options);\n },\n\n getLayers: function(){\n return this.options.layers;\n },\n\n setLayers: function(layers){\n this.options.layers = layers;\n this._update();\n return this;\n },\n\n getLayerDefs: function(){\n return this.options.layerDefs;\n },\n\n setLayerDefs: function(layerDefs){\n this.options.layerDefs = layerDefs;\n this._update();\n return this;\n },\n\n getTimeOptions: function(){\n return this.options.timeOptions;\n },\n\n setTimeOptions: function(timeOptions){\n this.options.timeOptions = timeOptions;\n this._update();\n return this;\n },\n\n query: function(){\n return this._service.query();\n },\n\n identify: function(){\n return this._service.identify();\n },\n\n find: function(){\n return this._service.find();\n },\n\n _getPopupData: function(e){\n var callback = L.Util.bind(function(error, featureCollection, response) {\n setTimeout(L.Util.bind(function(){\n this._renderPopup(e.latlng, error, featureCollection, response);\n }, this), 300);\n }, this);\n\n var identifyRequest = this.identify().on(this._map).at(e.latlng);\n\n if(this.options.layers){\n identifyRequest.layers('visible:' + this.options.layers.join(','));\n } else {\n identifyRequest.layers('visible');\n }\n\n identifyRequest.run(callback);\n\n // set the flags to show the popup\n this._shouldRenderPopup = true;\n this._lastClick = e.latlng;\n },\n\n _buildExportParams: function () {\n var bounds = this._map.getBounds();\n var size = this._map.getSize();\n var ne = this._map.options.crs.project(bounds._northEast);\n var sw = this._map.options.crs.project(bounds._southWest);\n\n var params = {\n bbox: [sw.x, sw.y, ne.x, ne.y].join(','),\n size: size.x + ',' + size.y,\n dpi: 96,\n format: this.options.format,\n transparent: this.options.transparent,\n bboxSR: this.options.bboxSR,\n imageSR: this.options.imageSR\n };\n\n if(this.options.layers){\n params.layers = 'show:' + this.options.layers.join(',');\n }\n\n if(this.options.layerDefs){\n params.layerDefs = JSON.stringify(this.options.layerDefs);\n }\n\n if(this.options.timeOptions){\n params.timeOptions = JSON.stringify(this.options.timeOptions);\n }\n\n if(this.options.from && this.options.to){\n params.time = this.options.from.valueOf() + ',' + this.options.to.valueOf();\n }\n\n if(this._service.options.token) {\n params.token = this._service.options.token;\n }\n\n return params;\n },\n\n _requestExport: function (params, bounds) {\n if(this.options.f === 'json'){\n this._service.get('export', params, function(error, response){\n this._renderImage(response.href, bounds);\n }, this);\n } else {\n params.f = 'image';\n this._renderImage(this.url + 'export' + L.Util.getParamString(params), bounds);\n }\n }\n});\n\nEsriLeaflet.DynamicMapLayer = EsriLeaflet.Layers.DynamicMapLayer;\n\nEsriLeaflet.Layers.dynamicMapLayer = function(url, options){\n return new EsriLeaflet.Layers.DynamicMapLayer(url, options);\n};\n\nEsriLeaflet.dynamicMapLayer = function(url, options){\n return new EsriLeaflet.Layers.DynamicMapLayer(url, options);\n};","EsriLeaflet.Layers.ImageMapLayer = EsriLeaflet.Layers.RasterLayer.extend({\n\n options: {\n updateInterval: 150,\n format: 'jpgpng'\n },\n\n query: function(){\n return this._service.query();\n },\n\n identify: function(){\n return this._service.identify();\n },\n\n initialize: function (url, options) {\n this.url = EsriLeaflet.Util.cleanUrl(url);\n this._service = new EsriLeaflet.Services.ImageService(this.url, options);\n this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', this._propagateEvent, this);\n L.Util.setOptions(this, options);\n },\n\n setPixelType: function (pixelType) {\n this.options.pixelType = pixelType;\n this._update();\n return this;\n },\n\n getPixelType: function () {\n return this.options.pixelType;\n },\n\n setBandIds: function (bandIds) {\n if (L.Util.isArray(bandIds)) {\n this.options.bandIds = bandIds.join(',');\n } else {\n this.options.bandIds = bandIds.toString();\n }\n this._update();\n return this;\n },\n\n getBandIds: function () {\n return this.options.bandIds;\n },\n\n setNoData: function (noData, noDataInterpretation) {\n if (L.Util.isArray(noData)) {\n this.options.noData = noData.join(',');\n } else {\n this.options.noData = noData.toString();\n }\n if (noDataInterpretation) {\n this.options.noDataInterpretation = noDataInterpretation;\n }\n this._update();\n return this;\n },\n\n getNoData: function () {\n return this.options.noData;\n },\n\n getNoDataInterpretation: function () {\n return this.options.noDataInterpretation;\n },\n\n setRenderingRule: function(renderingRule) {\n this.options.renderingRule = renderingRule;\n this._update();\n },\n\n getRenderingRule: function() {\n return this.options.renderingRule;\n },\n\n setMosaicRule: function(mosaicRule) {\n this.options.mosaicRule = mosaicRule;\n this._update();\n },\n\n getMosaicRule: function() {\n return this.options.mosaicRule;\n },\n\n _getPopupData: function(e){\n var callback = L.Util.bind(function(error, results, response) {\n setTimeout(L.Util.bind(function(){\n this._renderPopup(e.latlng, error, results, response);\n }, this), 300);\n }, this);\n\n var identifyRequest = this.identify().at(e.latlng);\n\n // set mosaic rule for identify task if it is set for layer\n if (this.options.mosaicRule) {\n identifyRequest.setMosaicRule(this.options.mosaicRule);\n // @TODO: force return catalog items too?\n }\n\n // @TODO: set rendering rule? Not sure,\n // sometimes you want raw pixel values\n // if (this.options.renderingRule) {\n // identifyRequest.setRenderingRule(this.options.renderingRule);\n // }\n\n identifyRequest.run(callback);\n\n // set the flags to show the popup\n this._shouldRenderPopup = true;\n this._lastClick = e.latlng;\n },\n\n _buildExportParams: function () {\n var bounds = this._map.getBounds();\n var size = this._map.getSize();\n var ne = this._map.options.crs.project(bounds._northEast);\n var sw = this._map.options.crs.project(bounds._southWest);\n\n var params = {\n bbox: [sw.x, sw.y, ne.x, ne.y].join(','),\n size: size.x + ',' + size.y,\n format: this.options.format,\n bboxSR: this.options.bboxSR,\n imageSR: this.options.imageSR\n };\n\n if (this.options.from && this.options.to) {\n params.time = this.options.from.valueOf() + ',' + this.options.to.valueOf();\n }\n\n if (this.options.pixelType) {\n params.pixelType = this.options.pixelType;\n }\n\n if (this.options.interpolation) {\n params.interpolation = this.options.interpolation;\n }\n\n if (this.options.compressionQuality) {\n params.compressionQuality = this.options.compressionQuality;\n }\n\n if (this.options.bandIds) {\n params.bandIds = this.options.bandIds;\n }\n\n if (this.options.noData) {\n params.noData = this.options.noData;\n }\n\n if (this.options.noDataInterpretation) {\n params.noDataInterpretation = this.options.noDataInterpretation;\n }\n\n if (this._service.options.token) {\n params.token = this._service.options.token;\n }\n\n if(this.options.renderingRule) {\n params.renderingRule = JSON.stringify(this.options.renderingRule);\n }\n\n if(this.options.mosaicRule) {\n params.mosaicRule = JSON.stringify(this.options.mosaicRule);\n }\n\n return params;\n },\n\n _requestExport: function (params, bounds) {\n if (this.options.f === 'json') {\n this._service.get('exportImage', params, function(error, response){\n this._renderImage(response.href, bounds);\n }, this);\n } else {\n params.f = 'image';\n this._renderImage(this.url + 'exportImage' + L.Util.getParamString(params), bounds);\n }\n }\n});\n\nEsriLeaflet.ImageMapLayer = EsriLeaflet.Layers.ImageMapLayer;\n\nEsriLeaflet.Layers.imageMapLayer = function (url, options) {\n return new EsriLeaflet.Layers.ImageMapLayer(url, options);\n};\n\nEsriLeaflet.imageMapLayer = function (url, options) {\n return new EsriLeaflet.Layers.ImageMapLayer(url, options);\n};","EsriLeaflet.Layers.TiledMapLayer = L.TileLayer.extend({\n initialize: function(url, options){\n options = L.Util.setOptions(this, options);\n\n // set the urls\n this.url = L.esri.Util.cleanUrl(url);\n this.tileUrl = L.esri.Util.cleanUrl(url) + 'tile/{z}/{y}/{x}';\n this._service = new L.esri.Services.MapService(this.url, options);\n this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', this._propagateEvent, this);\n\n //if this is looking at the AGO tiles subdomain insert the subdomain placeholder\n if(this.tileUrl.match('://tiles.arcgisonline.com')){\n this.tileUrl = this.tileUrl.replace('://tiles.arcgisonline.com', '://tiles{s}.arcgisonline.com');\n options.subdomains = ['1', '2', '3', '4'];\n }\n\n if(this.options.token) {\n this.tileUrl += ('?token=' + this.options.token);\n }\n\n // init layer by calling TileLayers initialize method\n L.TileLayer.prototype.initialize.call(this, this.tileUrl, options);\n },\n\n metadata: function(callback, context){\n this._service.metadata(callback, context);\n return this;\n },\n\n identify: function(){\n return this._service.identify();\n },\n\n authenticate: function(token){\n var tokenQs = '?token=' + token;\n this.tileUrl = (this.options.token) ? this.tileUrl.replace(/\\?token=(.+)/g, tokenQs) : this.tileUrl + tokenQs;\n this.options.token = token;\n this._service.authenticate(token);\n return this;\n },\n\n // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js\n // @TODO remove at Leaflet 0.8\n _propagateEvent: function (e) {\n e = L.extend({\n layer: e.target,\n target: this\n }, e);\n this.fire(e.type, e);\n }\n});\n\nL.esri.TiledMapLayer = L.esri.Layers.tiledMapLayer;\n\nL.esri.Layers.tiledMapLayer = function(url, options){\n return new L.esri.Layers.TiledMapLayer(url, options);\n};\n\nL.esri.tiledMapLayer = function(url, options){\n return new L.esri.Layers.TiledMapLayer(url, options);\n};","EsriLeaflet.Layers.FeatureGrid = L.Class.extend({\n\n includes: L.Mixin.Events,\n\n options: {\n cellSize: 512,\n updateInterval: 150\n },\n\n initialize: function (options) {\n options = L.setOptions(this, options);\n },\n\n onAdd: function (map) {\n this._map = map;\n this._update = L.Util.limitExecByInterval(this._update, this.options.updateInterval, this);\n\n // @TODO remove for leaflet 0.8\n this._map.addEventListener(this.getEvents(), this);\n\n this._reset();\n this._update();\n },\n\n onRemove: function(){\n this._map.removeEventListener(this.getEvents(), this);\n this._removeCells();\n },\n\n getEvents: function () {\n var events = {\n viewreset: this._reset,\n moveend: this._update\n };\n\n return events;\n },\n\n addTo: function(map){\n map.addLayer(this);\n return this;\n },\n\n removeFrom: function(map){\n map.removeLayer(this);\n return this;\n },\n\n _reset: function () {\n this._removeCells();\n\n this._cells = {};\n this._activeCells = {};\n this._cellsToLoad = 0;\n this._cellsTotal = 0;\n\n // @TODO enable at Leaflet 0.8\n // this._cellNumBounds = this._getCellNumBounds();\n\n this._resetWrap();\n },\n\n _resetWrap: function () {\n var map = this._map,\n crs = map.options.crs;\n\n if (crs.infinite) { return; }\n\n var cellSize = this._getCellSize();\n\n if (crs.wrapLng) {\n this._wrapLng = [\n Math.floor(map.project([0, crs.wrapLng[0]]).x / cellSize),\n Math.ceil(map.project([0, crs.wrapLng[1]]).x / cellSize)\n ];\n }\n\n if (crs.wrapLat) {\n this._wrapLat = [\n Math.floor(map.project([crs.wrapLat[0], 0]).y / cellSize),\n Math.ceil(map.project([crs.wrapLat[1], 0]).y / cellSize)\n ];\n }\n },\n\n _getCellSize: function () {\n return this.options.cellSize;\n },\n\n _update: function () {\n if (!this._map) { return; }\n\n var bounds = this._map.getPixelBounds(),\n zoom = this._map.getZoom(),\n cellSize = this._getCellSize();\n\n if (zoom > this.options.maxZoom ||\n zoom < this.options.minZoom) { return; }\n\n // cell coordinates range for the current view\n var cellBounds = L.bounds(\n bounds.min.divideBy(cellSize).floor(),\n bounds.max.divideBy(cellSize).floor());\n\n this._addCells(cellBounds);\n this._removeOtherCells(cellBounds);\n },\n\n _addCells: function (bounds) {\n var queue = [],\n center = bounds.getCenter(),\n zoom = this._map.getZoom();\n\n var j, i, coords;\n // create a queue of coordinates to load cells from\n for (j = bounds.min.y; j <= bounds.max.y; j++) {\n for (i = bounds.min.x; i <= bounds.max.x; i++) {\n coords = new L.Point(i, j);\n coords.z = zoom;\n\n // @TODO enable at Leaflet 0.8\n // if (this._isValidCell(coords)) {\n // queue.push(coords);\n // }\n\n queue.push(coords);\n }\n }\n var cellsToLoad = queue.length;\n\n if (cellsToLoad === 0) { return; }\n\n this._cellsToLoad += cellsToLoad;\n this._cellsTotal += cellsToLoad;\n\n // sort cell queue to load cells in order of their distance to center\n queue.sort(function (a, b) {\n return a.distanceTo(center) - b.distanceTo(center);\n });\n\n for (i = 0; i < cellsToLoad; i++) {\n this._addCell(queue[i]);\n }\n },\n\n // @TODO enable at Leaflet 0.8\n // _isValidCell: function (coords) {\n // var crs = this._map.options.crs;\n\n // if (!crs.infinite) {\n // // don't load cell if it's out of bounds and not wrapped\n // var bounds = this._cellNumBounds;\n // if (\n // (!crs.wrapLng && (coords.x < bounds.min.x || coords.x > bounds.max.x)) ||\n // (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y))\n // ) {\n // return false;\n // }\n // }\n\n // if (!this.options.bounds) {\n // return true;\n // }\n\n // // don't load cell if it doesn't intersect the bounds in options\n // var cellBounds = this._cellCoordsToBounds(coords);\n // return L.latLngBounds(this.options.bounds).intersects(cellBounds);\n // },\n\n // converts cell coordinates to its geographical bounds\n _cellCoordsToBounds: function (coords) {\n var map = this._map,\n cellSize = this.options.cellSize,\n\n nwPoint = coords.multiplyBy(cellSize),\n sePoint = nwPoint.add([cellSize, cellSize]),\n\n // @TODO for Leaflet 0.8\n // nw = map.wrapLatLng(map.unproject(nwPoint, coords.z)),\n // se = map.wrapLatLng(map.unproject(sePoint, coords.z));\n\n nw = map.unproject(nwPoint, coords.z).wrap(),\n se = map.unproject(sePoint, coords.z).wrap();\n\n return new L.LatLngBounds(nw, se);\n },\n\n // converts cell coordinates to key for the cell cache\n _cellCoordsToKey: function (coords) {\n return coords.x + ':' + coords.y;\n },\n\n // converts cell cache key to coordiantes\n _keyToCellCoords: function (key) {\n var kArr = key.split(':'),\n x = parseInt(kArr[0], 10),\n y = parseInt(kArr[1], 10);\n\n return new L.Point(x, y);\n },\n\n // remove any present cells that are off the specified bounds\n _removeOtherCells: function (bounds) {\n for (var key in this._cells) {\n if (!bounds.contains(this._keyToCellCoords(key))) {\n this._removeCell(key);\n }\n }\n },\n\n _removeCell: function (key) {\n var cell = this._activeCells[key];\n if(cell){\n delete this._activeCells[key];\n\n if (this.cellLeave) {\n this.cellLeave(cell.bounds, cell.coords);\n }\n\n this.fire('cellleave', {\n bounds: cell.bounds,\n coords: cell.coords\n });\n }\n },\n\n _removeCells: function(){\n for (var key in this._cells) {\n var bounds = this._cells[key].bounds;\n var coords = this._cells[key].coords;\n\n if (this.cellLeave) {\n this.cellLeave(bounds, coords);\n }\n\n this.fire('cellleave', {\n bounds: bounds,\n coords: coords\n });\n }\n },\n\n _addCell: function (coords) {\n\n // wrap cell coords if necessary (depending on CRS)\n this._wrapCoords(coords);\n\n // generate the cell key\n var key = this._cellCoordsToKey(coords);\n\n // get the cell from the cache\n var cell = this._cells[key];\n // if this cell should be shown as isnt active yet (enter)\n\n if (cell && !this._activeCells[key]) {\n if (this.cellEnter) {\n this.cellEnter(cell.bounds, coords);\n }\n\n this.fire('cellenter', {\n bounds: cell.bounds,\n coords: coords\n });\n\n this._activeCells[key] = cell;\n }\n\n // if we dont have this cell in the cache yet (create)\n if (!cell) {\n cell = {\n coords: coords,\n bounds: this._cellCoordsToBounds(coords)\n };\n\n this._cells[key] = cell;\n this._activeCells[key] = cell;\n\n if(this.createCell){\n this.createCell(cell.bounds, coords);\n }\n\n this.fire('cellcreate', {\n bounds: cell.bounds,\n coords: coords\n });\n }\n },\n\n _wrapCoords: function (coords) {\n coords.x = this._wrapLng ? L.Util.wrapNum(coords.x, this._wrapLng) : coords.x;\n coords.y = this._wrapLat ? L.Util.wrapNum(coords.y, this._wrapLat) : coords.y;\n }\n\n // get the global cell coordinates range for the current zoom\n // @TODO enable at Leaflet 0.8\n // _getCellNumBounds: function () {\n // // @TODO for Leaflet 0.8\n // // var bounds = this._map.getPixelWorldBounds(),\n // // size = this._getCellSize();\n // //\n // // return bounds ? L.bounds(\n // // bounds.min.divideBy(size).floor(),\n // // bounds.max.divideBy(size).ceil().subtract([1, 1])) : null;\n // }\n\n});","(function(EsriLeaflet){\n\n EsriLeaflet.Layers.FeatureManager = EsriLeaflet.Layers.FeatureGrid.extend({\n\n /**\n * Options\n */\n\n options: {\n where: '1=1',\n fields: ['*'],\n from: false,\n to: false,\n timeField: false,\n timeFilterMode: 'server',\n simplifyFactor: 0,\n precision: 6\n },\n\n /**\n * Constructor\n */\n\n initialize: function (url, options) {\n EsriLeaflet.Layers.FeatureGrid.prototype.initialize.call(this, options);\n\n options = L.setOptions(this, options);\n\n this.url = EsriLeaflet.Util.cleanUrl(url);\n\n this._service = new EsriLeaflet.Services.FeatureLayer(this.url, options);\n\n //use case insensitive regex to look for common fieldnames used for indexing\n /*global console */\n if (this.options.fields[0] !== '*'){\n var oidCheck = false;\n for (var i = 0; i < this.options.fields.length; i++){\n if (this.options.fields[i].match(/^(OBJECTID|FID|OID|ID)$/i)){\n oidCheck = true;\n }\n }\n if (oidCheck === false && console && console.warn){\n console.warn('no known esriFieldTypeOID field detected in fields Array. Please add an attribute field containing unique IDs to ensure the layer can be drawn correctly.');\n }\n }\n\n // Leaflet 0.8 change to new propagation\n this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', function (e) {\n e = L.extend({\n target: this\n }, e);\n this.fire(e.type, e);\n }, this);\n\n if(this.options.timeField.start && this.options.timeField.end){\n this._startTimeIndex = new BinarySearchIndex();\n this._endTimeIndex = new BinarySearchIndex();\n } else if(this.options.timeField){\n this._timeIndex = new BinarySearchIndex();\n }\n\n this._currentSnapshot = []; // cache of what layers should be active\n this._activeRequests = 0;\n this._pendingRequests = [];\n },\n\n /**\n * Layer Interface\n */\n\n onAdd: function(map){\n return EsriLeaflet.Layers.FeatureGrid.prototype.onAdd.call(this, map);\n },\n\n onRemove: function(map){\n return EsriLeaflet.Layers.FeatureGrid.prototype.onRemove.call(this, map);\n },\n\n getAttribution: function () {\n return this.options.attribution;\n },\n\n /**\n * Feature Managment\n */\n\n createCell: function(bounds, coords){\n this._requestFeatures(bounds, coords);\n },\n\n _requestFeatures: function(bounds, coords, callback){\n this._activeRequests++;\n\n // our first active request fires loading\n if(this._activeRequests === 1){\n this.fire('loading', {\n bounds: bounds\n });\n }\n\n return this._buildQuery(bounds).run(function(error, featureCollection, response){\n if(response && response.exceededTransferLimit){\n this.fire('drawlimitexceeded');\n }\n\n //deincriment the request counter\n this._activeRequests--;\n\n if(!error && featureCollection.features.length){\n this._addFeatures(featureCollection.features, coords);\n }\n\n if(callback){\n callback.call(this, error, featureCollection);\n }\n\n // if there are no more active requests fire a load event for this view\n if(this._activeRequests <= 0){\n this.fire('load', {\n bounds: bounds\n });\n }\n }, this);\n },\n\n _addFeatures: function(features){\n for (var i = features.length - 1; i >= 0; i--) {\n var id = features[i].id;\n this._currentSnapshot.push(id);\n }\n\n if(this.options.timeField){\n this._buildTimeIndexes(features);\n }\n\n this.createLayers(features);\n },\n\n _buildQuery: function(bounds){\n var query = this._service.query().intersects(bounds).where(this.options.where).fields(this.options.fields).precision(this.options.precision);\n\n if(this.options.simplifyFactor){\n query.simplify(this._map, this.options.simplifyFactor);\n }\n\n if(this.options.timeFilterMode === 'server' && this.options.from && this.options.to){\n query.between(this.options.from, this.options.to);\n }\n\n return query;\n },\n\n /**\n * Where Methods\n */\n\n setWhere: function(where, callback, context){\n\n this.options.where = (where && where.length) ? where : '1=1';\n\n var oldSnapshot = [];\n var newShapshot = [];\n var pendingRequests = 0;\n var requestError = null;\n var requestCallback = L.Util.bind(function(error, featureCollection){\n if(error){\n requestError = error;\n }\n\n if(featureCollection){\n for (var i = featureCollection.features.length - 1; i >= 0; i--) {\n newShapshot.push(featureCollection.features[i].id);\n }\n }\n\n pendingRequests--;\n\n if(pendingRequests <= 0){\n this._currentSnapshot = newShapshot;\n this.removeLayers(oldSnapshot);\n this.addLayers(newShapshot);\n if(callback) {\n callback.call(context, requestError);\n }\n }\n }, this);\n\n for (var i = this._currentSnapshot.length - 1; i >= 0; i--) {\n oldSnapshot.push(this._currentSnapshot[i]);\n }\n\n for(var key in this._activeCells){\n pendingRequests++;\n var coords = this._keyToCellCoords(key);\n var bounds = this._cellCoordsToBounds(coords);\n this._requestFeatures(bounds, key, requestCallback);\n }\n\n return this;\n },\n\n getWhere: function(){\n return this.options.where;\n },\n\n /**\n * Time Range Methods\n */\n\n getTimeRange: function(){\n return [this.options.from, this.options.to];\n },\n\n setTimeRange: function(from, to, callback, context){\n var oldFrom = this.options.from;\n var oldTo = this.options.to;\n var pendingRequests = 0;\n var requestError = null;\n var requestCallback = L.Util.bind(function(error){\n if(error){\n requestError = error;\n }\n this._filterExistingFeatures(oldFrom, oldTo, from, to);\n\n pendingRequests--;\n\n if(callback && pendingRequests <= 0){\n callback.call(context, requestError);\n }\n }, this);\n\n this.options.from = from;\n this.options.to = to;\n\n this._filterExistingFeatures(oldFrom, oldTo, from, to);\n\n if(this.options.timeFilterMode === 'server') {\n for(var key in this._activeCells){\n pendingRequests++;\n var coords = this._keyToCellCoords(key);\n var bounds = this._cellCoordsToBounds(coords);\n this._requestFeatures(bounds, key, requestCallback);\n }\n }\n },\n\n refresh: function(){\n for(var key in this._activeCells){\n var coords = this._keyToCellCoords(key);\n var bounds = this._cellCoordsToBounds(coords);\n this._requestFeatures(bounds, key);\n }\n },\n\n _filterExistingFeatures: function (oldFrom, oldTo, newFrom, newTo) {\n var layersToRemove = (oldFrom && oldTo) ? this._getFeaturesInTimeRange(oldFrom, oldTo) : this._currentSnapshot;\n var layersToAdd = this._getFeaturesInTimeRange(newFrom, newTo);\n\n if(layersToAdd.indexOf){\n for (var i = 0; i < layersToAdd.length; i++) {\n var shouldRemoveLayer = layersToRemove.indexOf(layersToAdd[i]);\n if(shouldRemoveLayer >= 0){\n layersToRemove.splice(shouldRemoveLayer, 1);\n }\n }\n }\n\n this.removeLayers(layersToRemove);\n this.addLayers(layersToAdd);\n },\n\n _getFeaturesInTimeRange: function(start, end){\n var ids = [];\n var search;\n\n if(this.options.timeField.start && this.options.timeField.end){\n var startTimes = this._startTimeIndex.between(start, end);\n var endTimes = this._endTimeIndex.between(start, end);\n search = startTimes.concat(endTimes);\n } else {\n search = this._timeIndex.between(start, end);\n }\n\n for (var i = search.length - 1; i >= 0; i--) {\n ids.push(search[i].id);\n }\n\n return ids;\n },\n\n _buildTimeIndexes: function(geojson){\n var i;\n var feature;\n if(this.options.timeField.start && this.options.timeField.end){\n var startTimeEntries = [];\n var endTimeEntries = [];\n for (i = geojson.length - 1; i >= 0; i--) {\n feature = geojson[i];\n startTimeEntries.push( {\n id: feature.id,\n value: new Date(feature.properties[this.options.timeField.start])\n });\n endTimeEntries.push( {\n id: feature.id,\n value: new Date(feature.properties[this.options.timeField.end])\n });\n }\n this._startTimeIndex.bulkAdd(startTimeEntries);\n this._endTimeIndex.bulkAdd(endTimeEntries);\n } else {\n var timeEntries = [];\n for (i = geojson.length - 1; i >= 0; i--) {\n feature = geojson[i];\n timeEntries.push( {\n id: feature.id,\n value: new Date(feature.properties[this.options.timeField])\n });\n }\n\n this._timeIndex.bulkAdd(timeEntries);\n }\n },\n\n _featureWithinTimeRange: function(feature){\n if(!this.options.from || !this.options.to){\n return true;\n }\n\n var from = +this.options.from.valueOf();\n var to = +this.options.to.valueOf();\n\n if(typeof this.options.timeField === 'string'){\n var date = +feature.properties[this.options.timeField];\n return (date >= from) && (date <= to);\n }\n\n if(this.options.timeField.start && this.options.timeField.end){\n var startDate = +feature.properties[this.options.timeField.start];\n var endDate = +feature.properties[this.options.timeField.end];\n return ((startDate >= from) && (startDate <= to)) || ((endDate >= from) && (endDate <= to));\n }\n },\n\n /**\n * Service Methods\n */\n\n authenticate: function(token){\n this._service.authenticate(token);\n return this;\n },\n\n metadata: function(callback, context){\n this._service.metadata(callback, context);\n return this;\n },\n\n query: function(){\n return this._service.query();\n },\n\n addFeature: function(feature, callback, context){\n this._service.addFeature(feature, function(error, response){\n if(!error){\n this.refresh();\n }\n if(callback){\n callback.call(context, error, response);\n }\n }, this);\n return this;\n },\n\n updateFeature: function(feature, callback, context){\n return this._service.updateFeature(feature, function(error, response){\n if(!error){\n this.refresh();\n }\n if(callback){\n callback.call(context, error, response);\n }\n }, this);\n },\n\n deleteFeature: function(id, callback, context){\n return this._service.deleteFeature(id, function(error, response){\n if(!error && response.objectId){\n this.removeLayers([response.objectId], true);\n }\n if(callback){\n callback.call(context, error, response);\n }\n }, this);\n }\n });\n\n /**\n * Temporal Binary Search Index\n */\n\n function BinarySearchIndex(values) {\n this.values = values || [];\n }\n\n BinarySearchIndex.prototype._query = function(query){\n var minIndex = 0;\n var maxIndex = this.values.length - 1;\n var currentIndex;\n var currentElement;\n var resultIndex;\n\n while (minIndex <= maxIndex) {\n resultIndex = currentIndex = (minIndex + maxIndex) / 2 | 0;\n currentElement = this.values[Math.round(currentIndex)];\n if (+currentElement.value < +query) {\n minIndex = currentIndex + 1;\n } else if (+currentElement.value > +query) {\n maxIndex = currentIndex - 1;\n } else {\n return currentIndex;\n }\n }\n\n return ~maxIndex;\n };\n\n BinarySearchIndex.prototype.sort = function(){\n this.values.sort(function(a, b) {\n return +b.value - +a.value;\n }).reverse();\n this.dirty = false;\n };\n\n BinarySearchIndex.prototype.between = function(start, end){\n if(this.dirty){\n this.sort();\n }\n\n var startIndex = this._query(start);\n var endIndex = this._query(end);\n\n if(startIndex === 0 && endIndex === 0){\n return [];\n }\n\n startIndex = Math.abs(startIndex);\n endIndex = (endIndex < 0) ? Math.abs(endIndex): endIndex + 1;\n\n return this.values.slice(startIndex, endIndex);\n };\n\n BinarySearchIndex.prototype.bulkAdd = function(items){\n this.dirty = true;\n this.values = this.values.concat(items);\n };\n\n})(EsriLeaflet);","EsriLeaflet.Layers.FeatureLayer = EsriLeaflet.Layers.FeatureManager.extend({\n\n statics: {\n EVENTS: 'click dblclick mouseover mouseout mousemove contextmenu popupopen popupclose'\n },\n\n /**\n * Constructor\n */\n\n initialize: function (url, options) {\n EsriLeaflet.Layers.FeatureManager.prototype.initialize.call(this, url, options);\n\n options = L.setOptions(this, options);\n\n this._layers = {};\n this._leafletIds = {};\n this._key = 'c'+(Math.random() * 1e9).toString(36).replace('.', '_');\n },\n\n /**\n * Layer Interface\n */\n\n onAdd: function(map){\n return EsriLeaflet.Layers.FeatureManager.prototype.onAdd.call(this, map);\n },\n\n onRemove: function(map){\n\n for (var i in this._layers) {\n map.removeLayer(this._layers[i]);\n }\n\n return EsriLeaflet.Layers.FeatureManager.prototype.onRemove.call(this, map);\n },\n\n createNewLayer: function(geojson){\n // @TODO Leaflet 0.8\n //newLayer = L.GeoJSON.geometryToLayer(geojson, this.options);\n return L.GeoJSON.geometryToLayer(geojson, this.options.pointToLayer, L.GeoJSON.coordsToLatLng, this.options);\n },\n\n /**\n * Feature Managment Methods\n */\n\n createLayers: function(features){\n for (var i = features.length - 1; i >= 0; i--) {\n\n var geojson = features[i];\n\n var layer = this._layers[geojson.id];\n var newLayer;\n\n if(layer && !this._map.hasLayer(layer)){\n this._map.addLayer(layer);\n }\n\n if (layer && layer.setLatLngs) {\n // @TODO Leaflet 0.8\n //newLayer = L.GeoJSON.geometryToLayer(geojson, this.options);\n\n var updateGeo = this.createNewLayer(geojson);\n layer.setLatLngs(updateGeo.getLatLngs());\n }\n\n if(!layer){\n // @TODO Leaflet 0.8\n //newLayer = L.GeoJSON.geometryToLayer(geojson, this.options);\n\n newLayer = this.createNewLayer(geojson);\n newLayer.feature = geojson;\n newLayer.defaultOptions = newLayer.options;\n newLayer._leaflet_id = this._key + '_' + geojson.id;\n\n this._leafletIds[newLayer._leaflet_id] = geojson.id;\n\n // bubble events from layers to this\n // @TODO Leaflet 0.8\n // newLayer.addEventParent(this);\n\n newLayer.on(EsriLeaflet.Layers.FeatureLayer.EVENTS, this._propagateEvent, this);\n\n // bind a popup if we have one\n if(this._popup && newLayer.bindPopup){\n newLayer.bindPopup(this._popup(newLayer.feature, newLayer), this._popupOptions);\n }\n\n if(this.options.onEachFeature){\n this.options.onEachFeature(newLayer.feature, newLayer);\n }\n\n // cache the layer\n this._layers[newLayer.feature.id] = newLayer;\n\n // style the layer\n this.resetStyle(newLayer.feature.id);\n\n this.fire('createfeature', {\n feature: newLayer.feature\n });\n\n // add the layer if it is within the time bounds or our layer is not time enabled\n if(!this.options.timeField || (this.options.timeField && this._featureWithinTimeRange(geojson)) ){\n this._map.addLayer(newLayer);\n }\n }\n }\n },\n\n addLayers: function(ids){\n for (var i = ids.length - 1; i >= 0; i--) {\n var layer = this._layers[ids[i]];\n if(layer){\n this.fire('addfeature', {\n feature: layer.feature\n });\n this._map.addLayer(layer);\n }\n }\n },\n\n removeLayers: function(ids, permanent){\n for (var i = ids.length - 1; i >= 0; i--) {\n var id = ids[i];\n var layer = this._layers[id];\n if(layer){\n this.fire('removefeature', {\n feature: layer.feature,\n permanent: permanent\n });\n this._map.removeLayer(layer);\n }\n if(layer && permanent){\n delete this._layers[id];\n }\n }\n },\n\n /**\n * Styling Methods\n */\n\n resetStyle: function (id) {\n var layer = this._layers[id];\n\n if(layer){\n layer.options = layer.defaultOptions;\n this.setFeatureStyle(layer.feature.id, this.options.style);\n }\n\n return this;\n },\n\n setStyle: function (style) {\n this.options.style = style;\n this.eachFeature(function (layer) {\n this.setFeatureStyle(layer.feature.id, style);\n }, this);\n return this;\n },\n\n setFeatureStyle: function (id, style) {\n var layer = this._layers[id];\n\n if (typeof style === 'function') {\n style = style(layer.feature);\n }\n if (layer.setStyle) {\n layer.setStyle(style);\n }\n },\n\n /**\n * Popup Methods\n */\n\n bindPopup: function (fn, options) {\n this._popup = fn;\n this._popupOptions = options;\n for (var i in this._layers) {\n var layer = this._layers[i];\n var popupContent = this._popup(layer.feature, layer);\n layer.bindPopup(popupContent, options);\n }\n return this;\n },\n\n unbindPopup: function () {\n this._popup = false;\n for (var i in this._layers) {\n var layer = this._layers[i];\n if (layer.unbindPopup) {\n layer.unbindPopup();\n } else if (layer.getLayers) {\n var groupLayers = layer.getLayers();\n for (var j in groupLayers) {\n var gLayer = groupLayers[j];\n gLayer.unbindPopup();\n }\n }\n }\n return this;\n },\n\n /**\n * Utility Methods\n */\n\n eachFeature: function (fn, context) {\n for (var i in this._layers) {\n fn.call(context, this._layers[i]);\n }\n return this;\n },\n\n getFeature: function (id) {\n return this._layers[id];\n },\n\n // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js\n // @TODO remove at Leaflet 0.8\n _propagateEvent: function (e) {\n e.layer = this._layers[this._leafletIds[e.target._leaflet_id]];\n e.target = this;\n this.fire(e.type, e);\n }\n});\n\nEsriLeaflet.FeatureLayer = EsriLeaflet.Layers.FeatureLayer;\n\nEsriLeaflet.Layers.featureLayer = function(url, options){\n return new EsriLeaflet.Layers.FeatureLayer(url, options);\n};\n\nEsriLeaflet.featureLayer = function(url, options){\n return new EsriLeaflet.Layers.FeatureLayer(url, options);\n};\n","EsriLeaflet.Controls.Logo = L.Control.extend({\n options: {\n position: 'bottomright',\n marginTop: 0,\n marginLeft: 0,\n marginBottom: 0,\n marginRight: 0\n },\n onAdd: function () {\n var div = L.DomUtil.create('div', 'esri-leaflet-logo');\n div.style.marginTop = this.options.marginTop;\n div.style.marginLeft = this.options.marginLeft;\n div.style.marginBottom = this.options.marginBottom;\n div.style.marginRight = this.options.marginRight;\n div.innerHTML = '';\n return div;\n }\n});\n\nEsriLeaflet.Controls.logo = function(options){\n return new L.esri.Controls.Logo(options);\n};\n"]} \ No newline at end of file diff --git a/dist/esri-leaflet.js b/dist/esri-leaflet.js new file mode 100644 index 000000000..8c85b2ea2 --- /dev/null +++ b/dist/esri-leaflet.js @@ -0,0 +1,25 @@ +/*! esri-leaflet - v1.0.0-rc.3 - 2014-11-04 +* Copyright (c) 2014 Environmental Systems Research Institute, Inc. +* Apache License*/ +(function (factory) { + //define an AMD module that relies on 'leaflet' + if (typeof define === 'function' && define.amd) { + define(['leaflet'], function (L) { + return factory(L); + }); + //define a common js module that relies on 'leaflet' + } else if (typeof module === 'object' && typeof module.exports === 'object') { + module.exports = factory(require('leaflet')); + } + + if(typeof window !== 'undefined' && window.L){ + factory(window.L); + } +}(function (L) { + +var EsriLeaflet={VERSION:"1.0.0-rc.2",Layers:{},Services:{},Controls:{},Tasks:{},Util:{},Support:{CORS:!!(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),pointerEvents:""===document.documentElement.style.pointerEvents}};"undefined"!=typeof window&&window.L&&(window.L.esri=EsriLeaflet),function(a){function b(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function c(a,b){for(var c=0;cd;d++)b=a[d+1],c+=(b[0]-f[0])*(b[1]+f[1]),f=b;return c>=0}function f(a,b,c,d){var e=(d[0]-c[0])*(a[1]-c[1])-(d[1]-c[1])*(a[0]-c[0]),f=(b[0]-a[0])*(a[1]-c[1])-(b[1]-a[1])*(a[0]-c[0]),g=(d[1]-c[1])*(b[0]-a[0])-(d[0]-c[0])*(b[1]-a[1]);if(0!==g){var h=e/g,i=f/g;if(h>=0&&1>=h&&i>=0&&1>=i)return!0}return!1}function g(a,b){for(var c=0;c=0;b--)if(c=h[b][0],i(c,f)){h[b].push(f),o=!0;break}o||n.push(f)}for(;n.length;){f=n.pop();var p=!1;for(b=h.length-1;b>=0;b--)if(c=h[b][0],g(c,f)){h[b].push(f),p=!0;break}p||h.push([f.reverse()])}return 1===h.length?{type:"Polygon",coordinates:h[0]}:{type:"MultiPolygon",coordinates:h}}function k(a){var b=[],c=a.slice(0),f=d(c.shift().slice(0));if(f.length>=4){e(f)||f.reverse(),b.push(f);for(var g=0;g=4&&(e(h)&&h.reverse(),b.push(h))}}return b}function l(a){for(var b=[],c=0;c=0;e--){var f=d[e].slice(0);b.push(f)}return b}a.Util.extentToBounds=function(a){var b=new L.LatLng(a.ymin,a.xmin),c=new L.LatLng(a.ymax,a.xmax);return new L.LatLngBounds(b,c)},a.Util.boundsToExtent=function(a){return a=L.latLngBounds(a),{xmin:a.getSouthWest().lng,ymin:a.getSouthWest().lat,xmax:a.getNorthEast().lng,ymax:a.getNorthEast().lat,spatialReference:{wkid:4326}}},a.Util.arcgisToGeojson=function(c,d){var e={};return"number"==typeof c.x&&"number"==typeof c.y&&(e.type="Point",e.coordinates=[c.x,c.y]),c.points&&(e.type="MultiPoint",e.coordinates=c.points.slice(0)),c.paths&&(1===c.paths.length?(e.type="LineString",e.coordinates=c.paths[0].slice(0)):(e.type="MultiLineString",e.coordinates=c.paths.slice(0))),c.rings&&(e=j(c.rings.slice(0))),(c.geometry||c.attributes)&&(e.type="Feature",e.geometry=c.geometry?a.Util.arcgisToGeojson(c.geometry):null,e.properties=c.attributes?b(c.attributes):null,c.attributes&&(e.id=c.attributes[d]||c.attributes.OBJECTID||c.attributes.FID)),e},a.Util.geojsonToArcGIS=function(c,d){d=d||"OBJECTID";var e,f={wkid:4326},g={};switch(c.type){case"Point":g.x=c.coordinates[0],g.y=c.coordinates[1],g.spatialReference=f;break;case"MultiPoint":g.points=c.coordinates.slice(0),g.spatialReference=f;break;case"LineString":g.paths=[c.coordinates.slice(0)],g.spatialReference=f;break;case"MultiLineString":g.paths=c.coordinates.slice(0),g.spatialReference=f;break;case"Polygon":g.rings=k(c.coordinates.slice(0)),g.spatialReference=f;break;case"MultiPolygon":g.rings=l(c.coordinates.slice(0)),g.spatialReference=f;break;case"Feature":c.geometry&&(g.geometry=a.Util.geojsonToArcGIS(c.geometry,d)),g.attributes=c.properties?b(c.properties):{},c.id&&(g.attributes[d]=c.id);break;case"FeatureCollection":for(g=[],e=0;e=0;h--)f.features.push(a.Util.arcgisToGeojson(g[h],d));return f},a.Util.cleanUrl=function(a){return a=a.replace(/\s\s*/g,""),"/"!==a[a.length-1]&&(a+="/"),a},a.Util.geojsonTypeToArcGIS=function(a){var b;switch(a){case"Point":b="esriGeometryPoint";break;case"MultiPoint":b="esriGeometryMultipoint";break;case"LineString":b="esriGeometryPolyline";break;case"MultiLineString":b="esriGeometryPolyline";break;case"Polygon":b="esriGeometryPolygon";break;case"MultiPolygon":b="esriGeometryPolygon"}return b}}(EsriLeaflet),function(a){function b(a){var b="";a.f="json";for(var c in a)if(a.hasOwnProperty(c)){var d,e=a[c],f=Object.prototype.toString.call(e);b.length&&(b+="&"),d="[object Array]"===f||"[object Object]"===f?JSON.stringify(e):"[object Date]"===f?e.valueOf():e,b+=encodeURIComponent(c)+"="+encodeURIComponent(d)}return b}function c(a,b){var c=new XMLHttpRequest;return c.onerror=function(){a.call(b,{error:{code:500,message:"XMLHttpRequest error"}},null)},c.onreadystatechange=function(){var d,e;if(4===c.readyState){try{d=JSON.parse(c.responseText)}catch(f){d=null,e={code:500,message:"Could not parse response as JSON."}}!e&&d.error&&(e=d.error,d=null),a.call(b,e,d)}},c}var d=0;window._EsriLeafletCallbacks={},a.Request={request:function(a,d,e,f){var g=b(d),h=c(e,f),i=(a+"?"+g).length;if(2e3>=i&&L.esri.Support.CORS)h.open("GET",a+"?"+g),h.send(null);else if(i>2e3&&L.esri.Support.CORS)h.open("POST",a),h.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),h.send(g);else{if(2e3>=i&&!L.esri.Support.CORS)return L.esri.Request.get.JSONP(a,d,e,f);if(console&&console.warn)return void console.warn("a request to "+a+" 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")}return h},post:{XMLHTTP:function(a,d,e,f){var g=c(e,f);return g.open("POST",a),g.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),g.send(b(d)),g}},get:{CORS:function(a,d,e,f){var g=c(e,f);return g.open("GET",a+"?"+b(d),!0),g.send(null),g},JSONP:function(a,c,e,f){var g="c"+d;c.callback="window._EsriLeafletCallbacks."+g;var h=L.DomUtil.create("script",null,document.body);return h.type="text/javascript",h.src=a+"?"+b(c),h.id=g,window._EsriLeafletCallbacks[g]=function(a){if(window._EsriLeafletCallbacks[g]!==!0){var b,c=Object.prototype.toString.call(a);"[object Object]"!==c&&"[object Array]"!==c&&(b={error:{code:500,message:"Expected array or object as JSONP response"}},a=null),!b&&a.error&&(b=a,a=null),e.call(f,b,a),window._EsriLeafletCallbacks[g]=!0}},d++,{id:g,url:h.src,abort:function(){window._EsriLeafletCallbacks._callback[g]({code:0,message:"Request aborted."})}}}}},a.get=a.Support.CORS?a.Request.get.CORS:a.Request.get.JSONP,a.post=a.Request.post.XMLHTTP,a.request=a.Request.request}(EsriLeaflet),EsriLeaflet.Services.Service=L.Class.extend({includes:L.Mixin.Events,options:{proxy:!1,useCors:EsriLeaflet.Support.CORS},initialize:function(a,b){this.url=EsriLeaflet.Util.cleanUrl(a),this._requestQueue=[],this._authenticating=!1,L.Util.setOptions(this,b)},get:function(a,b,c,d){return this._request("get",a,b,c,d)},post:function(a,b,c,d){return this._request("post",a,b,c,d)},request:function(a,b,c,d){return this._request("request",a,b,c,d)},metadata:function(a,b){return this._request("get","",{},a,b)},authenticate:function(a){return this._authenticating=!1,this.options.token=a,this._runQueue(),this},_request:function(a,b,c,d,e){this.fire("requeststart",{url:this.url+b,params:c,method:a});var f=this._createServiceCallback(a,b,c,d,e);if(this.options.token&&(c.token=this.options.token),this._authenticating)return void this._requestQueue.push([a,b,c,d,e]);var g=this.options.proxy?this.options.proxy+"?"+this.url+b:this.url+b;return"get"!==a&&"request"!==a||this.options.useCors?EsriLeaflet[a](g,c,f):EsriLeaflet.Request.get.JSONP(g,c,f)},_createServiceCallback:function(a,b,c,d,e){var f=[a,b,c,d,e];return L.Util.bind(function(g,h){!g||499!==g.code&&498!==g.code?(d.call(e,g,h),g?this.fire("requesterror",{url:this.url+b,params:c,message:g.message,code:g.code,method:a}):this.fire("requestsuccess",{url:this.url+b,params:c,response:h,method:a}),this.fire("requestend",{url:this.url+b,params:c,method:a})):(this._authenticating=!0,this._requestQueue.push(f),this.fire("authenticationrequired",{authenticate:L.Util.bind(this.authenticate,this)}))},this)},_runQueue:function(){for(var a=this._requestQueue.length-1;a>=0;a--){var b=this._requestQueue[a],c=b.shift();this[c].apply(this,b)}this._requestQueue=[]}}),EsriLeaflet.Services.service=function(a,b){return new EsriLeaflet.Services.Service(a,b)},EsriLeaflet.Services.FeatureLayer=EsriLeaflet.Services.Service.extend({options:{idAttribute:"OBJECTID"},query:function(){return new EsriLeaflet.Tasks.Query(this)},addFeature:function(a,b,c){return delete a.id,a=EsriLeaflet.Util.geojsonToArcGIS(a),this.post("addFeatures",{features:[a]},function(a,c){var d=c&&c.addResults?c.addResults[0]:void 0;b&&b.call(this,a||c.addResults[0].error,d)},c)},updateFeature:function(a,b,c){return a=EsriLeaflet.Util.geojsonToArcGIS(a,this.options.idAttribute),this.post("updateFeatures",{features:[a]},function(a,d){var e=d&&d.updateResults?d.updateResults[0]:void 0;b&&b.call(c,a||d.updateResults[0].error,e)},c)},deleteFeature:function(a,b,c){return this.post("deleteFeatures",{objectIds:a},function(a,d){var e=d&&d.deleteResults?d.deleteResults[0]:void 0;b&&b.call(c,a||d.deleteResults[0].error,e)},c)}}),EsriLeaflet.Services.featureLayer=function(a,b){return new EsriLeaflet.Services.FeatureLayer(a,b)},EsriLeaflet.Services.MapService=EsriLeaflet.Services.Service.extend({identify:function(){return new EsriLeaflet.Tasks.identifyFeatures(this)},find:function(){return new EsriLeaflet.Tasks.Find(this)},query:function(){return new EsriLeaflet.Tasks.Query(this)}}),EsriLeaflet.Services.mapService=function(a,b){return new EsriLeaflet.Services.MapService(a,b)},EsriLeaflet.Services.ImageService=EsriLeaflet.Services.Service.extend({query:function(){return new EsriLeaflet.Tasks.Query(this)},identify:function(){return new EsriLeaflet.Tasks.IdentifyImage(this)}}),EsriLeaflet.Services.imageService=function(a,b){return new EsriLeaflet.Services.ImageService(a,b)},EsriLeaflet.Tasks.Task=L.Class.extend({options:{proxy:!1,useCors:EsriLeaflet.Support.CORS},generateSetter:function(a,b){var c=a.match(/([a-zA-Z]+)\[\]/);return a=c?c[1]:a,c?L.Util.bind(function(b){return this.params[a]=L.Util.isArray(b)?b.join(","):b,this},b):L.Util.bind(function(b){return this.params[a]=b,this},b)},initialize:function(a,b){if(a.url&&a.request?(this._service=a,this.url=a.url):this.url=EsriLeaflet.Util.cleanUrl(a),this.params=L.Util.extend({},this.params||{}),this.setters)for(var c in this.setters){var d=this.setters[c];this[c]=this.generateSetter(d,this)}L.Util.setOptions(this,b)},token:function(a){return this._service?this._service.authenticate(a):this.params.token=a,this},request:function(a,b){return this._service?this._service.request(this.path,this.params,a,b):this._request("request",this.path,this.params,a,b)},_request:function(a,b,c,d,e){var f=this.options.proxy?this.options.proxy+"?"+this.url+b:this.url+b;return"get"!==a&&"request"!==a||this.options.useCors?EsriLeaflet[a](f,c,d,e):EsriLeaflet.Request.get.JSONP(f,c,d,e)}}),EsriLeaflet.Tasks.Query=EsriLeaflet.Tasks.Task.extend({setters:{offset:"offset",limit:"limit",outFields:"fields[]",precision:"geometryPrecision",featureIds:"objectIds[]",returnGeometry:"returnGeometry",token:"token"},path:"query",params:{returnGeometry:!0,where:"1=1",outSr:4326,outFields:"*"},within:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelContains",this},intersects:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelIntersects",this},contains:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelWithin",this},overlaps:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelOverlaps",this},nearby:function(a,b){return a=L.latLng(a),this.params.geometry=[a.lng,a.lat].join(","),this.params.geometryType="esriGeometryPoint",this.params.spatialRel="esriSpatialRelIntersects",this.params.units="esriSRUnit_Meter",this.params.distance=b,this.params.inSr=4326,this},where:function(a){return this.params.where=a.replace(/"/g,"'"),this},between:function(a,b){return this.params.time=[a.valueOf(),b.valueOf()].join(),this},fields:function(a){return this.params.outFields=L.Util.isArray(a)?a.join(","):a,this},simplify:function(a,b){var c=Math.abs(a.getBounds().getWest()-a.getBounds().getEast());return this.params.maxAllowableOffset=c/a.getSize().y*b,this},orderBy:function(a,b){return b=b||"ASC",this.params.orderByFields=this.params.orderByFields?this.params.orderByFields+",":"",this.params.orderByFields+=[a,b].join(" "),this},returnGeometry:function(a){return this.params.returnGeometry=a,this},run:function(a,b){return this._cleanParams(),this.request(function(c,d){a.call(b,c,d&&EsriLeaflet.Util.responseToFeatureCollection(d),d)},b)},count:function(a,b){return this._cleanParams(),this.params.returnCountOnly=!0,this.request(function(b,c){a.call(this,b,c&&c.count,c)},b)},ids:function(a,b){return this._cleanParams(),this.params.returnIdsOnly=!0,this.request(function(b,c){a.call(this,b,c&&c.objectIds,c)},b)},bounds:function(a,b){return this._cleanParams(),this.params.returnExtentOnly=!0,this.request(function(c,d){a.call(b,c,d&&d.extent&&EsriLeaflet.Util.extentToBounds(d.extent),d)},b)},pixelSize:function(a){return a=L.point(a),this.params.pixelSize=[a.x,a.y].join(","),this},layer:function(a){return this.path=a+"/query",this},_cleanParams:function(){delete this.params.returnIdsOnly,delete this.params.returnExtentOnly,delete this.params.returnCountOnly},_setGeometry:function(a){return this.params.inSr=4326,a instanceof L.LatLngBounds?(this.params.geometry=EsriLeaflet.Util.boundsToExtent(a),void(this.params.geometryType="esriGeometryEnvelope")):(a.getLatLng&&(a=a.getLatLng()),a instanceof L.LatLng&&(a={type:"Point",coordinates:[a.lng,a.lat]}),a instanceof L.GeoJSON&&(a=a.getLayers()[0].feature.geometry,this.params.geometry=EsriLeaflet.Util.geojsonToArcGIS(a),this.params.geometryType=EsriLeaflet.Util.geojsonTypeToArcGIS(a.type)),a.toGeoJSON&&(a=a.toGeoJSON()),"Feature"===a.type&&(a=a.geometry),"Point"===a.type||"LineString"===a.type||"Polygon"===a.type?(this.params.geometry=EsriLeaflet.Util.geojsonToArcGIS(a),void(this.params.geometryType=EsriLeaflet.Util.geojsonTypeToArcGIS(a.type))):void(console&&console.warn&&console.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")))}}),EsriLeaflet.Tasks.query=function(a,b){return new EsriLeaflet.Tasks.Query(a,b)},EsriLeaflet.Tasks.Find=EsriLeaflet.Tasks.Task.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(a,b){return this.params.layerDefs=this.params.layerDefs?this.params.layerDefs+";":"",this.params.layerDefs+=[a,b].join(":"),this},simplify:function(a,b){var c=Math.abs(a.getBounds().getWest()-a.getBounds().getEast());return this.params.maxAllowableOffset=c/a.getSize().y*b,this},run:function(a,b){return this.request(function(c,d){a.call(b,c,d&&EsriLeaflet.Util.responseToFeatureCollection(d),d)},b)}}),EsriLeaflet.Tasks.find=function(a,b){return new EsriLeaflet.Tasks.Find(a,b)},EsriLeaflet.Tasks.Identify=EsriLeaflet.Tasks.Task.extend({path:"identify",between:function(a,b){return this.params.time=[a.valueOf(),b.valueOf()].join(","),this},returnGeometry:function(a){return this.params.returnGeometry=a,this}}),EsriLeaflet.Tasks.IdentifyImage=EsriLeaflet.Tasks.Identify.extend({setters:{setMosaicRule:"mosaicRule",setRenderingRule:"renderingRule",returnCatalogItems:"returnCatalogItems"},params:{returnGeometry:!1},at:function(a){return a=L.latLng(a),this.params.geometry=JSON.stringify({x:a.lng,y:a.lat,spatialReference:{wkid:4326}}),this.params.geometryType="esriGeometryPoint",this},getMosaicRule:function(){return this.params.mosaicRule},getRenderingRule:function(){return this.params.renderingRule},setPixelSize:function(a){return this.params.pixelSize=a.join?a.join(","):a,this},getPixelSize:function(){return this.params.pixelSize},run:function(a,b){return this.request(function(c,d){a.call(b,c,d&&this._responseToGeoJSON(d),d)},this)},_responseToGeoJSON:function(a){var b=a.location,c=a.catalogItems,d=a.catalogItemVisibilities,e={pixel:{type:"Feature",geometry:{type:"Point",coordinates:[b.x,b.y]},crs:{type:"EPSG",properties:{code:b.spatialReference.wkid}},properties:{OBJECTID:a.objectId,name:a.name,value:a.value},id:a.objectId}};if(a.properties&&a.properties.Values&&(e.pixel.properties.values=a.properties.Values),c&&c.features&&(e.catalogItems=EsriLeaflet.Util.responseToFeatureCollection(c),d&&d.length===e.catalogItems.features.length))for(var f=d.length-1;f>=0;f--)e.catalogItems.features[f].properties.catalogItemVisibility=d[f];return e}}),EsriLeaflet.Tasks.identifyImage=function(a,b){return new EsriLeaflet.Tasks.IdentifyImage(a,b)},EsriLeaflet.Tasks.IdentifyFeatures=EsriLeaflet.Tasks.Identify.extend({setters:{layers:"layers",precision:"geometryPrecision",tolerance:"tolerance"},params:{sr:4326,layers:"all",tolerance:3,returnGeometry:!0},on:function(a){var b=EsriLeaflet.Util.boundsToExtent(a.getBounds()),c=a.getSize();return this.params.imageDisplay=[c.x,c.y,96].join(","),this.params.mapExtent=[b.xmin,b.ymin,b.xmax,b.ymax].join(","),this},at:function(a){return a=L.latLng(a),this.params.geometry=[a.lng,a.lat].join(","),this.params.geometryType="esriGeometryPoint",this},layerDef:function(a,b){return this.params.layerDefs=this.params.layerDefs?this.params.layerDefs+";":"",this.params.layerDefs+=[a,b].join(":"),this},simplify:function(a,b){var c=Math.abs(a.getBounds().getWest()-a.getBounds().getEast());return this.params.maxAllowableOffset=c/a.getSize().y*(1-b),this},run:function(a,b){return this.request(function(c,d){a.call(b,c,d&&EsriLeaflet.Util.responseToFeatureCollection(d),d)},b)}}),EsriLeaflet.Tasks.identifyFeatures=function(a,b){return new EsriLeaflet.Tasks.IdentifyFeatures(a,b)},function(a){var b="https:"!==window.location.protocol?"http:":"https:";a.Layers.BasemapLayer=L.TileLayer.extend({statics:{TILES:{Streets:{urlTemplate:b+"//{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:b+"//{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:b+"//{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:b+"//{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"]}},NationalGeographic:{urlTemplate:b+"//{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:"Esri"}},DarkGray:{urlTemplate:b+"//tiles{s}.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Dark_Gray_Base_Beta/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:10,subdomains:["1","2"],attribution:"Esri, DeLorme, HERE"}},DarkGrayLabels:{urlTemplate:b+"//tiles{s}.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Dark_Gray_Reference_Beta/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:10,subdomains:["1","2"]}},Gray:{urlTemplate:b+"//{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, NAVTEQ, DeLorme"}},GrayLabels:{urlTemplate:b+"//{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"]}},Imagery:{urlTemplate:b+"//{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:b+"//{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"]}},ImageryTransportation:{urlTemplate:b+"//{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"]}},ShadedRelief:{urlTemplate:b+"//{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, NAVTEQ, DeLorme"}},ShadedReliefLabels:{urlTemplate:b+"//{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"]}},Terrain:{urlTemplate:b+"//{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:b+"//{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"]}}}},initialize:function(b,c){var d;if("object"==typeof b&&b.urlTemplate&&b.options)d=b;else{if("string"!=typeof b||!a.BasemapLayer.TILES[b])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"');d=a.BasemapLayer.TILES[b]}var e=L.Util.extend(d.options,c);L.TileLayer.prototype.initialize.call(this,d.urlTemplate,L.Util.setOptions(this,e)),d.attributionUrl&&this._getAttributionData(d.attributionUrl)},onAdd:function(b){this.options.hideLogo||(this._logo=new a.Controls.Logo({position:this.options.logoPosition}).addTo(b)),L.TileLayer.prototype.onAdd.call(this,b),b.on("moveend",this._updateMapAttribution,this)},onRemove:function(a){this._logo&&a.removeControl(this._logo),L.TileLayer.prototype.onRemove.call(this,a),a.off("moveend",this._updateMapAttribution,this)},getAttribution:function(){var a=''+this.options.attribution+"";return a},_getAttributionData:function(b){a.get(b,{},function(a,b){this._attributions=[];for(var c=0;c=e.minZoom&&c<=e.maxZoom&&(a+=", "+f)}a=a.substr(2);var g=this._map.attributionControl._container.querySelector(".esri-attributions");g.innerHTML=a,g.style.maxWidth=.65*this._map.getSize().x+"px",this.fire("attributionupdated",{attribution:a})}}}),a.BasemapLayer=a.Layers.BasemapLayer,a.Layers.basemapLayer=function(b,c){return new a.Layers.BasemapLayer(b,c)},a.basemapLayer=function(b,c){return new a.Layers.BasemapLayer(b,c)}}(EsriLeaflet),EsriLeaflet.Layers.RasterLayer=L.Class.extend({includes:L.Mixin.Events,options:{opacity:1,position:"front",f:"image"},onAdd:function(a){if(this._map=a,this._update=L.Util.limitExecByInterval(this._update,this.options.updateInterval,this),a.options.crs&&a.options.crs.code){var b=a.options.crs.code.split(":")[1];this.options.bboxSR=b,this.options.imageSR=b}a.on("moveend",this._update,this),this._update(),this._popup&&(this._map.on("click",this._getPopupData,this),this._map.on("dblclick",this._resetPopupState,this))},bindPopup:function(a,b){return this._shouldRenderPopup=!1,this._lastClick=!1,this._popup=L.popup(b),this._popupFunction=a,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},onRemove:function(){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),this._map=null},addTo:function(a){return a.addLayer(this),this},removeFrom:function(a){return a.removeLayer(this),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(a){return this.options.opacity=a,this._currentImage.setOpacity(a),this},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(a,b){return this.options.from=a,this.options.to=b,this._update(),this},metadata:function(a,b){return this._service.metadata(a,b),this},authenticate:function(a){return this._service.authenticate(a),this},_renderImage:function(a,b){if(this._map){var c=new L.ImageOverlay(a,b,{opacity:0}).addTo(this._map);c.once("load",function(a){var c=a.target,d=this._currentImage;c._bounds.equals(b)?(this._currentImage=c,"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),d&&this._map.removeLayer(d)):this._map.removeLayer(c),this.fire("load",{bounds:b})},this),this.fire("loading",{bounds:b})}},_update:function(){if(this._map){var a=this._map.getZoom(),b=this._map.getBounds();if(!this._animatingZoom&&!(this._map._panTransition&&this._map._panTransition._inProgress||a>this.options.maxZoom||athis.options.maxZoom||bc;c++)this._addCell(e[c])},_cellCoordsToBounds:function(a){var b=this._map,c=this.options.cellSize,d=a.multiplyBy(c),e=d.add([c,c]),f=b.unproject(d,a.z).wrap(),g=b.unproject(e,a.z).wrap();return new L.LatLngBounds(f,g)},_cellCoordsToKey:function(a){return a.x+":"+a.y},_keyToCellCoords:function(a){var b=a.split(":"),c=parseInt(b[0],10),d=parseInt(b[1],10);return new L.Point(c,d)},_removeOtherCells:function(a){for(var b in this._cells)a.contains(this._keyToCellCoords(b))||this._removeCell(b)},_removeCell:function(a){var b=this._activeCells[a];b&&(delete this._activeCells[a],this.cellLeave&&this.cellLeave(b.bounds,b.coords),this.fire("cellleave",{bounds:b.bounds,coords:b.coords}))},_removeCells:function(){for(var a in this._cells){var b=this._cells[a].bounds,c=this._cells[a].coords;this.cellLeave&&this.cellLeave(b,c),this.fire("cellleave",{bounds:b,coords:c})}},_addCell:function(a){this._wrapCoords(a);var b=this._cellCoordsToKey(a),c=this._cells[b];c&&!this._activeCells[b]&&(this.cellEnter&&this.cellEnter(c.bounds,a),this.fire("cellenter",{bounds:c.bounds,coords:a}),this._activeCells[b]=c),c||(c={coords:a,bounds:this._cellCoordsToBounds(a)},this._cells[b]=c,this._activeCells[b]=c,this.createCell&&this.createCell(c.bounds,a),this.fire("cellcreate",{bounds:c.bounds,coords:a}))},_wrapCoords:function(a){a.x=this._wrapLng?L.Util.wrapNum(a.x,this._wrapLng):a.x,a.y=this._wrapLat?L.Util.wrapNum(a.y,this._wrapLat):a.y}}),function(a){function b(a){this.values=a||[]}a.Layers.FeatureManager=a.Layers.FeatureGrid.extend({options:{where:"1=1",fields:["*"],from:!1,to:!1,timeField:!1,timeFilterMode:"server",simplifyFactor:0,precision:6},initialize:function(c,d){if(a.Layers.FeatureGrid.prototype.initialize.call(this,d),d=L.setOptions(this,d),this.url=a.Util.cleanUrl(c),this._service=new a.Services.FeatureLayer(this.url,d),"*"!==this.options.fields[0]){for(var e=!1,f=0;f=0;b--){var c=a[b].id;this._currentSnapshot.push(c)}this.options.timeField&&this._buildTimeIndexes(a),this.createLayers(a)},_buildQuery:function(a){var b=this._service.query().intersects(a).where(this.options.where).fields(this.options.fields).precision(this.options.precision);return this.options.simplifyFactor&&b.simplify(this._map,this.options.simplifyFactor),"server"===this.options.timeFilterMode&&this.options.from&&this.options.to&&b.between(this.options.from,this.options.to),b},setWhere:function(a,b,c){this.options.where=a&&a.length?a:"1=1";for(var d=[],e=[],f=0,g=null,h=L.Util.bind(function(a,h){if(a&&(g=a),h)for(var i=h.features.length-1;i>=0;i--)e.push(h.features[i].id);f--,0>=f&&(this._currentSnapshot=e,this.removeLayers(d),this.addLayers(e),b&&b.call(c,g))},this),i=this._currentSnapshot.length-1;i>=0;i--)d.push(this._currentSnapshot[i]);for(var j in this._activeCells){f++;var k=this._keyToCellCoords(j),l=this._cellCoordsToBounds(k);this._requestFeatures(l,j,h)}return this},getWhere:function(){return this.options.where},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(a,b,c,d){var e=this.options.from,f=this.options.to,g=0,h=null,i=L.Util.bind(function(i){i&&(h=i),this._filterExistingFeatures(e,f,a,b),g--,c&&0>=g&&c.call(d,h)},this);if(this.options.from=a,this.options.to=b,this._filterExistingFeatures(e,f,a,b),"server"===this.options.timeFilterMode)for(var j in this._activeCells){g++;var k=this._keyToCellCoords(j),l=this._cellCoordsToBounds(k);this._requestFeatures(l,j,i)}},refresh:function(){for(var a in this._activeCells){var b=this._keyToCellCoords(a),c=this._cellCoordsToBounds(b);this._requestFeatures(c,a)}},_filterExistingFeatures:function(a,b,c,d){var e=a&&b?this._getFeaturesInTimeRange(a,b):this._currentSnapshot,f=this._getFeaturesInTimeRange(c,d);if(f.indexOf)for(var g=0;g=0&&e.splice(h,1)}this.removeLayers(e),this.addLayers(f)},_getFeaturesInTimeRange:function(a,b){var c,d=[];if(this.options.timeField.start&&this.options.timeField.end){var e=this._startTimeIndex.between(a,b),f=this._endTimeIndex.between(a,b);c=e.concat(f)}else c=this._timeIndex.between(a,b);for(var g=c.length-1;g>=0;g--)d.push(c[g].id);return d},_buildTimeIndexes:function(a){var b,c;if(this.options.timeField.start&&this.options.timeField.end){var d=[],e=[];for(b=a.length-1;b>=0;b--)c=a[b],d.push({id:c.id,value:new Date(c.properties[this.options.timeField.start])}),e.push({id:c.id,value:new Date(c.properties[this.options.timeField.end])});this._startTimeIndex.bulkAdd(d),this._endTimeIndex.bulkAdd(e)}else{var f=[];for(b=a.length-1;b>=0;b--)c=a[b],f.push({id:c.id,value:new Date(c.properties[this.options.timeField])});this._timeIndex.bulkAdd(f)}},_featureWithinTimeRange:function(a){if(!this.options.from||!this.options.to)return!0;var b=+this.options.from.valueOf(),c=+this.options.to.valueOf();if("string"==typeof this.options.timeField){var d=+a.properties[this.options.timeField];return d>=b&&c>=d}if(this.options.timeField.start&&this.options.timeField.end){var e=+a.properties[this.options.timeField.start],f=+a.properties[this.options.timeField.end];return e>=b&&c>=e||f>=b&&c>=f}},authenticate:function(a){return this._service.authenticate(a),this},metadata:function(a,b){return this._service.metadata(a,b),this},query:function(){return this._service.query()},addFeature:function(a,b,c){return this._service.addFeature(a,function(a,d){a||this.refresh(),b&&b.call(c,a,d)},this),this},updateFeature:function(a,b,c){return this._service.updateFeature(a,function(a,d){a||this.refresh(),b&&b.call(c,a,d)},this)},deleteFeature:function(a,b,c){return this._service.deleteFeature(a,function(a,d){!a&&d.objectId&&this.removeLayers([d.objectId],!0),b&&b.call(c,a,d)},this)}}),b.prototype._query=function(a){for(var b,c,d,e=0,f=this.values.length-1;f>=e;)if(d=b=(e+f)/2|0,c=this.values[Math.round(b)],+c.value<+a)e=b+1;else{if(!(+c.value>+a))return b;f=b-1}return~f},b.prototype.sort=function(){this.values.sort(function(a,b){return+b.value-+a.value}).reverse(),this.dirty=!1},b.prototype.between=function(a,b){this.dirty&&this.sort();var c=this._query(a),d=this._query(b);return 0===c&&0===d?[]:(c=Math.abs(c),d=0>d?Math.abs(d):d+1,this.values.slice(c,d))},b.prototype.bulkAdd=function(a){this.dirty=!0,this.values=this.values.concat(a)}}(EsriLeaflet),EsriLeaflet.Layers.FeatureLayer=EsriLeaflet.Layers.FeatureManager.extend({statics:{EVENTS:"click dblclick mouseover mouseout mousemove contextmenu popupopen popupclose"},initialize:function(a,b){EsriLeaflet.Layers.FeatureManager.prototype.initialize.call(this,a,b),b=L.setOptions(this,b),this._layers={},this._leafletIds={},this._key="c"+(1e9*Math.random()).toString(36).replace(".","_")},onAdd:function(a){return EsriLeaflet.Layers.FeatureManager.prototype.onAdd.call(this,a)},onRemove:function(a){for(var b in this._layers)a.removeLayer(this._layers[b]);return EsriLeaflet.Layers.FeatureManager.prototype.onRemove.call(this,a)},createNewLayer:function(a){return L.GeoJSON.geometryToLayer(a,this.options.pointToLayer,L.GeoJSON.coordsToLatLng,this.options)},createLayers:function(a){for(var b=a.length-1;b>=0;b--){var c,d=a[b],e=this._layers[d.id];if(e&&!this._map.hasLayer(e)&&this._map.addLayer(e),e&&e.setLatLngs){var f=this.createNewLayer(d);e.setLatLngs(f.getLatLngs())}e||(c=this.createNewLayer(d),c.feature=d,c.defaultOptions=c.options,c._leaflet_id=this._key+"_"+d.id,this._leafletIds[c._leaflet_id]=d.id,c.on(EsriLeaflet.Layers.FeatureLayer.EVENTS,this._propagateEvent,this),this._popup&&c.bindPopup&&c.bindPopup(this._popup(c.feature,c),this._popupOptions),this.options.onEachFeature&&this.options.onEachFeature(c.feature,c),this._layers[c.feature.id]=c,this.resetStyle(c.feature.id),this.fire("createfeature",{feature:c.feature}),(!this.options.timeField||this.options.timeField&&this._featureWithinTimeRange(d))&&this._map.addLayer(c))}},addLayers:function(a){for(var b=a.length-1;b>=0;b--){var c=this._layers[a[b]];c&&(this.fire("addfeature",{feature:c.feature}),this._map.addLayer(c))}},removeLayers:function(a,b){for(var c=a.length-1;c>=0;c--){var d=a[c],e=this._layers[d];e&&(this.fire("removefeature",{feature:e.feature,permanent:b}),this._map.removeLayer(e)),e&&b&&delete this._layers[d]}},resetStyle:function(a){var b=this._layers[a];return b&&(b.options=b.defaultOptions,this.setFeatureStyle(b.feature.id,this.options.style)),this},setStyle:function(a){return this.options.style=a,this.eachFeature(function(b){this.setFeatureStyle(b.feature.id,a)},this),this},setFeatureStyle:function(a,b){var c=this._layers[a];"function"==typeof b&&(b=b(c.feature)),c.setStyle&&c.setStyle(b)},bindPopup:function(a,b){this._popup=a,this._popupOptions=b;for(var c in this._layers){var d=this._layers[c],e=this._popup(d.feature,d);d.bindPopup(e,b)}return this},unbindPopup:function(){this._popup=!1;for(var a in this._layers){var b=this._layers[a];if(b.unbindPopup)b.unbindPopup();else if(b.getLayers){var c=b.getLayers();for(var d in c){var e=c[d];e.unbindPopup()}}}return this},eachFeature:function(a,b){for(var c in this._layers)a.call(b,this._layers[c]);return this},getFeature:function(a){return this._layers[a]},_propagateEvent:function(a){a.layer=this._layers[this._leafletIds[a.target._leaflet_id]],a.target=this,this.fire(a.type,a)}}),EsriLeaflet.FeatureLayer=EsriLeaflet.Layers.FeatureLayer,EsriLeaflet.Layers.featureLayer=function(a,b){return new EsriLeaflet.Layers.FeatureLayer(a,b)},EsriLeaflet.featureLayer=function(a,b){return new EsriLeaflet.Layers.FeatureLayer(a,b)},EsriLeaflet.Controls.Logo=L.Control.extend({options:{position:"bottomright",marginTop:0,marginLeft:0,marginBottom:0,marginRight:0},onAdd:function(){var a=L.DomUtil.create("div","esri-leaflet-logo");return a.style.marginTop=this.options.marginTop,a.style.marginLeft=this.options.marginLeft,a.style.marginBottom=this.options.marginBottom,a.style.marginRight=this.options.marginRight,a.innerHTML='',a}}),EsriLeaflet.Controls.logo=function(a){return new L.esri.Controls.Logo(a)}; +//# sourceMappingURL=esri-leaflet.js.map + + return EsriLeaflet; +})); \ No newline at end of file diff --git a/dist/esri-leaflet.js.map b/dist/esri-leaflet.js.map new file mode 100644 index 000000000..d860b66d0 --- /dev/null +++ b/dist/esri-leaflet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"esri-leaflet.js","sources":["../src/EsriLeaflet.js","../src/Util.js","../src/Request.js","../src/Services/Service.js","../src/Services/FeatureLayer.js","../src/Services/MapService.js","../src/Services/ImageService.js","../src/Tasks/Task.js","../src/Tasks/Query.js","../src/Tasks/Find.js","../src/Tasks/Identify.js","../src/Tasks/IdentifyImage.js","../src/Tasks/IdentifyFeatures.js","../src/Layers/BasemapLayer.js","../src/Layers/RasterLayer.js","../src/Layers/DynamicMapLayer.js","../src/Layers/ImageMapLayer.js","../src/Layers/TiledMapLayer.js","../src/Layers/FeatureLayer/FeatureGrid.js","../src/Layers/FeatureLayer/FeatureManager.js","../src/Layers/FeatureLayer/FeatureLayer.js","../src/Controls/Logo.js"],"names":["EsriLeaflet","VERSION","Layers","Services","Controls","Tasks","Util","Support","CORS","window","XMLHttpRequest","pointerEvents","document","documentElement","style","L","esri","clone","obj","target","i","hasOwnProperty","pointsEqual","a","b","length","closeRing","coordinates","push","ringIsClockwise","ringToTest","pt2","total","rLength","pt1","vertexIntersectsVertex","a1","a2","b1","b2","uaT","ubT","uB","ua","ub","arrayIntersectsArray","j","coordinatesContainPoint","point","contains","l","coordinatesContainCoordinates","outer","inner","intersects","convertRingsToGeoJSON","rings","x","outerRing","hole","outerRings","holes","r","ring","slice","polygon","uncontainedHoles","pop","contained","reverse","type","orientRings","poly","output","shift","flattenMultiPolygonRings","extentToBounds","extent","sw","LatLng","ymin","xmin","ne","ymax","xmax","LatLngBounds","boundsToExtent","bounds","latLngBounds","getSouthWest","lng","lat","getNorthEast","spatialReference","wkid","arcgisToGeojson","arcgis","idAttribute","geojson","y","points","paths","geometry","attributes","properties","id","OBJECTID","FID","geojsonToArcGIS","result","features","geometries","responseToFeatureCollection","response","objectIdField","objectIdFieldName","fields","name","featureCollection","results","cleanUrl","url","replace","geojsonTypeToArcGIS","geoJsonType","arcgisGeometryType","serialize","params","data","f","key","value","param","Object","prototype","toString","call","JSON","stringify","valueOf","encodeURIComponent","createRequest","callback","context","httpRequest","onerror","error","code","message","onreadystatechange","readyState","parse","responseText","e","callbacks","_EsriLeafletCallbacks","Request","request","paramString","requestLength","open","send","setRequestHeader","get","JSONP","console","warn","post","XMLHTTP","callbackId","script","DomUtil","create","body","src","responseType","abort","_callback","Service","Class","extend","includes","Mixin","Events","options","proxy","useCors","initialize","this","_requestQueue","_authenticating","setOptions","path","_request","metadata","authenticate","token","_runQueue","method","fire","wrappedCallback","_createServiceCallback","bind","apply","service","FeatureLayer","query","Query","addFeature","feature","addResults","undefined","updateFeature","updateResults","deleteFeature","objectIds","deleteResults","featureLayer","MapService","identify","identifyFeatures","find","Find","mapService","ImageService","IdentifyImage","imageService","Task","generateSetter","isArray","match","join","endpoint","_service","setters","setter","offset","limit","outFields","precision","featureIds","returnGeometry","where","outSr","within","_setGeometry","spatialRel","overlaps","nearby","latlng","radius","latLng","geometryType","units","distance","inSr","string","between","start","end","time","simplify","map","factor","mapWidth","Math","abs","getBounds","getWest","getEast","maxAllowableOffset","getSize","orderBy","fieldName","order","orderByFields","bool","run","_cleanParams","count","returnCountOnly","ids","returnIdsOnly","returnExtentOnly","pixelSize","layer","getLatLng","GeoJSON","getLayers","toGeoJSON","text","sr","layers","dynamicLayers","returnZ","returnM","gdbVersion","layerDefs","Identify","setMosaicRule","setRenderingRule","returnCatalogItems","at","getMosaicRule","mosaicRule","getRenderingRule","renderingRule","setPixelSize","getPixelSize","_responseToGeoJSON","location","catalogItems","catalogItemVisibilities","geoJSON","pixel","crs","objectId","Values","values","catalogItemVisibility","identifyImage","IdentifyFeatures","tolerance","on","size","imageDisplay","mapExtent","layerDef","tileProtocol","protocol","BasemapLayer","TileLayer","statics","TILES","Streets","urlTemplate","attributionUrl","hideLogo","logoPosition","minZoom","maxZoom","subdomains","attribution","Topographic","Oceans","OceansLabels","NationalGeographic","DarkGray","DarkGrayLabels","Gray","GrayLabels","Imagery","ImageryLabels","ImageryTransportation","ShadedRelief","ShadedReliefLabels","Terrain","TerrainLabels","config","Error","tileOptions","_getAttributionData","onAdd","_logo","Logo","position","addTo","_updateMapAttribution","onRemove","removeControl","off","getAttribution","attributions","_attributions","c","contributors","contributor","coverageAreas","coverageArea","southWest","bbox","northEast","score","zoomMin","zoomMax","sort","_map","attributionControl","newAttributions","zoom","getZoom","substr","attributionElement","_container","querySelector","innerHTML","maxWidth","basemapLayer","RasterLayer","opacity","_update","limitExecByInterval","updateInterval","split","bboxSR","imageSR","_popup","_getPopupData","_resetPopupState","bindPopup","fn","popupOptions","_shouldRenderPopup","_lastClick","popup","_popupFunction","unbindPopup","closePopup","_currentImage","removeLayer","addLayer","removeFrom","bringToFront","bringToBack","getOpacity","setOpacity","getTimeRange","from","to","setTimeRange","_renderImage","image","ImageOverlay","once","newImage","oldImage","_bounds","equals","_animatingZoom","_panTransition","_inProgress","_buildExportParams","_requestExport","_renderPopup","content","setLatLng","setContent","openOn","_propagateEvent","DynamicMapLayer","timeOptions","format","transparent","setLayers","getLayerDefs","setLayerDefs","getTimeOptions","setTimeOptions","setTimeout","identifyRequest","project","_northEast","_southWest","dpi","href","getParamString","dynamicMapLayer","ImageMapLayer","setPixelType","pixelType","getPixelType","setBandIds","bandIds","getBandIds","setNoData","noData","noDataInterpretation","getNoData","getNoDataInterpretation","interpolation","compressionQuality","imageMapLayer","TiledMapLayer","tileUrl","tokenQs","tiledMapLayer","FeatureGrid","cellSize","addEventListener","getEvents","_reset","removeEventListener","_removeCells","events","viewreset","moveend","_cells","_activeCells","_cellsToLoad","_cellsTotal","_resetWrap","infinite","_getCellSize","wrapLng","_wrapLng","floor","ceil","wrapLat","_wrapLat","getPixelBounds","cellBounds","min","divideBy","max","_addCells","_removeOtherCells","coords","queue","center","getCenter","Point","z","cellsToLoad","distanceTo","_addCell","_cellCoordsToBounds","nwPoint","multiplyBy","sePoint","add","nw","unproject","wrap","se","_cellCoordsToKey","_keyToCellCoords","kArr","parseInt","_removeCell","cell","cellLeave","_wrapCoords","cellEnter","createCell","wrapNum","BinarySearchIndex","FeatureManager","timeField","timeFilterMode","simplifyFactor","oidCheck","_startTimeIndex","_endTimeIndex","_timeIndex","_currentSnapshot","_activeRequests","_pendingRequests","_requestFeatures","_buildQuery","exceededTransferLimit","_addFeatures","_buildTimeIndexes","createLayers","setWhere","oldSnapshot","newShapshot","pendingRequests","requestError","requestCallback","removeLayers","addLayers","getWhere","oldFrom","oldTo","_filterExistingFeatures","refresh","newFrom","newTo","layersToRemove","_getFeaturesInTimeRange","layersToAdd","indexOf","shouldRemoveLayer","splice","search","startTimes","endTimes","concat","startTimeEntries","endTimeEntries","Date","bulkAdd","timeEntries","_featureWithinTimeRange","date","startDate","endDate","_query","currentIndex","currentElement","resultIndex","minIndex","maxIndex","round","dirty","startIndex","endIndex","items","EVENTS","_layers","_leafletIds","_key","random","createNewLayer","geometryToLayer","pointToLayer","coordsToLatLng","newLayer","hasLayer","setLatLngs","updateGeo","getLatLngs","defaultOptions","_leaflet_id","_popupOptions","onEachFeature","resetStyle","permanent","setFeatureStyle","setStyle","eachFeature","popupContent","groupLayers","gLayer","getFeature","Control","marginTop","marginLeft","marginBottom","marginRight","div","logo"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,GAAIA,cACFC,QAAS,aACTC,UACAC,YACAC,YACAC,SACAC,QACAC,SACEC,QAASC,OAAOC,gBAAkB,mBAAqB,IAAIA,iBAC3DC,cAAgE,KAAjDC,SAASC,gBAAgBC,MAAMH,eAI7B,oBAAXF,SAA0BA,OAAOM,IACzCN,OAAOM,EAAEC,KAAOhB,aCdlB,SAAUA,GAIR,QAASiB,GAAMC,GACb,GAAIC,KACJ,KAAK,GAAIC,KAAKF,GACRA,EAAIG,eAAeD,KACrBD,EAAOC,GAAKF,EAAIE,GAGpB,OAAOD,GAI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O2M,aAAapF,EAAK+D,IC7OlDxL,YAAYI,SAASwW,KAAO7V,EAAE4mB,QAAQvc,QACpCI,SACEqL,SAAU,cACV+Q,UAAW,EACXC,WAAY,EACZC,aAAc,EACdC,YAAa,GAEfrR,MAAO,WACL,GAAIsR,GAAMjnB,EAAE4J,QAAQC,OAAO,MAAO,oBAMlC,OALAod,GAAIlnB,MAAM8mB,UAAYhc,KAAKJ,QAAQoc,UACnCI,EAAIlnB,MAAM+mB,WAAajc,KAAKJ,QAAQqc,WACpCG,EAAIlnB,MAAMgnB,aAAelc,KAAKJ,QAAQsc,aACtCE,EAAIlnB,MAAMinB,YAAcnc,KAAKJ,QAAQuc,YACrCC,EAAIrP,UAAY,iKACTqP,KAIXhoB,YAAYI,SAAS6nB,KAAO,SAASzc,GACnC,MAAO,IAAIzK,GAAEC,KAAKZ,SAASwW,KAAKpL","sourcesContent":["var EsriLeaflet = { //jshint ignore:line\n VERSION: '1.0.0-rc.2',\n Layers: {},\n Services: {},\n Controls: {},\n Tasks: {},\n Util: {},\n Support: {\n CORS: !!(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()),\n pointerEvents: document.documentElement.style.pointerEvents === ''\n }\n};\n\nif(typeof window !== 'undefined' && window.L){\n window.L.esri = EsriLeaflet;\n}","(function(EsriLeaflet){\n\n // shallow object clone for feature properties and attributes\n // from http://jsperf.com/cloning-an-object/2\n function clone(obj) {\n var target = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n target[i] = obj[i];\n }\n }\n return target;\n }\n\n // checks if 2 x,y points are equal\n function pointsEqual(a, b) {\n for (var i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n }\n\n // checks if the first and last points of a ring are equal and closes the ring\n function closeRing(coordinates) {\n if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) {\n coordinates.push(coordinates[0]);\n }\n return coordinates;\n }\n\n // determine if polygon ring coordinates are clockwise. clockwise signifies outer ring, counter-clockwise an inner ring\n // or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-\n // points-are-in-clockwise-order\n function ringIsClockwise(ringToTest) {\n var total = 0,i = 0;\n var rLength = ringToTest.length;\n var pt1 = ringToTest[i];\n var pt2;\n for (i; i < rLength - 1; i++) {\n pt2 = ringToTest[i + 1];\n total += (pt2[0] - pt1[0]) * (pt2[1] + pt1[1]);\n pt1 = pt2;\n }\n return (total >= 0);\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L504-L519\n function vertexIntersectsVertex(a1, a2, b1, b2) {\n var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]);\n var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]);\n var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]);\n\n if ( uB !== 0 ) {\n var ua = uaT / uB;\n var ub = ubT / uB;\n\n if ( 0 <= ua && ua <= 1 && 0 <= ub && ub <= 1 ) {\n return true;\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L521-L531\n function arrayIntersectsArray(a, b) {\n for (var i = 0; i < a.length - 1; i++) {\n for (var j = 0; j < b.length - 1; j++) {\n if (vertexIntersectsVertex(a[i], a[i + 1], b[j], b[j + 1])) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n // ported from terraformer.js https://github.com/Esri/Terraformer/blob/master/terraformer.js#L470-L480\n function coordinatesContainPoint(coordinates, point) {\n var contains = false;\n for(var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) {\n if (((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1]) ||\n (coordinates[j][1] <= point[1] && point[1] < coordinates[i][1])) &&\n (point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0])) {\n contains = !contains;\n }\n }\n return contains;\n }\n\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L106-L113\n function coordinatesContainCoordinates(outer, inner){\n var intersects = arrayIntersectsArray(outer, inner);\n var contains = coordinatesContainPoint(outer, inner[0]);\n if(!intersects && contains){\n return true;\n }\n return false;\n }\n\n // do any polygons in this array contain any other polygons in this array?\n // used for checking for holes in arcgis rings\n // ported from terraformer-arcgis-parser.js https://github.com/Esri/terraformer-arcgis-parser/blob/master/terraformer-arcgis-parser.js#L117-L172\n function convertRingsToGeoJSON(rings){\n var outerRings = [];\n var holes = [];\n var x; // iterator\n var outerRing; // current outer ring being evaluated\n var hole; // current hole being evaluated\n\n // for each ring\n for (var r = 0; r < rings.length; r++) {\n var ring = closeRing(rings[r].slice(0));\n if(ring.length < 4){\n continue;\n }\n // is this ring an outer ring? is it clockwise?\n if(ringIsClockwise(ring)){\n var polygon = [ ring ];\n outerRings.push(polygon); // push to outer rings\n } else {\n holes.push(ring); // counterclockwise push to holes\n }\n }\n\n var uncontainedHoles = [];\n\n // while there are holes left...\n while(holes.length){\n // pop a hole off out stack\n hole = holes.pop();\n\n // loop over all outer rings and see if they contain our hole.\n var contained = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(coordinatesContainCoordinates(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n contained = true;\n break;\n }\n }\n\n // ring is not contained in any outer ring\n // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320\n if(!contained){\n uncontainedHoles.push(hole);\n }\n }\n\n // if we couldn't match any holes using contains we can try intersects...\n while(uncontainedHoles.length){\n // pop a hole off out stack\n hole = uncontainedHoles.pop();\n\n // loop over all outer rings and see if any intersect our hole.\n var intersects = false;\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n if(arrayIntersectsArray(outerRing, hole)){\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n intersects = true;\n break;\n }\n }\n\n if(!intersects) {\n outerRings.push([hole.reverse()]);\n }\n }\n\n if(outerRings.length === 1){\n return {\n type: 'Polygon',\n coordinates: outerRings[0]\n };\n } else {\n return {\n type: 'MultiPolygon',\n coordinates: outerRings\n };\n }\n }\n\n // This function ensures that rings are oriented in the right directions\n // outer rings are clockwise, holes are counterclockwise\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function orientRings(poly){\n var output = [];\n var polygon = poly.slice(0);\n var outerRing = closeRing(polygon.shift().slice(0));\n if(outerRing.length >= 4){\n if(!ringIsClockwise(outerRing)){\n outerRing.reverse();\n }\n\n output.push(outerRing);\n\n for (var i = 0; i < polygon.length; i++) {\n var hole = closeRing(polygon[i].slice(0));\n if(hole.length >= 4){\n if(ringIsClockwise(hole)){\n hole.reverse();\n }\n output.push(hole);\n }\n }\n }\n\n return output;\n }\n\n // This function flattens holes in multipolygons to one array of polygons\n // used for converting GeoJSON Polygons to ArcGIS Polygons\n function flattenMultiPolygonRings(rings){\n var output = [];\n for (var i = 0; i < rings.length; i++) {\n var polygon = orientRings(rings[i]);\n for (var x = polygon.length - 1; x >= 0; x--) {\n var ring = polygon[x].slice(0);\n output.push(ring);\n }\n }\n return output;\n }\n\n // convert an extent (ArcGIS) to LatLngBounds (Leaflet)\n EsriLeaflet.Util.extentToBounds = function(extent){\n var sw = new L.LatLng(extent.ymin, extent.xmin);\n var ne = new L.LatLng(extent.ymax, extent.xmax);\n return new L.LatLngBounds(sw, ne);\n };\n\n // convert an LatLngBounds (Leaflet) to extent (ArcGIS)\n EsriLeaflet.Util.boundsToExtent = function(bounds) {\n bounds = L.latLngBounds(bounds);\n return {\n 'xmin': bounds.getSouthWest().lng,\n 'ymin': bounds.getSouthWest().lat,\n 'xmax': bounds.getNorthEast().lng,\n 'ymax': bounds.getNorthEast().lat,\n 'spatialReference': {\n 'wkid' : 4326\n }\n };\n };\n\n EsriLeaflet.Util.arcgisToGeojson = function (arcgis, idAttribute){\n var geojson = {};\n\n if(typeof arcgis.x === 'number' && typeof arcgis.y === 'number'){\n geojson.type = 'Point';\n geojson.coordinates = [arcgis.x, arcgis.y];\n }\n\n if(arcgis.points){\n geojson.type = 'MultiPoint';\n geojson.coordinates = arcgis.points.slice(0);\n }\n\n if(arcgis.paths) {\n if(arcgis.paths.length === 1){\n geojson.type = 'LineString';\n geojson.coordinates = arcgis.paths[0].slice(0);\n } else {\n geojson.type = 'MultiLineString';\n geojson.coordinates = arcgis.paths.slice(0);\n }\n }\n\n if(arcgis.rings) {\n geojson = convertRingsToGeoJSON(arcgis.rings.slice(0));\n }\n\n if(arcgis.geometry || arcgis.attributes) {\n geojson.type = 'Feature';\n geojson.geometry = (arcgis.geometry) ? EsriLeaflet.Util.arcgisToGeojson(arcgis.geometry) : null;\n geojson.properties = (arcgis.attributes) ? clone(arcgis.attributes) : null;\n if(arcgis.attributes) {\n geojson.id = arcgis.attributes[idAttribute] || arcgis.attributes.OBJECTID || arcgis.attributes.FID;\n }\n }\n\n return geojson;\n };\n\n // GeoJSON -> ArcGIS\n EsriLeaflet.Util.geojsonToArcGIS = function(geojson, idAttribute){\n idAttribute = idAttribute || 'OBJECTID';\n var spatialReference = { wkid: 4326 };\n var result = {};\n var i;\n\n switch(geojson.type){\n case 'Point':\n result.x = geojson.coordinates[0];\n result.y = geojson.coordinates[1];\n result.spatialReference = spatialReference;\n break;\n case 'MultiPoint':\n result.points = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'LineString':\n result.paths = [geojson.coordinates.slice(0)];\n result.spatialReference = spatialReference;\n break;\n case 'MultiLineString':\n result.paths = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n case 'Polygon':\n result.rings = orientRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'MultiPolygon':\n result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n case 'Feature':\n if(geojson.geometry) {\n result.geometry = EsriLeaflet.Util.geojsonToArcGIS(geojson.geometry, idAttribute);\n }\n result.attributes = (geojson.properties) ? clone(geojson.properties) : {};\n if(geojson.id){\n result.attributes[idAttribute] = geojson.id;\n }\n break;\n case 'FeatureCollection':\n result = [];\n for (i = 0; i < geojson.features.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.features[i], idAttribute));\n }\n break;\n case 'GeometryCollection':\n result = [];\n for (i = 0; i < geojson.geometries.length; i++){\n result.push(EsriLeaflet.Util.geojsonToArcGIS(geojson.geometries[i], idAttribute));\n }\n break;\n }\n\n return result;\n };\n\n EsriLeaflet.Util.responseToFeatureCollection = function(response, idAttribute){\n var objectIdField;\n\n if(idAttribute){\n objectIdField = idAttribute;\n } else if(response.objectIdFieldName){\n objectIdField = response.objectIdFieldName;\n } else if(response.fields) {\n for (var j = 0; j <= response.fields.length - 1; j++) {\n if(response.fields[j].type === 'esriFieldTypeOID') {\n objectIdField = response.fields[j].name;\n break;\n }\n }\n } else {\n objectIdField = 'OBJECTID';\n }\n\n var featureCollection = {\n type: 'FeatureCollection',\n features: []\n };\n var features = response.features || response.results;\n if(features.length){\n for (var i = features.length - 1; i >= 0; i--) {\n featureCollection.features.push(EsriLeaflet.Util.arcgisToGeojson(features[i], objectIdField));\n }\n }\n\n return featureCollection;\n };\n\n // trim whitespace and add a tailing slash is needed to a url\n EsriLeaflet.Util.cleanUrl = function(url){\n url = url.replace(/\\s\\s*/g, '');\n\n //add a trailing slash to the url if the user omitted it\n if(url[url.length-1] !== '/'){\n url += '/';\n }\n\n return url;\n };\n\n EsriLeaflet.Util.geojsonTypeToArcGIS = function (geoJsonType) {\n var arcgisGeometryType;\n switch (geoJsonType) {\n case 'Point':\n arcgisGeometryType = 'esriGeometryPoint';\n break;\n case 'MultiPoint':\n arcgisGeometryType = 'esriGeometryMultipoint';\n break;\n case 'LineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'MultiLineString':\n arcgisGeometryType = 'esriGeometryPolyline';\n break;\n case 'Polygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n case 'MultiPolygon':\n arcgisGeometryType = 'esriGeometryPolygon';\n break;\n }\n return arcgisGeometryType;\n };\n\n})(EsriLeaflet);","(function(EsriLeaflet){\n\n var callbacks = 0;\n\n window._EsriLeafletCallbacks = {};\n\n function serialize(params){\n var data = '';\n\n params.f = 'json';\n\n for (var key in params){\n if(params.hasOwnProperty(key)){\n var param = params[key];\n var type = Object.prototype.toString.call(param);\n var value;\n\n if(data.length){\n data += '&';\n }\n\n if(type === '[object Array]' || type === '[object Object]'){\n value = JSON.stringify(param);\n } else if (type === '[object Date]'){\n value = param.valueOf();\n } else {\n value = param;\n }\n\n data += encodeURIComponent(key) + '=' + encodeURIComponent(value);\n }\n }\n\n return data;\n }\n\n function createRequest(callback, context){\n var httpRequest = new XMLHttpRequest();\n\n httpRequest.onerror = function(e) {\n callback.call(context, {\n error: {\n code: 500,\n message: 'XMLHttpRequest error'\n }\n }, null);\n };\n\n httpRequest.onreadystatechange = function(){\n var response;\n var error;\n\n if (httpRequest.readyState === 4) {\n try {\n response = JSON.parse(httpRequest.responseText);\n } catch(e) {\n response = null;\n error = {\n code: 500,\n message: 'Could not parse response as JSON.'\n };\n }\n\n if (!error && response.error) {\n error = response.error;\n response = null;\n }\n\n callback.call(context, error, response);\n }\n };\n\n return httpRequest;\n }\n\n // AJAX handlers for CORS (modern browsers) or JSONP (older browsers)\n EsriLeaflet.Request = {\n request: function(url, params, callback, context){\n var paramString = serialize(params);\n var httpRequest = createRequest(callback, context);\n var requestLength = (url + '?' + paramString).length;\n\n // request is less then 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest\n if(requestLength <= 2000 && L.esri.Support.CORS){\n httpRequest.open('GET', url + '?' + paramString);\n httpRequest.send(null);\n\n // request is less more then 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest\n } else if (requestLength > 2000 && L.esri.Support.CORS){\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(paramString);\n\n // request is less more then 2000 characters and the browser does not support CORS, make a JSONP request\n } else if(requestLength <= 2000 && !L.esri.Support.CORS){\n return L.esri.Request.get.JSONP(url, params, callback, context);\n\n // request is longer then 2000 characters and the browser does not support CORS, log a warning\n } else {\n if(console && console.warn){\n console.warn('a request to ' + url + ' 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');\n return;\n }\n }\n\n return httpRequest;\n },\n post: {\n XMLHTTP: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n httpRequest.open('POST', url);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.send(serialize(params));\n\n return httpRequest;\n }\n },\n\n get: {\n CORS: function (url, params, callback, context) {\n var httpRequest = createRequest(callback, context);\n\n httpRequest.open('GET', url + '?' + serialize(params), true);\n httpRequest.send(null);\n\n return httpRequest;\n },\n JSONP: function(url, params, callback, context){\n var callbackId = 'c' + callbacks;\n\n params.callback = 'window._EsriLeafletCallbacks.' + callbackId;\n\n var script = L.DomUtil.create('script', null, document.body);\n script.type = 'text/javascript';\n script.src = url + '?' + serialize(params);\n script.id = callbackId;\n\n window._EsriLeafletCallbacks[callbackId] = function(response){\n if(window._EsriLeafletCallbacks[callbackId] !== true){\n var error;\n var responseType = Object.prototype.toString.call(response);\n\n if(!(responseType === '[object Object]' || responseType === '[object Array]')){\n error = {\n error: {\n code: 500,\n message: 'Expected array or object as JSONP response'\n }\n };\n response = null;\n }\n\n if (!error && response.error) {\n error = response;\n response = null;\n }\n\n callback.call(context, error, response);\n window._EsriLeafletCallbacks[callbackId] = true;\n }\n };\n\n callbacks++;\n\n return {\n id: callbackId,\n url: script.src,\n abort: function(){\n window._EsriLeafletCallbacks._callback[callbackId]({\n code: 0,\n message: 'Request aborted.'\n });\n }\n };\n }\n }\n };\n\n // Choose the correct AJAX handler depending on CORS support\n EsriLeaflet.get = (EsriLeaflet.Support.CORS) ? EsriLeaflet.Request.get.CORS : EsriLeaflet.Request.get.JSONP;\n\n // Always use XMLHttpRequest for posts\n EsriLeaflet.post = EsriLeaflet.Request.post.XMLHTTP;\n\n // expose a common request method the uses GET\\POST based on request length\n EsriLeaflet.request = EsriLeaflet.Request.request;\n\n})(EsriLeaflet);","EsriLeaflet.Services.Service = L.Class.extend({\n\n includes: L.Mixin.Events,\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n initialize: function (url, options) {\n this.url = EsriLeaflet.Util.cleanUrl(url);\n this._requestQueue = [];\n this._authenticating = false;\n L.Util.setOptions(this, options);\n },\n\n get: function (path, params, callback, context) {\n return this._request('get', path, params, callback, context);\n },\n\n post: function (path, params, callback, context) {\n return this._request('post', path, params, callback, context);\n },\n\n request: function (path, params, callback, context) {\n return this._request('request', path, params, callback, context);\n },\n\n metadata: function (callback, context) {\n return this._request('get', '', {}, callback, context);\n },\n\n authenticate: function(token){\n this._authenticating = false;\n this.options.token = token;\n this._runQueue();\n return this;\n },\n\n _request: function(method, path, params, callback, context){\n this.fire('requeststart', {\n url: this.url + path,\n params: params,\n method: method\n });\n\n var wrappedCallback = this._createServiceCallback(method, path, params, callback, context);\n\n if (this.options.token) {\n params.token = this.options.token;\n }\n\n if (this._authenticating) {\n this._requestQueue.push([method, path, params, callback, context]);\n return;\n } else {\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, wrappedCallback);\n } else {\n return EsriLeaflet[method](url, params, wrappedCallback);\n }\n }\n },\n\n _createServiceCallback: function(method, path, params, callback, context){\n var request = [method, path, params, callback, context];\n\n return L.Util.bind(function(error, response){\n\n if (error && (error.code === 499 || error.code === 498)) {\n this._authenticating = true;\n\n this._requestQueue.push(request);\n\n this.fire('authenticationrequired', {\n authenticate: L.Util.bind(this.authenticate, this)\n });\n } else {\n callback.call(context, error, response);\n\n if(error) {\n this.fire('requesterror', {\n url: this.url + path,\n params: params,\n message: error.message,\n code: error.code,\n method: method\n });\n } else {\n this.fire('requestsuccess', {\n url: this.url + path,\n params: params,\n response: response,\n method: method\n });\n }\n\n this.fire('requestend', {\n url: this.url + path,\n params: params,\n method: method\n });\n }\n }, this);\n },\n\n _runQueue: function(){\n for (var i = this._requestQueue.length - 1; i >= 0; i--) {\n var request = this._requestQueue[i];\n var method = request.shift();\n this[method].apply(this, request);\n }\n this._requestQueue = [];\n }\n\n});\n\nEsriLeaflet.Services.service = function(url, params){\n return new EsriLeaflet.Services.Service(url, params);\n};","EsriLeaflet.Services.FeatureLayer = EsriLeaflet.Services.Service.extend({\n\n options: {\n idAttribute: 'OBJECTID'\n },\n\n query: function(){\n return new EsriLeaflet.Tasks.Query(this);\n },\n\n addFeature: function(feature, callback, context) {\n delete feature.id;\n\n feature = EsriLeaflet.Util.geojsonToArcGIS(feature);\n\n return this.post('addFeatures', {\n features: [feature]\n }, function(error, response){\n var result = (response && response.addResults) ? response.addResults[0] : undefined;\n if(callback){\n callback.call(this, error || response.addResults[0].error, result);\n }\n }, context);\n },\n\n updateFeature: function(feature, callback, context) {\n feature = EsriLeaflet.Util.geojsonToArcGIS(feature, this.options.idAttribute);\n\n return this.post('updateFeatures', {\n features: [feature]\n }, function(error, response){\n var result = (response && response.updateResults) ? response.updateResults[0] : undefined;\n if(callback){\n callback.call(context, error || response.updateResults[0].error, result);\n }\n }, context);\n },\n\n deleteFeature: function(id, callback, context) {\n return this.post('deleteFeatures', {\n objectIds: id\n }, function(error, response){\n var result = (response && response.deleteResults) ? response.deleteResults[0] : undefined;\n if(callback){\n callback.call(context, error || response.deleteResults[0].error, result);\n }\n }, context);\n }\n\n});\n\nEsriLeaflet.Services.featureLayer = function(url, options) {\n return new EsriLeaflet.Services.FeatureLayer(url, options);\n};","EsriLeaflet.Services.MapService = EsriLeaflet.Services.Service.extend({\n\n identify: function () {\n return new EsriLeaflet.Tasks.identifyFeatures(this);\n },\n\n find: function () {\n return new EsriLeaflet.Tasks.Find(this);\n },\n\n query: function () {\n return new EsriLeaflet.Tasks.Query(this);\n }\n\n});\n\nEsriLeaflet.Services.mapService = function(url, params){\n return new EsriLeaflet.Services.MapService(url, params);\n};","EsriLeaflet.Services.ImageService = EsriLeaflet.Services.Service.extend({\n\n query: function () {\n return new EsriLeaflet.Tasks.Query(this);\n },\n\n identify: function() {\n return new EsriLeaflet.Tasks.IdentifyImage(this);\n }\n});\n\nEsriLeaflet.Services.imageService = function(url, params){\n return new EsriLeaflet.Services.ImageService(url, params);\n};","EsriLeaflet.Tasks.Task = L.Class.extend({\n\n options: {\n proxy: false,\n useCors: EsriLeaflet.Support.CORS\n },\n\n //Generate a method for each methodName:paramName in the setters for this task.\n generateSetter: function(param, context){\n var isArray = param.match(/([a-zA-Z]+)\\[\\]/);\n\n param = (isArray) ? isArray[1] : param;\n\n if(isArray){\n return L.Util.bind(function(value){\n // this.params[param] = (this.params[param]) ? this.params[param] + ',' : '';\n if (L.Util.isArray(value)) {\n this.params[param] = value.join(',');\n } else {\n this.params[param] = value;\n }\n return this;\n }, context);\n } else {\n return L.Util.bind(function(value){\n this.params[param] = value;\n return this;\n }, context);\n }\n },\n\n initialize: function(endpoint, options){\n // endpoint can be either a url to an ArcGIS Rest Service or an instance of EsriLeaflet.Service\n if(endpoint.url && endpoint.request){\n this._service = endpoint;\n this.url = endpoint.url;\n } else {\n this.url = EsriLeaflet.Util.cleanUrl(endpoint);\n }\n\n // clone default params into this object\n this.params = L.Util.extend({}, this.params || {});\n\n // generate setter methods based on the setters object implimented a child class\n if(this.setters){\n for (var setter in this.setters){\n var param = this.setters[setter];\n this[setter] = this.generateSetter(param, this);\n }\n }\n\n L.Util.setOptions(this, options);\n },\n\n token: function(token){\n if(this._service){\n this._service.authenticate(token);\n } else {\n this.params.token = token;\n }\n return this;\n },\n\n request: function(callback, context){\n if(this._service){\n return this._service.request(this.path, this.params, callback, context);\n } else {\n return this._request('request', this.path, this.params, callback, context);\n }\n },\n\n _request: function(method, path, params, callback, context){\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.url + path : this.url + path;\n if((method === 'get' || method === 'request') && !this.options.useCors){\n return EsriLeaflet.Request.get.JSONP(url, params, callback, context);\n } else{\n return EsriLeaflet[method](url, params, callback, context);\n }\n }\n});","EsriLeaflet.Tasks.Query = EsriLeaflet.Tasks.Task.extend({\n setters: {\n 'offset': 'offset',\n 'limit': 'limit',\n 'outFields': 'fields[]',\n 'precision': 'geometryPrecision',\n 'featureIds': 'objectIds[]',\n 'returnGeometry': 'returnGeometry',\n 'token': 'token'\n },\n\n path: 'query',\n\n params: {\n returnGeometry: true,\n where: '1=1',\n outSr: 4326,\n outFields: '*'\n },\n\n within: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelContains'; // will make code read layer within geometry, to the api this will reads geometry contains layer\n return this;\n },\n\n intersects: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelIntersects';\n return this;\n },\n\n contains: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelWithin'; // will make code read layer contains geometry, to the api this will reads geometry within layer\n return this;\n },\n\n // crosses: function(geometry){\n // this._setGeometry(geometry);\n // this.params.spatialRel = 'esriSpatialRelCrosses';\n // return this;\n // },\n\n // touches: function(geometry){\n // this._setGeometry(geometry);\n // this.params.spatialRel = 'esriSpatialRelTouches';\n // return this;\n // },\n\n overlaps: function(geometry){\n this._setGeometry(geometry);\n this.params.spatialRel = 'esriSpatialRelOverlaps';\n return this;\n },\n\n // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online\n nearby: function(latlng, radius){\n latlng = L.latLng(latlng);\n this.params.geometry = ([latlng.lng,latlng.lat]).join(',');\n this.params.geometryType = 'esriGeometryPoint';\n this.params.spatialRel = 'esriSpatialRelIntersects';\n this.params.units = 'esriSRUnit_Meter';\n this.params.distance = radius;\n this.params.inSr = 4326;\n return this;\n },\n\n where: function(string){\n this.params.where = string.replace(/\"/g, \"\\'\"); // jshint ignore:line\n return this;\n },\n\n between: function(start, end){\n this.params.time = ([start.valueOf(), end.valueOf()]).join();\n return this;\n },\n\n fields: function (fields) {\n if (L.Util.isArray(fields)) {\n this.params.outFields = fields.join(',');\n } else {\n this.params.outFields = fields;\n }\n return this;\n },\n\n simplify: function(map, factor){\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\n return this;\n },\n\n orderBy: function(fieldName, order){\n order = order || 'ASC';\n this.params.orderByFields = (this.params.orderByFields) ? this.params.orderByFields + ',' : '';\n this.params.orderByFields += ([fieldName, order]).join(' ');\n return this;\n },\n\n returnGeometry: function(bool){\n this.params.returnGeometry = bool;\n return this;\n },\n\n run: function(callback, context){\n this._cleanParams();\n return this.request(function(error, response){\n callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response);\n }, context);\n },\n\n count: function(callback, context){\n this._cleanParams();\n this.params.returnCountOnly = true;\n return this.request(function(error, response){\n callback.call(this, error, (response && response.count), response);\n }, context);\n },\n\n ids: function(callback, context){\n this._cleanParams();\n this.params.returnIdsOnly = true;\n return this.request(function(error, response){\n callback.call(this, error, (response && response.objectIds), response);\n }, context);\n },\n\n // only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online\n bounds: function(callback, context){\n this._cleanParams();\n this.params.returnExtentOnly = true;\n return this.request(function(error, response){\n callback.call(context, error, (response && response.extent && EsriLeaflet.Util.extentToBounds(response.extent)), response);\n }, context);\n },\n\n // only valid for image services\n pixelSize: function(point){\n point = L.point(point);\n this.params.pixelSize = ([point.x,point.y]).join(',');\n return this;\n },\n\n // only valid for map services\n layer: function(layer){\n this.path = layer + '/query';\n return this;\n },\n\n _cleanParams: function(){\n delete this.params.returnIdsOnly;\n delete this.params.returnExtentOnly;\n delete this.params.returnCountOnly;\n },\n\n _setGeometry: function(geometry) {\n this.params.inSr = 4326;\n\n // convert bounds to extent and finish\n if ( geometry instanceof L.LatLngBounds ) {\n // set geometry + geometryType\n this.params.geometry = EsriLeaflet.Util.boundsToExtent(geometry);\n this.params.geometryType = 'esriGeometryEnvelope';\n return;\n }\n\n // convert L.Marker > L.LatLng\n if(geometry.getLatLng){\n geometry = geometry.getLatLng();\n }\n\n // convert L.LatLng to a geojson point and continue;\n if (geometry instanceof L.LatLng) {\n geometry = {\n type: 'Point',\n coordinates: [geometry.lng, geometry.lat]\n };\n }\n\n // handle L.GeoJSON, pull out the first geometry\n if ( geometry instanceof L.GeoJSON ) {\n //reassign geometry to the GeoJSON value (we are assuming that only one feature is present)\n geometry = geometry.getLayers()[0].feature.geometry;\n this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry);\n this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type);\n }\n\n // Handle L.Polyline and L.Polygon\n if (geometry.toGeoJSON) {\n geometry = geometry.toGeoJSON();\n }\n\n // handle GeoJSON feature by pulling out the geometry\n if ( geometry.type === 'Feature' ) {\n // get the geometry of the geojson feature\n geometry = geometry.geometry;\n }\n\n // confirm that our GeoJSON is a point, line or polygon\n if ( geometry.type === 'Point' || geometry.type === 'LineString' || geometry.type === 'Polygon') {\n this.params.geometry = EsriLeaflet.Util.geojsonToArcGIS(geometry);\n this.params.geometryType = EsriLeaflet.Util.geojsonTypeToArcGIS(geometry.type);\n return;\n }\n\n // warn the user if we havn't found a\n /* global console */\n if(console && console.warn) {\n console.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');\n }\n\n return;\n }\n});\n\nEsriLeaflet.Tasks.query = function(url, params){\n return new EsriLeaflet.Tasks.Query(url, params);\n};","EsriLeaflet.Tasks.Find = EsriLeaflet.Tasks.Task.extend({\n setters: {\n // method name > param name\n 'contains': 'contains',\n 'text': 'searchText',\n 'fields': 'searchFields[]', // denote an array or single string\n 'spatialReference': 'sr',\n 'sr': 'sr',\n 'layers': 'layers[]',\n 'returnGeometry': 'returnGeometry',\n 'maxAllowableOffset': 'maxAllowableOffset',\n 'precision': 'geometryPrecision',\n 'dynamicLayers': 'dynamicLayers',\n 'returnZ' : 'returnZ',\n 'returnM' : 'returnM',\n 'gdbVersion' : 'gdbVersion',\n 'token' : 'token'\n },\n\n path: 'find',\n\n params: {\n sr: 4326,\n contains: true,\n returnGeometry: true,\n returnZ: true,\n returnM: false\n },\n\n layerDefs: function (id, where) {\n this.params.layerDefs = (this.params.layerDefs) ? this.params.layerDefs + ';' : '';\n this.params.layerDefs += ([id, where]).join(':');\n return this;\n },\n\n simplify: function(map, factor){\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\n return this;\n },\n\n run: function (callback, context) {\n return this.request(function(error, response){\n callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response);\n }, context);\n }\n});\n\nEsriLeaflet.Tasks.find = function (url, params) {\n return new EsriLeaflet.Tasks.Find(url, params);\n};","EsriLeaflet.Tasks.Identify = EsriLeaflet.Tasks.Task.extend({\n path: 'identify',\n\n between: function(start, end){\n this.params.time = ([start.valueOf(), end.valueOf()]).join(',');\n return this;\n },\n\n returnGeometry: function (returnGeometry) {\n this.params.returnGeometry = returnGeometry;\n return this;\n }\n});\n","EsriLeaflet.Tasks.IdentifyImage = EsriLeaflet.Tasks.Identify.extend({\n setters: {\n 'setMosaicRule': 'mosaicRule',\n 'setRenderingRule': 'renderingRule',\n 'returnCatalogItems': 'returnCatalogItems'\n },\n\n params: {\n returnGeometry: false\n },\n\n at: function(latlng){\n latlng = L.latLng(latlng);\n this.params.geometry = JSON.stringify({\n x: latlng.lng,\n y: latlng.lat,\n spatialReference:{\n wkid: 4326\n }\n });\n this.params.geometryType = 'esriGeometryPoint';\n return this;\n },\n\n getMosaicRule: function() {\n return this.params.mosaicRule;\n },\n\n getRenderingRule: function() {\n return this.params.renderingRule;\n },\n\n setPixelSize: function(pixelSize) {\n this.params.pixelSize = pixelSize.join ? pixelSize.join(',') : pixelSize;\n return this;\n },\n\n getPixelSize: function() {\n return this.params.pixelSize;\n },\n\n run: function (callback, context){\n return this.request(function(error, response){\n callback.call(context, error, (response && this._responseToGeoJSON(response)), response);\n }, this);\n },\n\n // get pixel data and return as geoJSON point\n // populate catalog items (if any)\n // merging in any catalogItemVisibilities as a propery of each feature\n _responseToGeoJSON: function(response) {\n var location = response.location;\n var catalogItems = response.catalogItems;\n var catalogItemVisibilities = response.catalogItemVisibilities;\n var geoJSON = {\n 'pixel': {\n 'type': 'Feature',\n 'geometry': {\n 'type': 'Point',\n 'coordinates': [location.x, location.y]\n },\n 'crs': {\n 'type': 'EPSG',\n 'properties': {\n 'code': location.spatialReference.wkid\n }\n },\n 'properties': {\n 'OBJECTID': response.objectId,\n 'name': response.name,\n 'value': response.value\n },\n 'id': response.objectId\n }\n };\n if (response.properties && response.properties.Values) {\n geoJSON.pixel.properties.values = response.properties.Values;\n }\n if (catalogItems && catalogItems.features) {\n geoJSON.catalogItems = EsriLeaflet.Util.responseToFeatureCollection(catalogItems);\n if (catalogItemVisibilities && catalogItemVisibilities.length === geoJSON.catalogItems.features.length) {\n for (var i = catalogItemVisibilities.length - 1; i >= 0; i--) {\n geoJSON.catalogItems.features[i].properties.catalogItemVisibility = catalogItemVisibilities[i];\n }\n }\n }\n return geoJSON;\n }\n\n});\n\nEsriLeaflet.Tasks.identifyImage = function(url, params){\n return new EsriLeaflet.Tasks.IdentifyImage(url, params);\n};","EsriLeaflet.Tasks.IdentifyFeatures = EsriLeaflet.Tasks.Identify.extend({\n setters: {\n 'layers': 'layers',\n 'precision': 'geometryPrecision',\n 'tolerance': 'tolerance'\n },\n\n params: {\n sr: 4326,\n layers: 'all',\n tolerance: 3,\n returnGeometry: true\n },\n\n on: function(map){\n var extent = EsriLeaflet.Util.boundsToExtent(map.getBounds());\n var size = map.getSize();\n this.params.imageDisplay = [size.x, size.y, 96].join(',');\n this.params.mapExtent=([extent.xmin, extent.ymin, extent.xmax, extent.ymax]).join(',');\n return this;\n },\n\n at: function(latlng){\n latlng = L.latLng(latlng);\n this.params.geometry = ([latlng.lng, latlng.lat]).join(',');\n this.params.geometryType = 'esriGeometryPoint';\n return this;\n },\n\n layerDef: function (id, where){\n this.params.layerDefs = (this.params.layerDefs) ? this.params.layerDefs + ';' : '';\n this.params.layerDefs += ([id, where]).join(':');\n return this;\n },\n\n simplify: function(map, factor){\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * (1 - factor);\n return this;\n },\n\n run: function (callback, context){\n return this.request(function(error, response){\n callback.call(context, error, (response && EsriLeaflet.Util.responseToFeatureCollection(response)), response);\n }, context);\n }\n\n});\n\nEsriLeaflet.Tasks.identifyFeatures = function(url, params){\n return new EsriLeaflet.Tasks.IdentifyFeatures(url, params);\n};","(function(EsriLeaflet){\n\n var tileProtocol = (window.location.protocol !== 'https:') ? 'http:' : 'https:';\n\n EsriLeaflet.Layers.BasemapLayer = L.TileLayer.extend({\n statics: {\n TILES: {\n Streets: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}',\n attributionUrl: 'https://static.arcgis.com/attribution/World_Street_Map',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services'],\n attribution: 'Esri'\n }\n },\n Topographic: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}',\n attributionUrl: 'https://static.arcgis.com/attribution/World_Topo_Map',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services'],\n attribution: 'Esri'\n }\n },\n Oceans: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}',\n attributionUrl: 'https://static.arcgis.com/attribution/Ocean_Basemap',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services'],\n attribution: 'Esri'\n }\n },\n OceansLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services']\n }\n },\n NationalGeographic: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services'],\n attribution: 'Esri'\n }\n },\n DarkGray: {\n urlTemplate: tileProtocol + '//tiles{s}.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Dark_Gray_Base_Beta/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 10,\n subdomains: ['1', '2'],\n attribution: 'Esri, DeLorme, HERE'\n }\n },\n DarkGrayLabels: {\n urlTemplate: tileProtocol + '//tiles{s}.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Dark_Gray_Reference_Beta/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 10,\n subdomains: ['1', '2']\n }\n },\n Gray: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services'],\n attribution: 'Esri, NAVTEQ, DeLorme'\n }\n },\n GrayLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 16,\n subdomains: ['server', 'services']\n }\n },\n Imagery: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services'],\n attribution: 'Esri, DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community'\n }\n },\n ImageryLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services']\n }\n },\n ImageryTransportation: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}',\n //pane: 'esri-label',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 19,\n subdomains: ['server', 'services']\n }\n },\n ShadedRelief: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 13,\n subdomains: ['server', 'services'],\n attribution: 'ESRI, NAVTEQ, DeLorme'\n }\n },\n ShadedReliefLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 12,\n subdomains: ['server', 'services']\n }\n },\n Terrain: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: false,\n logoPosition: 'bottomright',\n minZoom: 1,\n maxZoom: 13,\n subdomains: ['server', 'services'],\n attribution: 'Esri, USGS, NOAA'\n }\n },\n TerrainLabels: {\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}',\n options: {\n hideLogo: true,\n logoPosition: 'bottomright',\n //pane: 'esri-label',\n minZoom: 1,\n maxZoom: 13,\n subdomains: ['server', 'services']\n }\n }\n }\n },\n initialize: function(key, options){\n var config;\n\n // set the config variable with the appropriate config object\n if (typeof key === 'object' && key.urlTemplate && key.options){\n config = key;\n } else if(typeof key === 'string' && EsriLeaflet.BasemapLayer.TILES[key]){\n config = EsriLeaflet.BasemapLayer.TILES[key];\n } else {\n 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\"');\n }\n\n // merge passed options into the config options\n var tileOptions = L.Util.extend(config.options, options);\n\n // call the initialize method on L.TileLayer to set everything up\n L.TileLayer.prototype.initialize.call(this, config.urlTemplate, L.Util.setOptions(this, tileOptions));\n\n // if this basemap requires dynamic attribution set it up\n if(config.attributionUrl){\n this._getAttributionData(config.attributionUrl);\n }\n },\n onAdd: function(map){\n if(!this.options.hideLogo){\n this._logo = new EsriLeaflet.Controls.Logo({\n position: this.options.logoPosition\n }).addTo(map);\n }\n\n // if(this.options.pane && EsriLeaflet.Support.pointerEvents){\n // this._initPane();\n // }\n\n L.TileLayer.prototype.onAdd.call(this, map);\n\n map.on('moveend', this._updateMapAttribution, this);\n },\n onRemove: function(map){\n if(this._logo){\n map.removeControl(this._logo);\n }\n\n L.TileLayer.prototype.onRemove.call(this, map);\n\n map.off('moveend', this._updateMapAttribution, this);\n },\n getAttribution:function(){\n var attribution = '' + this.options.attribution + ''/* + logo*/;\n return attribution;\n },\n // _initPane: function(){\n // if(!this._map.getPane(this.options.pane)){\n // var pane = this._map.createPane(this.options.pane);\n // pane.style.pointerEvents = 'none';\n // pane.style.zIndex = 5;\n // }\n // },\n _getAttributionData: function(url){\n EsriLeaflet.get(url, {}, function(error, attributions){\n this._attributions = [];\n for (var c = 0; c < attributions.contributors.length; c++) {\n var contributor = attributions.contributors[c];\n for (var i = 0; i < contributor.coverageAreas.length; i++) {\n var coverageArea = contributor.coverageAreas[i];\n var southWest = new L.LatLng(coverageArea.bbox[0], coverageArea.bbox[1]);\n var northEast = new L.LatLng(coverageArea.bbox[2], coverageArea.bbox[3]);\n this._attributions.push({\n attribution: contributor.attribution,\n score: coverageArea.score,\n bounds: new L.LatLngBounds(southWest, northEast),\n minZoom: coverageArea.zoomMin,\n maxZoom: coverageArea.zoomMax\n });\n }\n }\n\n this._attributions.sort(function(a, b){\n return b.score - a.score;\n });\n\n this._updateMapAttribution();\n }, this);\n },\n _updateMapAttribution: function(){\n if(this._map && this._map.attributionControl && this._attributions){\n var newAttributions = '';\n var bounds = this._map.getBounds();\n var zoom = this._map.getZoom();\n\n for (var i = 0; i < this._attributions.length; i++) {\n var attribution = this._attributions[i];\n var text = attribution.attribution;\n if(!newAttributions.match(text) && bounds.intersects(attribution.bounds) && zoom >= attribution.minZoom && zoom <= attribution.maxZoom) {\n newAttributions += (', ' + text);\n }\n }\n newAttributions = newAttributions.substr(2);\n var attributionElement = this._map.attributionControl._container.querySelector('.esri-attributions');\n attributionElement.innerHTML = newAttributions;\n attributionElement.style.maxWidth = (this._map.getSize().x * 0.65) + 'px';\n this.fire('attributionupdated', {\n attribution: newAttributions\n });\n }\n }\n });\n\n EsriLeaflet.BasemapLayer = EsriLeaflet.Layers.BasemapLayer;\n\n EsriLeaflet.Layers.basemapLayer = function(key, options){\n return new EsriLeaflet.Layers.BasemapLayer(key, options);\n };\n\n EsriLeaflet.basemapLayer = function(key, options){\n return new EsriLeaflet.Layers.BasemapLayer(key, options);\n };\n\n})(EsriLeaflet);","EsriLeaflet.Layers.RasterLayer = L.Class.extend({\n includes: L.Mixin.Events,\n\n options: {\n opacity: 1,\n position: 'front',\n f: 'image'\n },\n\n onAdd: function (map) {\n this._map = map;\n\n this._update = L.Util.limitExecByInterval(this._update, this.options.updateInterval, this);\n\n if (map.options.crs && map.options.crs.code) {\n var sr = map.options.crs.code.split(':')[1];\n this.options.bboxSR = sr;\n this.options.imageSR = sr;\n }\n\n map.on('moveend', this._update, this);\n\n this._update();\n\n if(this._popup){\n this._map.on('click', this._getPopupData, this);\n this._map.on('dblclick', this._resetPopupState, this);\n }\n },\n\n bindPopup: function(fn, popupOptions){\n this._shouldRenderPopup = false;\n this._lastClick = false;\n this._popup = L.popup(popupOptions);\n this._popupFunction = fn;\n if(this._map){\n this._map.on('click', this._getPopupData, this);\n this._map.on('dblclick', this._resetPopupState, this);\n }\n return this;\n },\n\n unbindPopup: function(){\n if(this._map){\n this._map.closePopup(this._popup);\n this._map.off('click', this._getPopupData, this);\n this._map.off('dblclick', this._resetPopupState, this);\n }\n this._popup = false;\n return this;\n },\n\n onRemove: function (map) {\n\n if (this._currentImage) {\n this._map.removeLayer(this._currentImage);\n }\n\n if(this._popup){\n this._map.off('click', this._getPopupData, this);\n this._map.off('dblclick', this._resetPopupState, this);\n }\n\n this._map.off('moveend', this._update, this);\n this._map = null;\n },\n\n addTo: function(map){\n map.addLayer(this);\n return this;\n },\n\n removeFrom: function(map){\n map.removeLayer(this);\n return this;\n },\n\n bringToFront: function(){\n this.options.position = 'front';\n if(this._currentImage){\n this._currentImage.bringToFront();\n }\n return this;\n },\n\n bringToBack: function(){\n this.options.position = 'back';\n if(this._currentImage){\n this._currentImage.bringToBack();\n }\n return this;\n },\n\n getAttribution: function () {\n return this.options.attribution;\n },\n\n getOpacity: function(){\n return this.options.opacity;\n },\n\n setOpacity: function(opacity){\n this.options.opacity = opacity;\n this._currentImage.setOpacity(opacity);\n return this;\n },\n\n getTimeRange: function(){\n return [this.options.from, this.options.to];\n },\n\n setTimeRange: function(from, to){\n this.options.from = from;\n this.options.to = to;\n this._update();\n return this;\n },\n\n metadata: function(callback, context){\n this._service.metadata(callback, context);\n return this;\n },\n\n authenticate: function(token){\n this._service.authenticate(token);\n return this;\n },\n\n _renderImage: function(url, bounds){\n if(this._map){\n var image = new L.ImageOverlay(url, bounds, {\n opacity: 0\n }).addTo(this._map);\n\n image.once('load', function(e){\n var newImage = e.target;\n var oldImage = this._currentImage;\n if(newImage._bounds.equals(bounds)){\n this._currentImage = newImage;\n\n if(this.options.position === 'front'){\n this.bringToFront();\n } else {\n this.bringToBack();\n }\n\n if(this._map && this._currentImage._map){\n this._currentImage.setOpacity(this.options.opacity);\n } else {\n this._currentImage._map.removeLayer(this._currentImage);\n }\n\n if(oldImage){\n this._map.removeLayer(oldImage);\n }\n\n } else {\n this._map.removeLayer(newImage);\n }\n\n this.fire('load', {\n bounds: bounds\n });\n\n }, this);\n\n this.fire('loading', {\n bounds: bounds\n });\n }\n },\n\n _update: function () {\n if(!this._map){\n return;\n }\n\n var zoom = this._map.getZoom();\n var bounds = this._map.getBounds();\n\n if(this._animatingZoom){\n return;\n }\n\n if (this._map._panTransition && this._map._panTransition._inProgress) {\n return;\n }\n\n if (zoom > this.options.maxZoom || zoom < this.options.minZoom) {\n return;\n }\n var params = this._buildExportParams();\n\n this._requestExport(params, bounds);\n },\n\n // TODO: refactor these into raster layer\n _renderPopup: function(latlng, error, results, response){\n latlng = L.latLng(latlng);\n if(this._shouldRenderPopup && this._lastClick.equals(latlng)){\n //add the popup to the map where the mouse was clicked at\n var content = this._popupFunction(error, results, response);\n if (content) {\n this._popup.setLatLng(latlng).setContent(content).openOn(this._map);\n }\n }\n },\n\n _resetPopupState: function(e){\n this._shouldRenderPopup = false;\n this._lastClick = e.latlng;\n },\n\n // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js\n // @TODO remove at Leaflet 0.8\n _propagateEvent: function (e) {\n e = L.extend({\n layer: e.target,\n target: this\n }, e);\n this.fire(e.type, e);\n }\n});","EsriLeaflet.Layers.DynamicMapLayer = EsriLeaflet.Layers.RasterLayer.extend({\n\n options: {\n updateInterval: 150,\n layers: false,\n layerDefs: false,\n timeOptions: false,\n format: 'png24',\n transparent: true\n },\n\n initialize: function (url, options) {\n this.url = EsriLeaflet.Util.cleanUrl(url);\n this._service = new EsriLeaflet.Services.MapService(this.url, options);\n this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', this._propagateEvent, this);\n L.Util.setOptions(this, options);\n },\n\n getLayers: function(){\n return this.options.layers;\n },\n\n setLayers: function(layers){\n this.options.layers = layers;\n this._update();\n return this;\n },\n\n getLayerDefs: function(){\n return this.options.layerDefs;\n },\n\n setLayerDefs: function(layerDefs){\n this.options.layerDefs = layerDefs;\n this._update();\n return this;\n },\n\n getTimeOptions: function(){\n return this.options.timeOptions;\n },\n\n setTimeOptions: function(timeOptions){\n this.options.timeOptions = timeOptions;\n this._update();\n return this;\n },\n\n query: function(){\n return this._service.query();\n },\n\n identify: function(){\n return this._service.identify();\n },\n\n find: function(){\n return this._service.find();\n },\n\n _getPopupData: function(e){\n var callback = L.Util.bind(function(error, featureCollection, response) {\n setTimeout(L.Util.bind(function(){\n this._renderPopup(e.latlng, error, featureCollection, response);\n }, this), 300);\n }, this);\n\n var identifyRequest = this.identify().on(this._map).at(e.latlng);\n\n if(this.options.layers){\n identifyRequest.layers('visible:' + this.options.layers.join(','));\n } else {\n identifyRequest.layers('visible');\n }\n\n identifyRequest.run(callback);\n\n // set the flags to show the popup\n this._shouldRenderPopup = true;\n this._lastClick = e.latlng;\n },\n\n _buildExportParams: function () {\n var bounds = this._map.getBounds();\n var size = this._map.getSize();\n var ne = this._map.options.crs.project(bounds._northEast);\n var sw = this._map.options.crs.project(bounds._southWest);\n\n var params = {\n bbox: [sw.x, sw.y, ne.x, ne.y].join(','),\n size: size.x + ',' + size.y,\n dpi: 96,\n format: this.options.format,\n transparent: this.options.transparent,\n bboxSR: this.options.bboxSR,\n imageSR: this.options.imageSR\n };\n\n if(this.options.layers){\n params.layers = 'show:' + this.options.layers.join(',');\n }\n\n if(this.options.layerDefs){\n params.layerDefs = JSON.stringify(this.options.layerDefs);\n }\n\n if(this.options.timeOptions){\n params.timeOptions = JSON.stringify(this.options.timeOptions);\n }\n\n if(this.options.from && this.options.to){\n params.time = this.options.from.valueOf() + ',' + this.options.to.valueOf();\n }\n\n if(this._service.options.token) {\n params.token = this._service.options.token;\n }\n\n return params;\n },\n\n _requestExport: function (params, bounds) {\n if(this.options.f === 'json'){\n this._service.get('export', params, function(error, response){\n this._renderImage(response.href, bounds);\n }, this);\n } else {\n params.f = 'image';\n this._renderImage(this.url + 'export' + L.Util.getParamString(params), bounds);\n }\n }\n});\n\nEsriLeaflet.DynamicMapLayer = EsriLeaflet.Layers.DynamicMapLayer;\n\nEsriLeaflet.Layers.dynamicMapLayer = function(url, options){\n return new EsriLeaflet.Layers.DynamicMapLayer(url, options);\n};\n\nEsriLeaflet.dynamicMapLayer = function(url, options){\n return new EsriLeaflet.Layers.DynamicMapLayer(url, options);\n};","EsriLeaflet.Layers.ImageMapLayer = EsriLeaflet.Layers.RasterLayer.extend({\n\n options: {\n updateInterval: 150,\n format: 'jpgpng'\n },\n\n query: function(){\n return this._service.query();\n },\n\n identify: function(){\n return this._service.identify();\n },\n\n initialize: function (url, options) {\n this.url = EsriLeaflet.Util.cleanUrl(url);\n this._service = new EsriLeaflet.Services.ImageService(this.url, options);\n this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', this._propagateEvent, this);\n L.Util.setOptions(this, options);\n },\n\n setPixelType: function (pixelType) {\n this.options.pixelType = pixelType;\n this._update();\n return this;\n },\n\n getPixelType: function () {\n return this.options.pixelType;\n },\n\n setBandIds: function (bandIds) {\n if (L.Util.isArray(bandIds)) {\n this.options.bandIds = bandIds.join(',');\n } else {\n this.options.bandIds = bandIds.toString();\n }\n this._update();\n return this;\n },\n\n getBandIds: function () {\n return this.options.bandIds;\n },\n\n setNoData: function (noData, noDataInterpretation) {\n if (L.Util.isArray(noData)) {\n this.options.noData = noData.join(',');\n } else {\n this.options.noData = noData.toString();\n }\n if (noDataInterpretation) {\n this.options.noDataInterpretation = noDataInterpretation;\n }\n this._update();\n return this;\n },\n\n getNoData: function () {\n return this.options.noData;\n },\n\n getNoDataInterpretation: function () {\n return this.options.noDataInterpretation;\n },\n\n setRenderingRule: function(renderingRule) {\n this.options.renderingRule = renderingRule;\n this._update();\n },\n\n getRenderingRule: function() {\n return this.options.renderingRule;\n },\n\n setMosaicRule: function(mosaicRule) {\n this.options.mosaicRule = mosaicRule;\n this._update();\n },\n\n getMosaicRule: function() {\n return this.options.mosaicRule;\n },\n\n _getPopupData: function(e){\n var callback = L.Util.bind(function(error, results, response) {\n setTimeout(L.Util.bind(function(){\n this._renderPopup(e.latlng, error, results, response);\n }, this), 300);\n }, this);\n\n var identifyRequest = this.identify().at(e.latlng);\n\n // set mosaic rule for identify task if it is set for layer\n if (this.options.mosaicRule) {\n identifyRequest.setMosaicRule(this.options.mosaicRule);\n // @TODO: force return catalog items too?\n }\n\n // @TODO: set rendering rule? Not sure,\n // sometimes you want raw pixel values\n // if (this.options.renderingRule) {\n // identifyRequest.setRenderingRule(this.options.renderingRule);\n // }\n\n identifyRequest.run(callback);\n\n // set the flags to show the popup\n this._shouldRenderPopup = true;\n this._lastClick = e.latlng;\n },\n\n _buildExportParams: function () {\n var bounds = this._map.getBounds();\n var size = this._map.getSize();\n var ne = this._map.options.crs.project(bounds._northEast);\n var sw = this._map.options.crs.project(bounds._southWest);\n\n var params = {\n bbox: [sw.x, sw.y, ne.x, ne.y].join(','),\n size: size.x + ',' + size.y,\n format: this.options.format,\n bboxSR: this.options.bboxSR,\n imageSR: this.options.imageSR\n };\n\n if (this.options.from && this.options.to) {\n params.time = this.options.from.valueOf() + ',' + this.options.to.valueOf();\n }\n\n if (this.options.pixelType) {\n params.pixelType = this.options.pixelType;\n }\n\n if (this.options.interpolation) {\n params.interpolation = this.options.interpolation;\n }\n\n if (this.options.compressionQuality) {\n params.compressionQuality = this.options.compressionQuality;\n }\n\n if (this.options.bandIds) {\n params.bandIds = this.options.bandIds;\n }\n\n if (this.options.noData) {\n params.noData = this.options.noData;\n }\n\n if (this.options.noDataInterpretation) {\n params.noDataInterpretation = this.options.noDataInterpretation;\n }\n\n if (this._service.options.token) {\n params.token = this._service.options.token;\n }\n\n if(this.options.renderingRule) {\n params.renderingRule = JSON.stringify(this.options.renderingRule);\n }\n\n if(this.options.mosaicRule) {\n params.mosaicRule = JSON.stringify(this.options.mosaicRule);\n }\n\n return params;\n },\n\n _requestExport: function (params, bounds) {\n if (this.options.f === 'json') {\n this._service.get('exportImage', params, function(error, response){\n this._renderImage(response.href, bounds);\n }, this);\n } else {\n params.f = 'image';\n this._renderImage(this.url + 'exportImage' + L.Util.getParamString(params), bounds);\n }\n }\n});\n\nEsriLeaflet.ImageMapLayer = EsriLeaflet.Layers.ImageMapLayer;\n\nEsriLeaflet.Layers.imageMapLayer = function (url, options) {\n return new EsriLeaflet.Layers.ImageMapLayer(url, options);\n};\n\nEsriLeaflet.imageMapLayer = function (url, options) {\n return new EsriLeaflet.Layers.ImageMapLayer(url, options);\n};","EsriLeaflet.Layers.TiledMapLayer = L.TileLayer.extend({\n initialize: function(url, options){\n options = L.Util.setOptions(this, options);\n\n // set the urls\n this.url = L.esri.Util.cleanUrl(url);\n this.tileUrl = L.esri.Util.cleanUrl(url) + 'tile/{z}/{y}/{x}';\n this._service = new L.esri.Services.MapService(this.url, options);\n this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', this._propagateEvent, this);\n\n //if this is looking at the AGO tiles subdomain insert the subdomain placeholder\n if(this.tileUrl.match('://tiles.arcgisonline.com')){\n this.tileUrl = this.tileUrl.replace('://tiles.arcgisonline.com', '://tiles{s}.arcgisonline.com');\n options.subdomains = ['1', '2', '3', '4'];\n }\n\n if(this.options.token) {\n this.tileUrl += ('?token=' + this.options.token);\n }\n\n // init layer by calling TileLayers initialize method\n L.TileLayer.prototype.initialize.call(this, this.tileUrl, options);\n },\n\n metadata: function(callback, context){\n this._service.metadata(callback, context);\n return this;\n },\n\n identify: function(){\n return this._service.identify();\n },\n\n authenticate: function(token){\n var tokenQs = '?token=' + token;\n this.tileUrl = (this.options.token) ? this.tileUrl.replace(/\\?token=(.+)/g, tokenQs) : this.tileUrl + tokenQs;\n this.options.token = token;\n this._service.authenticate(token);\n return this;\n },\n\n // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js\n // @TODO remove at Leaflet 0.8\n _propagateEvent: function (e) {\n e = L.extend({\n layer: e.target,\n target: this\n }, e);\n this.fire(e.type, e);\n }\n});\n\nL.esri.TiledMapLayer = L.esri.Layers.tiledMapLayer;\n\nL.esri.Layers.tiledMapLayer = function(url, options){\n return new L.esri.Layers.TiledMapLayer(url, options);\n};\n\nL.esri.tiledMapLayer = function(url, options){\n return new L.esri.Layers.TiledMapLayer(url, options);\n};","EsriLeaflet.Layers.FeatureGrid = L.Class.extend({\n\n includes: L.Mixin.Events,\n\n options: {\n cellSize: 512,\n updateInterval: 150\n },\n\n initialize: function (options) {\n options = L.setOptions(this, options);\n },\n\n onAdd: function (map) {\n this._map = map;\n this._update = L.Util.limitExecByInterval(this._update, this.options.updateInterval, this);\n\n // @TODO remove for leaflet 0.8\n this._map.addEventListener(this.getEvents(), this);\n\n this._reset();\n this._update();\n },\n\n onRemove: function(){\n this._map.removeEventListener(this.getEvents(), this);\n this._removeCells();\n },\n\n getEvents: function () {\n var events = {\n viewreset: this._reset,\n moveend: this._update\n };\n\n return events;\n },\n\n addTo: function(map){\n map.addLayer(this);\n return this;\n },\n\n removeFrom: function(map){\n map.removeLayer(this);\n return this;\n },\n\n _reset: function () {\n this._removeCells();\n\n this._cells = {};\n this._activeCells = {};\n this._cellsToLoad = 0;\n this._cellsTotal = 0;\n\n // @TODO enable at Leaflet 0.8\n // this._cellNumBounds = this._getCellNumBounds();\n\n this._resetWrap();\n },\n\n _resetWrap: function () {\n var map = this._map,\n crs = map.options.crs;\n\n if (crs.infinite) { return; }\n\n var cellSize = this._getCellSize();\n\n if (crs.wrapLng) {\n this._wrapLng = [\n Math.floor(map.project([0, crs.wrapLng[0]]).x / cellSize),\n Math.ceil(map.project([0, crs.wrapLng[1]]).x / cellSize)\n ];\n }\n\n if (crs.wrapLat) {\n this._wrapLat = [\n Math.floor(map.project([crs.wrapLat[0], 0]).y / cellSize),\n Math.ceil(map.project([crs.wrapLat[1], 0]).y / cellSize)\n ];\n }\n },\n\n _getCellSize: function () {\n return this.options.cellSize;\n },\n\n _update: function () {\n if (!this._map) { return; }\n\n var bounds = this._map.getPixelBounds(),\n zoom = this._map.getZoom(),\n cellSize = this._getCellSize();\n\n if (zoom > this.options.maxZoom ||\n zoom < this.options.minZoom) { return; }\n\n // cell coordinates range for the current view\n var cellBounds = L.bounds(\n bounds.min.divideBy(cellSize).floor(),\n bounds.max.divideBy(cellSize).floor());\n\n this._addCells(cellBounds);\n this._removeOtherCells(cellBounds);\n },\n\n _addCells: function (bounds) {\n var queue = [],\n center = bounds.getCenter(),\n zoom = this._map.getZoom();\n\n var j, i, coords;\n // create a queue of coordinates to load cells from\n for (j = bounds.min.y; j <= bounds.max.y; j++) {\n for (i = bounds.min.x; i <= bounds.max.x; i++) {\n coords = new L.Point(i, j);\n coords.z = zoom;\n\n // @TODO enable at Leaflet 0.8\n // if (this._isValidCell(coords)) {\n // queue.push(coords);\n // }\n\n queue.push(coords);\n }\n }\n var cellsToLoad = queue.length;\n\n if (cellsToLoad === 0) { return; }\n\n this._cellsToLoad += cellsToLoad;\n this._cellsTotal += cellsToLoad;\n\n // sort cell queue to load cells in order of their distance to center\n queue.sort(function (a, b) {\n return a.distanceTo(center) - b.distanceTo(center);\n });\n\n for (i = 0; i < cellsToLoad; i++) {\n this._addCell(queue[i]);\n }\n },\n\n // @TODO enable at Leaflet 0.8\n // _isValidCell: function (coords) {\n // var crs = this._map.options.crs;\n\n // if (!crs.infinite) {\n // // don't load cell if it's out of bounds and not wrapped\n // var bounds = this._cellNumBounds;\n // if (\n // (!crs.wrapLng && (coords.x < bounds.min.x || coords.x > bounds.max.x)) ||\n // (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y))\n // ) {\n // return false;\n // }\n // }\n\n // if (!this.options.bounds) {\n // return true;\n // }\n\n // // don't load cell if it doesn't intersect the bounds in options\n // var cellBounds = this._cellCoordsToBounds(coords);\n // return L.latLngBounds(this.options.bounds).intersects(cellBounds);\n // },\n\n // converts cell coordinates to its geographical bounds\n _cellCoordsToBounds: function (coords) {\n var map = this._map,\n cellSize = this.options.cellSize,\n\n nwPoint = coords.multiplyBy(cellSize),\n sePoint = nwPoint.add([cellSize, cellSize]),\n\n // @TODO for Leaflet 0.8\n // nw = map.wrapLatLng(map.unproject(nwPoint, coords.z)),\n // se = map.wrapLatLng(map.unproject(sePoint, coords.z));\n\n nw = map.unproject(nwPoint, coords.z).wrap(),\n se = map.unproject(sePoint, coords.z).wrap();\n\n return new L.LatLngBounds(nw, se);\n },\n\n // converts cell coordinates to key for the cell cache\n _cellCoordsToKey: function (coords) {\n return coords.x + ':' + coords.y;\n },\n\n // converts cell cache key to coordiantes\n _keyToCellCoords: function (key) {\n var kArr = key.split(':'),\n x = parseInt(kArr[0], 10),\n y = parseInt(kArr[1], 10);\n\n return new L.Point(x, y);\n },\n\n // remove any present cells that are off the specified bounds\n _removeOtherCells: function (bounds) {\n for (var key in this._cells) {\n if (!bounds.contains(this._keyToCellCoords(key))) {\n this._removeCell(key);\n }\n }\n },\n\n _removeCell: function (key) {\n var cell = this._activeCells[key];\n if(cell){\n delete this._activeCells[key];\n\n if (this.cellLeave) {\n this.cellLeave(cell.bounds, cell.coords);\n }\n\n this.fire('cellleave', {\n bounds: cell.bounds,\n coords: cell.coords\n });\n }\n },\n\n _removeCells: function(){\n for (var key in this._cells) {\n var bounds = this._cells[key].bounds;\n var coords = this._cells[key].coords;\n\n if (this.cellLeave) {\n this.cellLeave(bounds, coords);\n }\n\n this.fire('cellleave', {\n bounds: bounds,\n coords: coords\n });\n }\n },\n\n _addCell: function (coords) {\n\n // wrap cell coords if necessary (depending on CRS)\n this._wrapCoords(coords);\n\n // generate the cell key\n var key = this._cellCoordsToKey(coords);\n\n // get the cell from the cache\n var cell = this._cells[key];\n // if this cell should be shown as isnt active yet (enter)\n\n if (cell && !this._activeCells[key]) {\n if (this.cellEnter) {\n this.cellEnter(cell.bounds, coords);\n }\n\n this.fire('cellenter', {\n bounds: cell.bounds,\n coords: coords\n });\n\n this._activeCells[key] = cell;\n }\n\n // if we dont have this cell in the cache yet (create)\n if (!cell) {\n cell = {\n coords: coords,\n bounds: this._cellCoordsToBounds(coords)\n };\n\n this._cells[key] = cell;\n this._activeCells[key] = cell;\n\n if(this.createCell){\n this.createCell(cell.bounds, coords);\n }\n\n this.fire('cellcreate', {\n bounds: cell.bounds,\n coords: coords\n });\n }\n },\n\n _wrapCoords: function (coords) {\n coords.x = this._wrapLng ? L.Util.wrapNum(coords.x, this._wrapLng) : coords.x;\n coords.y = this._wrapLat ? L.Util.wrapNum(coords.y, this._wrapLat) : coords.y;\n }\n\n // get the global cell coordinates range for the current zoom\n // @TODO enable at Leaflet 0.8\n // _getCellNumBounds: function () {\n // // @TODO for Leaflet 0.8\n // // var bounds = this._map.getPixelWorldBounds(),\n // // size = this._getCellSize();\n // //\n // // return bounds ? L.bounds(\n // // bounds.min.divideBy(size).floor(),\n // // bounds.max.divideBy(size).ceil().subtract([1, 1])) : null;\n // }\n\n});","(function(EsriLeaflet){\n\n EsriLeaflet.Layers.FeatureManager = EsriLeaflet.Layers.FeatureGrid.extend({\n\n /**\n * Options\n */\n\n options: {\n where: '1=1',\n fields: ['*'],\n from: false,\n to: false,\n timeField: false,\n timeFilterMode: 'server',\n simplifyFactor: 0,\n precision: 6\n },\n\n /**\n * Constructor\n */\n\n initialize: function (url, options) {\n EsriLeaflet.Layers.FeatureGrid.prototype.initialize.call(this, options);\n\n options = L.setOptions(this, options);\n\n this.url = EsriLeaflet.Util.cleanUrl(url);\n\n this._service = new EsriLeaflet.Services.FeatureLayer(this.url, options);\n\n //use case insensitive regex to look for common fieldnames used for indexing\n /*global console */\n if (this.options.fields[0] !== '*'){\n var oidCheck = false;\n for (var i = 0; i < this.options.fields.length; i++){\n if (this.options.fields[i].match(/^(OBJECTID|FID|OID|ID)$/i)){\n oidCheck = true;\n }\n }\n if (oidCheck === false && console && console.warn){\n console.warn('no known esriFieldTypeOID field detected in fields Array. Please add an attribute field containing unique IDs to ensure the layer can be drawn correctly.');\n }\n }\n\n // Leaflet 0.8 change to new propagation\n this._service.on('authenticationrequired requeststart requestend requesterror requestsuccess', function (e) {\n e = L.extend({\n target: this\n }, e);\n this.fire(e.type, e);\n }, this);\n\n if(this.options.timeField.start && this.options.timeField.end){\n this._startTimeIndex = new BinarySearchIndex();\n this._endTimeIndex = new BinarySearchIndex();\n } else if(this.options.timeField){\n this._timeIndex = new BinarySearchIndex();\n }\n\n this._currentSnapshot = []; // cache of what layers should be active\n this._activeRequests = 0;\n this._pendingRequests = [];\n },\n\n /**\n * Layer Interface\n */\n\n onAdd: function(map){\n return EsriLeaflet.Layers.FeatureGrid.prototype.onAdd.call(this, map);\n },\n\n onRemove: function(map){\n return EsriLeaflet.Layers.FeatureGrid.prototype.onRemove.call(this, map);\n },\n\n getAttribution: function () {\n return this.options.attribution;\n },\n\n /**\n * Feature Managment\n */\n\n createCell: function(bounds, coords){\n this._requestFeatures(bounds, coords);\n },\n\n _requestFeatures: function(bounds, coords, callback){\n this._activeRequests++;\n\n // our first active request fires loading\n if(this._activeRequests === 1){\n this.fire('loading', {\n bounds: bounds\n });\n }\n\n return this._buildQuery(bounds).run(function(error, featureCollection, response){\n if(response && response.exceededTransferLimit){\n this.fire('drawlimitexceeded');\n }\n\n //deincriment the request counter\n this._activeRequests--;\n\n if(!error && featureCollection.features.length){\n this._addFeatures(featureCollection.features, coords);\n }\n\n if(callback){\n callback.call(this, error, featureCollection);\n }\n\n // if there are no more active requests fire a load event for this view\n if(this._activeRequests <= 0){\n this.fire('load', {\n bounds: bounds\n });\n }\n }, this);\n },\n\n _addFeatures: function(features){\n for (var i = features.length - 1; i >= 0; i--) {\n var id = features[i].id;\n this._currentSnapshot.push(id);\n }\n\n if(this.options.timeField){\n this._buildTimeIndexes(features);\n }\n\n this.createLayers(features);\n },\n\n _buildQuery: function(bounds){\n var query = this._service.query().intersects(bounds).where(this.options.where).fields(this.options.fields).precision(this.options.precision);\n\n if(this.options.simplifyFactor){\n query.simplify(this._map, this.options.simplifyFactor);\n }\n\n if(this.options.timeFilterMode === 'server' && this.options.from && this.options.to){\n query.between(this.options.from, this.options.to);\n }\n\n return query;\n },\n\n /**\n * Where Methods\n */\n\n setWhere: function(where, callback, context){\n\n this.options.where = (where && where.length) ? where : '1=1';\n\n var oldSnapshot = [];\n var newShapshot = [];\n var pendingRequests = 0;\n var requestError = null;\n var requestCallback = L.Util.bind(function(error, featureCollection){\n if(error){\n requestError = error;\n }\n\n if(featureCollection){\n for (var i = featureCollection.features.length - 1; i >= 0; i--) {\n newShapshot.push(featureCollection.features[i].id);\n }\n }\n\n pendingRequests--;\n\n if(pendingRequests <= 0){\n this._currentSnapshot = newShapshot;\n this.removeLayers(oldSnapshot);\n this.addLayers(newShapshot);\n if(callback) {\n callback.call(context, requestError);\n }\n }\n }, this);\n\n for (var i = this._currentSnapshot.length - 1; i >= 0; i--) {\n oldSnapshot.push(this._currentSnapshot[i]);\n }\n\n for(var key in this._activeCells){\n pendingRequests++;\n var coords = this._keyToCellCoords(key);\n var bounds = this._cellCoordsToBounds(coords);\n this._requestFeatures(bounds, key, requestCallback);\n }\n\n return this;\n },\n\n getWhere: function(){\n return this.options.where;\n },\n\n /**\n * Time Range Methods\n */\n\n getTimeRange: function(){\n return [this.options.from, this.options.to];\n },\n\n setTimeRange: function(from, to, callback, context){\n var oldFrom = this.options.from;\n var oldTo = this.options.to;\n var pendingRequests = 0;\n var requestError = null;\n var requestCallback = L.Util.bind(function(error){\n if(error){\n requestError = error;\n }\n this._filterExistingFeatures(oldFrom, oldTo, from, to);\n\n pendingRequests--;\n\n if(callback && pendingRequests <= 0){\n callback.call(context, requestError);\n }\n }, this);\n\n this.options.from = from;\n this.options.to = to;\n\n this._filterExistingFeatures(oldFrom, oldTo, from, to);\n\n if(this.options.timeFilterMode === 'server') {\n for(var key in this._activeCells){\n pendingRequests++;\n var coords = this._keyToCellCoords(key);\n var bounds = this._cellCoordsToBounds(coords);\n this._requestFeatures(bounds, key, requestCallback);\n }\n }\n },\n\n refresh: function(){\n for(var key in this._activeCells){\n var coords = this._keyToCellCoords(key);\n var bounds = this._cellCoordsToBounds(coords);\n this._requestFeatures(bounds, key);\n }\n },\n\n _filterExistingFeatures: function (oldFrom, oldTo, newFrom, newTo) {\n var layersToRemove = (oldFrom && oldTo) ? this._getFeaturesInTimeRange(oldFrom, oldTo) : this._currentSnapshot;\n var layersToAdd = this._getFeaturesInTimeRange(newFrom, newTo);\n\n if(layersToAdd.indexOf){\n for (var i = 0; i < layersToAdd.length; i++) {\n var shouldRemoveLayer = layersToRemove.indexOf(layersToAdd[i]);\n if(shouldRemoveLayer >= 0){\n layersToRemove.splice(shouldRemoveLayer, 1);\n }\n }\n }\n\n this.removeLayers(layersToRemove);\n this.addLayers(layersToAdd);\n },\n\n _getFeaturesInTimeRange: function(start, end){\n var ids = [];\n var search;\n\n if(this.options.timeField.start && this.options.timeField.end){\n var startTimes = this._startTimeIndex.between(start, end);\n var endTimes = this._endTimeIndex.between(start, end);\n search = startTimes.concat(endTimes);\n } else {\n search = this._timeIndex.between(start, end);\n }\n\n for (var i = search.length - 1; i >= 0; i--) {\n ids.push(search[i].id);\n }\n\n return ids;\n },\n\n _buildTimeIndexes: function(geojson){\n var i;\n var feature;\n if(this.options.timeField.start && this.options.timeField.end){\n var startTimeEntries = [];\n var endTimeEntries = [];\n for (i = geojson.length - 1; i >= 0; i--) {\n feature = geojson[i];\n startTimeEntries.push( {\n id: feature.id,\n value: new Date(feature.properties[this.options.timeField.start])\n });\n endTimeEntries.push( {\n id: feature.id,\n value: new Date(feature.properties[this.options.timeField.end])\n });\n }\n this._startTimeIndex.bulkAdd(startTimeEntries);\n this._endTimeIndex.bulkAdd(endTimeEntries);\n } else {\n var timeEntries = [];\n for (i = geojson.length - 1; i >= 0; i--) {\n feature = geojson[i];\n timeEntries.push( {\n id: feature.id,\n value: new Date(feature.properties[this.options.timeField])\n });\n }\n\n this._timeIndex.bulkAdd(timeEntries);\n }\n },\n\n _featureWithinTimeRange: function(feature){\n if(!this.options.from || !this.options.to){\n return true;\n }\n\n var from = +this.options.from.valueOf();\n var to = +this.options.to.valueOf();\n\n if(typeof this.options.timeField === 'string'){\n var date = +feature.properties[this.options.timeField];\n return (date >= from) && (date <= to);\n }\n\n if(this.options.timeField.start && this.options.timeField.end){\n var startDate = +feature.properties[this.options.timeField.start];\n var endDate = +feature.properties[this.options.timeField.end];\n return ((startDate >= from) && (startDate <= to)) || ((endDate >= from) && (endDate <= to));\n }\n },\n\n /**\n * Service Methods\n */\n\n authenticate: function(token){\n this._service.authenticate(token);\n return this;\n },\n\n metadata: function(callback, context){\n this._service.metadata(callback, context);\n return this;\n },\n\n query: function(){\n return this._service.query();\n },\n\n addFeature: function(feature, callback, context){\n this._service.addFeature(feature, function(error, response){\n if(!error){\n this.refresh();\n }\n if(callback){\n callback.call(context, error, response);\n }\n }, this);\n return this;\n },\n\n updateFeature: function(feature, callback, context){\n return this._service.updateFeature(feature, function(error, response){\n if(!error){\n this.refresh();\n }\n if(callback){\n callback.call(context, error, response);\n }\n }, this);\n },\n\n deleteFeature: function(id, callback, context){\n return this._service.deleteFeature(id, function(error, response){\n if(!error && response.objectId){\n this.removeLayers([response.objectId], true);\n }\n if(callback){\n callback.call(context, error, response);\n }\n }, this);\n }\n });\n\n /**\n * Temporal Binary Search Index\n */\n\n function BinarySearchIndex(values) {\n this.values = values || [];\n }\n\n BinarySearchIndex.prototype._query = function(query){\n var minIndex = 0;\n var maxIndex = this.values.length - 1;\n var currentIndex;\n var currentElement;\n var resultIndex;\n\n while (minIndex <= maxIndex) {\n resultIndex = currentIndex = (minIndex + maxIndex) / 2 | 0;\n currentElement = this.values[Math.round(currentIndex)];\n if (+currentElement.value < +query) {\n minIndex = currentIndex + 1;\n } else if (+currentElement.value > +query) {\n maxIndex = currentIndex - 1;\n } else {\n return currentIndex;\n }\n }\n\n return ~maxIndex;\n };\n\n BinarySearchIndex.prototype.sort = function(){\n this.values.sort(function(a, b) {\n return +b.value - +a.value;\n }).reverse();\n this.dirty = false;\n };\n\n BinarySearchIndex.prototype.between = function(start, end){\n if(this.dirty){\n this.sort();\n }\n\n var startIndex = this._query(start);\n var endIndex = this._query(end);\n\n if(startIndex === 0 && endIndex === 0){\n return [];\n }\n\n startIndex = Math.abs(startIndex);\n endIndex = (endIndex < 0) ? Math.abs(endIndex): endIndex + 1;\n\n return this.values.slice(startIndex, endIndex);\n };\n\n BinarySearchIndex.prototype.bulkAdd = function(items){\n this.dirty = true;\n this.values = this.values.concat(items);\n };\n\n})(EsriLeaflet);","EsriLeaflet.Layers.FeatureLayer = EsriLeaflet.Layers.FeatureManager.extend({\n\n statics: {\n EVENTS: 'click dblclick mouseover mouseout mousemove contextmenu popupopen popupclose'\n },\n\n /**\n * Constructor\n */\n\n initialize: function (url, options) {\n EsriLeaflet.Layers.FeatureManager.prototype.initialize.call(this, url, options);\n\n options = L.setOptions(this, options);\n\n this._layers = {};\n this._leafletIds = {};\n this._key = 'c'+(Math.random() * 1e9).toString(36).replace('.', '_');\n },\n\n /**\n * Layer Interface\n */\n\n onAdd: function(map){\n return EsriLeaflet.Layers.FeatureManager.prototype.onAdd.call(this, map);\n },\n\n onRemove: function(map){\n\n for (var i in this._layers) {\n map.removeLayer(this._layers[i]);\n }\n\n return EsriLeaflet.Layers.FeatureManager.prototype.onRemove.call(this, map);\n },\n\n createNewLayer: function(geojson){\n // @TODO Leaflet 0.8\n //newLayer = L.GeoJSON.geometryToLayer(geojson, this.options);\n return L.GeoJSON.geometryToLayer(geojson, this.options.pointToLayer, L.GeoJSON.coordsToLatLng, this.options);\n },\n\n /**\n * Feature Managment Methods\n */\n\n createLayers: function(features){\n for (var i = features.length - 1; i >= 0; i--) {\n\n var geojson = features[i];\n\n var layer = this._layers[geojson.id];\n var newLayer;\n\n if(layer && !this._map.hasLayer(layer)){\n this._map.addLayer(layer);\n }\n\n if (layer && layer.setLatLngs) {\n // @TODO Leaflet 0.8\n //newLayer = L.GeoJSON.geometryToLayer(geojson, this.options);\n\n var updateGeo = this.createNewLayer(geojson);\n layer.setLatLngs(updateGeo.getLatLngs());\n }\n\n if(!layer){\n // @TODO Leaflet 0.8\n //newLayer = L.GeoJSON.geometryToLayer(geojson, this.options);\n\n newLayer = this.createNewLayer(geojson);\n newLayer.feature = geojson;\n newLayer.defaultOptions = newLayer.options;\n newLayer._leaflet_id = this._key + '_' + geojson.id;\n\n this._leafletIds[newLayer._leaflet_id] = geojson.id;\n\n // bubble events from layers to this\n // @TODO Leaflet 0.8\n // newLayer.addEventParent(this);\n\n newLayer.on(EsriLeaflet.Layers.FeatureLayer.EVENTS, this._propagateEvent, this);\n\n // bind a popup if we have one\n if(this._popup && newLayer.bindPopup){\n newLayer.bindPopup(this._popup(newLayer.feature, newLayer), this._popupOptions);\n }\n\n if(this.options.onEachFeature){\n this.options.onEachFeature(newLayer.feature, newLayer);\n }\n\n // cache the layer\n this._layers[newLayer.feature.id] = newLayer;\n\n // style the layer\n this.resetStyle(newLayer.feature.id);\n\n this.fire('createfeature', {\n feature: newLayer.feature\n });\n\n // add the layer if it is within the time bounds or our layer is not time enabled\n if(!this.options.timeField || (this.options.timeField && this._featureWithinTimeRange(geojson)) ){\n this._map.addLayer(newLayer);\n }\n }\n }\n },\n\n addLayers: function(ids){\n for (var i = ids.length - 1; i >= 0; i--) {\n var layer = this._layers[ids[i]];\n if(layer){\n this.fire('addfeature', {\n feature: layer.feature\n });\n this._map.addLayer(layer);\n }\n }\n },\n\n removeLayers: function(ids, permanent){\n for (var i = ids.length - 1; i >= 0; i--) {\n var id = ids[i];\n var layer = this._layers[id];\n if(layer){\n this.fire('removefeature', {\n feature: layer.feature,\n permanent: permanent\n });\n this._map.removeLayer(layer);\n }\n if(layer && permanent){\n delete this._layers[id];\n }\n }\n },\n\n /**\n * Styling Methods\n */\n\n resetStyle: function (id) {\n var layer = this._layers[id];\n\n if(layer){\n layer.options = layer.defaultOptions;\n this.setFeatureStyle(layer.feature.id, this.options.style);\n }\n\n return this;\n },\n\n setStyle: function (style) {\n this.options.style = style;\n this.eachFeature(function (layer) {\n this.setFeatureStyle(layer.feature.id, style);\n }, this);\n return this;\n },\n\n setFeatureStyle: function (id, style) {\n var layer = this._layers[id];\n\n if (typeof style === 'function') {\n style = style(layer.feature);\n }\n if (layer.setStyle) {\n layer.setStyle(style);\n }\n },\n\n /**\n * Popup Methods\n */\n\n bindPopup: function (fn, options) {\n this._popup = fn;\n this._popupOptions = options;\n for (var i in this._layers) {\n var layer = this._layers[i];\n var popupContent = this._popup(layer.feature, layer);\n layer.bindPopup(popupContent, options);\n }\n return this;\n },\n\n unbindPopup: function () {\n this._popup = false;\n for (var i in this._layers) {\n var layer = this._layers[i];\n if (layer.unbindPopup) {\n layer.unbindPopup();\n } else if (layer.getLayers) {\n var groupLayers = layer.getLayers();\n for (var j in groupLayers) {\n var gLayer = groupLayers[j];\n gLayer.unbindPopup();\n }\n }\n }\n return this;\n },\n\n /**\n * Utility Methods\n */\n\n eachFeature: function (fn, context) {\n for (var i in this._layers) {\n fn.call(context, this._layers[i]);\n }\n return this;\n },\n\n getFeature: function (id) {\n return this._layers[id];\n },\n\n // from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js\n // @TODO remove at Leaflet 0.8\n _propagateEvent: function (e) {\n e.layer = this._layers[this._leafletIds[e.target._leaflet_id]];\n e.target = this;\n this.fire(e.type, e);\n }\n});\n\nEsriLeaflet.FeatureLayer = EsriLeaflet.Layers.FeatureLayer;\n\nEsriLeaflet.Layers.featureLayer = function(url, options){\n return new EsriLeaflet.Layers.FeatureLayer(url, options);\n};\n\nEsriLeaflet.featureLayer = function(url, options){\n return new EsriLeaflet.Layers.FeatureLayer(url, options);\n};\n","EsriLeaflet.Controls.Logo = L.Control.extend({\n options: {\n position: 'bottomright',\n marginTop: 0,\n marginLeft: 0,\n marginBottom: 0,\n marginRight: 0\n },\n onAdd: function () {\n var div = L.DomUtil.create('div', 'esri-leaflet-logo');\n div.style.marginTop = this.options.marginTop;\n div.style.marginLeft = this.options.marginLeft;\n div.style.marginBottom = this.options.marginBottom;\n div.style.marginRight = this.options.marginRight;\n div.innerHTML = '';\n return div;\n }\n});\n\nEsriLeaflet.Controls.logo = function(options){\n return new L.esri.Controls.Logo(options);\n};\n"]} \ No newline at end of file