From 0fd816e3797b8d9128c5c39f2c6e2d61da5e15d9 Mon Sep 17 00:00:00 2001 From: Gavin Rehkemper Date: Mon, 27 Nov 2023 08:35:27 -0600 Subject: [PATCH] build 3.0.12 --- dist/esri-leaflet-debug.js | 5000 ++++++++++++++++++++++++++++++++ dist/esri-leaflet-debug.js.map | 1 + dist/esri-leaflet.js | 12 + dist/esri-leaflet.js.map | 1 + dist/siteData.json | 1 + 5 files changed, 5015 insertions(+) create mode 100644 dist/esri-leaflet-debug.js create mode 100644 dist/esri-leaflet-debug.js.map create mode 100644 dist/esri-leaflet.js create mode 100644 dist/esri-leaflet.js.map create mode 100644 dist/siteData.json diff --git a/dist/esri-leaflet-debug.js b/dist/esri-leaflet-debug.js new file mode 100644 index 000000000..e33c7e0ac --- /dev/null +++ b/dist/esri-leaflet-debug.js @@ -0,0 +1,5000 @@ +/* esri-leaflet - v3.0.12 - Mon Nov 27 2023 08:34:49 GMT-0600 (Central Standard Time) + * Copyright (c) 2023 Environmental Systems Research Institute, Inc. + * Apache-2.0 */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('leaflet')) : + typeof define === 'function' && define.amd ? define(['exports', 'leaflet'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.L = global.L || {}, global.L.esri = {}), global.L)); +})(this, (function (exports, leaflet) { 'use strict'; + + var name = "esri-leaflet"; + var description = "Leaflet plugins for consuming ArcGIS Online and ArcGIS Server services."; + var version$1 = "3.0.12"; + var author = "Patrick Arlt (http://patrickarlt.com)"; + var bugs = { + url: "https://github.com/esri/esri-leaflet/issues" + }; + var contributors = [ + "Patrick Arlt (http://patrickarlt.com)", + "John Gravois (https://johngravois.com)", + "Gavin Rehkemper (https://gavinr.com)", + "Jacob Wasilkowski (https://jwasilgeo.github.io)" + ]; + var dependencies = { + "@terraformer/arcgis": "^2.1.0", + "tiny-binary-search": "^1.0.3" + }; + var devDependencies = { + "@rollup/plugin-json": "^6.0.0", + "@rollup/plugin-node-resolve": "^15.0.1", + "@rollup/plugin-terser": "^0.3.0", + chai: "4.3.7", + "chokidar-cli": "^3.0.0", + "gh-release": "^7.0.1", + "highlight.js": "^11.7.0", + "http-server": "^14.1.1", + husky: "^1.1.1", + karma: "^6.4.1", + "karma-chrome-launcher": "^3.1.1", + "karma-coverage": "^2.2.0", + "karma-edgium-launcher": "github:matracey/karma-edgium-launcher", + "karma-firefox-launcher": "^2.1.2", + "karma-mocha": "^2.0.1", + "karma-mocha-reporter": "^2.2.5", + "karma-safari-launcher": "~1.0.0", + "karma-sinon-chai": "^2.0.2", + "karma-sourcemap-loader": "^0.3.8", + leaflet: "^1.6.0", + mkdirp: "^1.0.4", + mocha: "^10.2.0", + "npm-run-all": "^4.1.5", + rollup: "^2.79.1", + semistandard: "^14.2.3", + sinon: "^15.0.1", + "sinon-chai": "3.7.0", + snazzy: "^9.0.0" + }; + var files = [ + "src/**/*.js", + "dist/esri-leaflet.js", + "dist/esri-leaflet.js.map", + "dist/esri-leaflet-debug.js.map", + "dist/siteData.json", + "profiles/*.js" + ]; + var homepage = "https://developers.arcgis.com/esri-leaflet/"; + var module = "src/EsriLeaflet.js"; + var jspm = { + registry: "npm", + format: "es6", + main: "src/EsriLeaflet.js" + }; + var keywords = [ + "arcgis", + "esri", + "esri leaflet", + "gis", + "leaflet plugin", + "mapping" + ]; + var license = "Apache-2.0"; + var main = "dist/esri-leaflet-debug.js"; + var peerDependencies = { + leaflet: "^1.0.0" + }; + var readmeFilename = "README.md"; + var repository = { + type: "git", + url: "git@github.com:Esri/esri-leaflet.git" + }; + var scripts = { + build: "rollup -c profiles/debug.js & rollup -c profiles/production.js", + lint: "semistandard | snazzy", + prebuild: "mkdirp dist", + pretest: "npm run build", + fix: "semistandard --fix", + release: "./scripts/release.sh", + "start-watch": "chokidar src -c \"npm run build\"", + start: "run-p start-watch serve", + serve: "http-server -p 5000 -c-1 -o", + test: "npm run lint && karma start" + }; + var semistandard = { + globals: [ + "expect", + "L", + "XMLHttpRequest", + "sinon", + "xhr", + "proj4" + ] + }; + var unpkg = "dist/esri-leaflet-debug.js"; + var husky = { + hooks: { + "pre-commit": "npm run lint" + } + }; + var packageInfo = { + name: name, + description: description, + version: version$1, + author: author, + bugs: bugs, + contributors: contributors, + dependencies: dependencies, + devDependencies: devDependencies, + files: files, + homepage: homepage, + module: module, + "jsnext:main": "src/EsriLeaflet.js", + jspm: jspm, + keywords: keywords, + license: license, + main: main, + peerDependencies: peerDependencies, + readmeFilename: readmeFilename, + repository: repository, + scripts: scripts, + semistandard: semistandard, + unpkg: unpkg, + husky: husky + }; + + var cors = ((window.XMLHttpRequest && 'withCredentials' in new window.XMLHttpRequest())); + var pointerEvents = document.documentElement.style.pointerEvents === ''; + + var Support = { + cors: cors, + pointerEvents: pointerEvents + }; + + var options = { + attributionWidthOffset: 55 + }; + + var callbacks = 0; + + function serialize (params) { + var data = ''; + + params.f = params.f || 'json'; + + for (var key in params) { + if (Object.prototype.hasOwnProperty.call(params, key)) { + var param = params[key]; + var type = Object.prototype.toString.call(param); + var value; + + if (data.length) { + data += '&'; + } + + if (type === '[object Array]') { + value = (Object.prototype.toString.call(param[0]) === '[object Object]') ? JSON.stringify(param) : param.join(','); + } else if (type === '[object Object]') { + value = JSON.stringify(param); + } else if (type === '[object Date]') { + value = param.valueOf(); + } else { + value = param; + } + + data += encodeURIComponent(key) + '=' + encodeURIComponent(value); + } + } + + const APOSTROPHE_URL_ENCODE = '%27'; + return data.replaceAll("'", APOSTROPHE_URL_ENCODE); + } + + function createRequest (callback, context) { + var httpRequest = new window.XMLHttpRequest(); + + httpRequest.onerror = function (e) { + httpRequest.onreadystatechange = leaflet.Util.falseFn; + + 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. This could also be caused by a CORS or XMLHttpRequest error.' + }; + } + + if (!error && response.error) { + error = response.error; + response = null; + } + + httpRequest.onerror = leaflet.Util.falseFn; + + callback.call(context, error, response); + } + }; + + httpRequest.ontimeout = function () { + this.onerror(); + }; + + return httpRequest; + } + + function xmlHttpPost (url, params, callback, context) { + var httpRequest = createRequest(callback, context); + httpRequest.open('POST', url); + + if (typeof context !== 'undefined' && context !== null) { + if (typeof context.options !== 'undefined') { + httpRequest.timeout = context.options.timeout; + } + } + httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); + httpRequest.send(serialize(params)); + + return httpRequest; + } + + function xmlHttpGet (url, params, callback, context) { + var httpRequest = createRequest(callback, context); + httpRequest.open('GET', url + '?' + serialize(params), true); + + if (typeof context !== 'undefined' && context !== null) { + if (typeof context.options !== 'undefined') { + httpRequest.timeout = context.options.timeout; + if (context.options.withCredentials) { + httpRequest.withCredentials = true; + } + } + } + httpRequest.send(null); + + return httpRequest; + } + + // AJAX handlers for CORS (modern browsers) or JSONP (older browsers) + function request (url, params, callback, context) { + var paramString = serialize(params); + var httpRequest = createRequest(callback, context); + var requestLength = (url + '?' + paramString).length; + + // ie10/11 require the request be opened before a timeout is applied + if (requestLength <= 2000 && Support.cors) { + httpRequest.open('GET', url + '?' + paramString); + } else if (requestLength > 2000 && Support.cors) { + httpRequest.open('POST', url); + httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); + } + + if (typeof context !== 'undefined' && context !== null) { + if (typeof context.options !== 'undefined') { + httpRequest.timeout = context.options.timeout; + if (context.options.withCredentials) { + httpRequest.withCredentials = true; + } + } + } + + // request is less than 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest + if (requestLength <= 2000 && Support.cors) { + httpRequest.send(null); + + // request is more than 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest + } else if (requestLength > 2000 && Support.cors) { + httpRequest.send(paramString); + + // request is less than 2000 characters and the browser does not support CORS, make a JSONP request + } else if (requestLength <= 2000 && !Support.cors) { + return jsonp(url, params, callback, context); + + // request is longer then 2000 characters and the browser does not support CORS, log a warning + } else { + warn('a request to ' + url + ' was longer then 2000 characters and this browser cannot make a cross-domain post request. Please use a proxy https://developers.arcgis.com/esri-leaflet/api-reference/request/'); + return; + } + + return httpRequest; + } + + function jsonp (url, params, callback, context) { + window._EsriLeafletCallbacks = window._EsriLeafletCallbacks || {}; + var callbackId = 'c' + callbacks; + params.callback = 'window._EsriLeafletCallbacks.' + 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; + } + }; + + var script = leaflet.DomUtil.create('script', null, document.body); + script.type = 'text/javascript'; + script.src = url + '?' + serialize(params); + script.id = callbackId; + script.onerror = function (error) { + if (error && window._EsriLeafletCallbacks[callbackId] !== true) { + // Can't get true error code: it can be 404, or 401, or 500 + var err = { + error: { + code: 500, + message: 'An unknown error occurred' + } + }; + + callback.call(context, err); + window._EsriLeafletCallbacks[callbackId] = true; + } + }; + leaflet.DomUtil.addClass(script, 'esri-leaflet-jsonp'); + + callbacks++; + + return { + id: callbackId, + url: script.src, + abort: function () { + window._EsriLeafletCallbacks._callback[callbackId]({ + code: 0, + message: 'Request aborted.' + }); + } + }; + } + + var get = ((Support.cors) ? xmlHttpGet : jsonp); + get.CORS = xmlHttpGet; + get.JSONP = jsonp; + + function warn () { + if (console && console.warn) { + console.warn.apply(console, arguments); + } + } + + // export the Request object to call the different handlers for debugging + var Request = { + request: request, + get: get, + post: xmlHttpPost + }; + + /* @preserve + * @terraformer/arcgis - v2.0.7 - MIT + * Copyright (c) 2012-2021 Environmental Systems Research Institute, Inc. + * Thu Jul 22 2021 13:58:30 GMT-0700 (Pacific Daylight Time) + */ + /* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc. + * Apache-2.0 */ + + var edgeIntersectsEdge = function edgeIntersectsEdge(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 (ua >= 0 && ua <= 1 && ub >= 0 && ub <= 1) { + return true; + } + } + + return false; + }; + var coordinatesContainPoint = 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; + }; + var pointsEqual = function pointsEqual(a, b) { + for (var i = 0; i < a.length; i++) { + if (a[i] !== b[i]) { + return false; + } + } + + return true; + }; + var arrayIntersectsArray = function arrayIntersectsArray(a, b) { + for (var i = 0; i < a.length - 1; i++) { + for (var j = 0; j < b.length - 1; j++) { + if (edgeIntersectsEdge(a[i], a[i + 1], b[j], b[j + 1])) { + return true; + } + } + } + + return false; + }; + + /* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc. + * Apache-2.0 */ + + var closeRing = 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 + + var ringIsClockwise = function ringIsClockwise(ringToTest) { + var total = 0; + var 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; + }; // This function ensures that rings are oriented in the right directions + // from http://jsperf.com/cloning-an-object/2 + + var shallowClone = function shallowClone(obj) { + var target = {}; + + for (var i in obj) { + // both arcgis attributes and geojson props are just hardcoded keys + if (obj.hasOwnProperty(i)) { + // eslint-disable-line no-prototype-builtins + target[i] = obj[i]; + } + } + + return target; + }; + + /* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc. + * Apache-2.0 */ + + var coordinatesContainCoordinates = 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 + + + var convertRingsToGeoJSON = 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.slice().reverse()]; // wind outer rings counterclockwise for RFC 7946 compliance + + outerRings.push(polygon); // push to outer rings + } else { + holes.push(ring.slice().reverse()); // wind inner rings clockwise for RFC 7946 compliance + } + } + + 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 + }; + } + }; + + var getId = function getId(attributes, idAttribute) { + var keys = idAttribute ? [idAttribute, 'OBJECTID', 'FID'] : ['OBJECTID', 'FID']; + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + + if (key in attributes && (typeof attributes[key] === 'string' || typeof attributes[key] === 'number')) { + return attributes[key]; + } + } + + throw Error('No valid id attribute found'); + }; + + var arcgisToGeoJSON$1 = function arcgisToGeoJSON(arcgis, idAttribute) { + var geojson = {}; + + if (arcgis.features) { + geojson.type = 'FeatureCollection'; + geojson.features = []; + + for (var i = 0; i < arcgis.features.length; i++) { + geojson.features.push(arcgisToGeoJSON(arcgis.features[i], idAttribute)); + } + } + + if (typeof arcgis.x === 'number' && typeof arcgis.y === 'number') { + geojson.type = 'Point'; + geojson.coordinates = [arcgis.x, arcgis.y]; + + if (typeof arcgis.z === 'number') { + geojson.coordinates.push(arcgis.z); + } + } + + 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 (typeof arcgis.xmin === 'number' && typeof arcgis.ymin === 'number' && typeof arcgis.xmax === 'number' && typeof arcgis.ymax === 'number') { + geojson.type = 'Polygon'; + geojson.coordinates = [[[arcgis.xmax, arcgis.ymax], [arcgis.xmin, arcgis.ymax], [arcgis.xmin, arcgis.ymin], [arcgis.xmax, arcgis.ymin], [arcgis.xmax, arcgis.ymax]]]; + } + + if (arcgis.geometry || arcgis.attributes) { + geojson.type = 'Feature'; + geojson.geometry = arcgis.geometry ? arcgisToGeoJSON(arcgis.geometry) : null; + geojson.properties = arcgis.attributes ? shallowClone(arcgis.attributes) : null; + + if (arcgis.attributes) { + try { + geojson.id = getId(arcgis.attributes, idAttribute); + } catch (err) {// don't set an id + } + } + } // if no valid geometry was encountered + + + if (JSON.stringify(geojson.geometry) === JSON.stringify({})) { + geojson.geometry = null; + } + + if (arcgis.spatialReference && arcgis.spatialReference.wkid && arcgis.spatialReference.wkid !== 4326) { + console.warn('Object converted in non-standard crs - ' + JSON.stringify(arcgis.spatialReference)); + } + + return geojson; + }; + + /* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc. + * Apache-2.0 */ + // outer rings are clockwise, holes are counterclockwise + // used for converting GeoJSON Polygons to ArcGIS Polygons + + var orientRings = 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 + + + var flattenMultiPolygonRings = 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; + }; + + var geojsonToArcGIS$1 = function geojsonToArcGIS(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]; + + if (geojson.coordinates[2]) { + result.z = geojson.coordinates[2]; + } + + result.spatialReference = spatialReference; + break; + + case 'MultiPoint': + result.points = geojson.coordinates.slice(0); + + if (geojson.coordinates[0][2]) { + result.hasZ = true; + } + + result.spatialReference = spatialReference; + break; + + case 'LineString': + result.paths = [geojson.coordinates.slice(0)]; + + if (geojson.coordinates[0][2]) { + result.hasZ = true; + } + + result.spatialReference = spatialReference; + break; + + case 'MultiLineString': + result.paths = geojson.coordinates.slice(0); + + if (geojson.coordinates[0][0][2]) { + result.hasZ = true; + } + + result.spatialReference = spatialReference; + break; + + case 'Polygon': + result.rings = orientRings(geojson.coordinates.slice(0)); + + if (geojson.coordinates[0][0][2]) { + result.hasZ = true; + } + + result.spatialReference = spatialReference; + break; + + case 'MultiPolygon': + result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0)); + + if (geojson.coordinates[0][0][0][2]) { + result.hasZ = true; + } + + result.spatialReference = spatialReference; + break; + + case 'Feature': + if (geojson.geometry) { + result.geometry = geojsonToArcGIS(geojson.geometry, idAttribute); + } + + result.attributes = geojson.properties ? shallowClone(geojson.properties) : {}; + + if (geojson.id) { + result.attributes[idAttribute] = geojson.id; + } + + break; + + case 'FeatureCollection': + result = []; + + for (i = 0; i < geojson.features.length; i++) { + result.push(geojsonToArcGIS(geojson.features[i], idAttribute)); + } + + break; + + case 'GeometryCollection': + result = []; + + for (i = 0; i < geojson.geometries.length; i++) { + result.push(geojsonToArcGIS(geojson.geometries[i], idAttribute)); + } + + break; + } + + return result; + }; + + var POWERED_BY_ESRI_ATTRIBUTION_STRING = 'Powered by Esri'; + + function geojsonToArcGIS (geojson, idAttr) { + return geojsonToArcGIS$1(geojson, idAttr); + } + + function arcgisToGeoJSON (arcgis, idAttr) { + return arcgisToGeoJSON$1(arcgis, idAttr); + } + + // convert an extent (ArcGIS) to LatLngBounds (Leaflet) + function extentToBounds (extent) { + // "NaN" coordinates from ArcGIS Server indicate a null geometry + if (extent.xmin !== 'NaN' && extent.ymin !== 'NaN' && extent.xmax !== 'NaN' && extent.ymax !== 'NaN') { + var sw = leaflet.latLng(extent.ymin, extent.xmin); + var ne = leaflet.latLng(extent.ymax, extent.xmax); + return leaflet.latLngBounds(sw, ne); + } else { + return null; + } + } + + // convert an LatLngBounds (Leaflet) to extent (ArcGIS) + function boundsToExtent (bounds) { + bounds = leaflet.latLngBounds(bounds); + return { + xmin: bounds.getSouthWest().lng, + ymin: bounds.getSouthWest().lat, + xmax: bounds.getNorthEast().lng, + ymax: bounds.getNorthEast().lat, + spatialReference: { + wkid: 4326 + } + }; + } + + var knownFieldNames = /^(OBJECTID|FID|OID|ID)$/i; + + // Attempts to find the ID Field from response + function _findIdAttributeFromResponse (response) { + var result; + + if (response.objectIdFieldName) { + // Find Id Field directly + result = response.objectIdFieldName; + } else if (response.fields) { + // Find ID Field based on field type + for (var j = 0; j <= response.fields.length - 1; j++) { + if (response.fields[j].type === 'esriFieldTypeOID') { + result = response.fields[j].name; + break; + } + } + if (!result) { + // If no field was marked as being the esriFieldTypeOID try well known field names + for (j = 0; j <= response.fields.length - 1; j++) { + if (response.fields[j].name.match(knownFieldNames)) { + result = response.fields[j].name; + break; + } + } + } + } + return result; + } + + // This is the 'last' resort, find the Id field from the specified feature + function _findIdAttributeFromFeature (feature) { + for (var key in feature.attributes) { + if (key.match(knownFieldNames)) { + return key; + } + } + } + + function responseToFeatureCollection (response, idAttribute) { + var objectIdField; + var features = response.features || response.results; + var count = features && features.length; + + if (idAttribute) { + objectIdField = idAttribute; + } else { + objectIdField = _findIdAttributeFromResponse(response); + } + + var featureCollection = { + type: 'FeatureCollection', + features: [] + }; + + if (count) { + for (var i = features.length - 1; i >= 0; i--) { + var feature = arcgisToGeoJSON(features[i], objectIdField || _findIdAttributeFromFeature(features[i])); + featureCollection.features.push(feature); + } + } + + return featureCollection; + } + + // trim url whitespace and add a trailing slash if needed + function cleanUrl (url) { + // trim leading and trailing spaces, but not spaces inside the url + url = leaflet.Util.trim(url); + + // add a trailing slash to the url if the user omitted it + if (url[url.length - 1] !== '/') { + url += '/'; + } + + return url; + } + + /* Extract url params if any and store them in requestParams attribute. + Return the options params updated */ + function getUrlParams (options) { + if (options.url.indexOf('?') !== -1) { + options.requestParams = options.requestParams || {}; + var queryString = options.url.substring(options.url.indexOf('?') + 1); + options.url = options.url.split('?')[0]; + options.requestParams = JSON.parse('{"' + decodeURI(queryString).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}'); + } + options.url = cleanUrl(options.url.split('?')[0]); + return options; + } + + function isArcgisOnline (url) { + /* hosted feature services support geojson as an output format + utility.arcgis.com services are proxied from a variety of ArcGIS Server vintages, and may not */ + return (/^(?!.*utility\.arcgis\.com).*\.arcgis\.com.*FeatureServer/i).test(url); + } + + function geojsonTypeToArcGIS (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; + } + + function calcAttributionWidth (map) { + // either crop at 55px or user defined buffer + return (map.getSize().x - options.attributionWidthOffset) + 'px'; + } + + function setEsriAttribution (map) { + if (!map.attributionControl) { + return; + } + + if (!map.attributionControl._esriAttributionLayerCount) { + map.attributionControl._esriAttributionLayerCount = 0; + } + + if (map.attributionControl._esriAttributionLayerCount === 0) { + // Dynamically creating the CSS rules, only run this once per page load: + if (!map.attributionControl._esriAttributionAddedOnce) { + var hoverAttributionStyle = document.createElement('style'); + hoverAttributionStyle.type = 'text/css'; + hoverAttributionStyle.innerHTML = '.esri-truncated-attribution:hover {' + + 'white-space: normal;' + + '}'; + document.getElementsByTagName('head')[0].appendChild(hoverAttributionStyle); + + // define a new css class in JS to trim attribution into a single line + var attributionStyle = document.createElement('style'); + attributionStyle.type = 'text/css'; + attributionStyle.innerHTML = '.esri-truncated-attribution {' + + 'vertical-align: -3px;' + + 'white-space: nowrap;' + + 'overflow: hidden;' + + 'text-overflow: ellipsis;' + + 'display: inline-block;' + + 'transition: 0s white-space;' + + 'transition-delay: 1s;' + + 'max-width: ' + calcAttributionWidth(map) + ';' + + '}'; + document.getElementsByTagName('head')[0].appendChild(attributionStyle); + + // update the width used to truncate when the map itself is resized + map.on('resize', function (e) { + if (map.attributionControl) { + map.attributionControl._container.style.maxWidth = calcAttributionWidth(e.target); + } + }); + + map.attributionControl._esriAttributionAddedOnce = true; + } + + leaflet.DomUtil.addClass(map.attributionControl._container, 'esri-truncated-attribution:hover'); + leaflet.DomUtil.addClass(map.attributionControl._container, 'esri-truncated-attribution'); + } + + // Track the number of esri-leaflet layers that are on the map so we can know when we can remove the attribution (below in removeEsriAttribution) + map.attributionControl._esriAttributionLayerCount = map.attributionControl._esriAttributionLayerCount + 1; + } + + function removeEsriAttribution (map) { + if (!map.attributionControl) { + return; + } + + // Only remove the attribution if we're about to remove the LAST esri-leaflet layer (_esriAttributionLayerCount) + if (map.attributionControl._esriAttributionLayerCount && map.attributionControl._esriAttributionLayerCount === 1) { + leaflet.DomUtil.removeClass(map.attributionControl._container, 'esri-truncated-attribution:hover'); + leaflet.DomUtil.removeClass(map.attributionControl._container, 'esri-truncated-attribution'); + } + map.attributionControl._esriAttributionLayerCount = map.attributionControl._esriAttributionLayerCount - 1; + } + + function _setGeometry (geometry) { + var params = { + geometry: null, + geometryType: null + }; + + // convert bounds to extent and finish + if (geometry instanceof leaflet.LatLngBounds) { + // set geometry + geometryType + params.geometry = boundsToExtent(geometry); + params.geometryType = 'esriGeometryEnvelope'; + return params; + } + + // convert L.Marker > L.LatLng + if (geometry.getLatLng) { + geometry = geometry.getLatLng(); + } + + // convert L.LatLng to a geojson point and continue; + if (geometry instanceof leaflet.LatLng) { + geometry = { + type: 'Point', + coordinates: [geometry.lng, geometry.lat] + }; + } + + // handle L.GeoJSON, pull out the first geometry + if (geometry instanceof leaflet.GeoJSON) { + // reassign geometry to the GeoJSON value (we are assuming that only one feature is present) + geometry = geometry.getLayers()[0].feature.geometry; + params.geometry = geojsonToArcGIS(geometry); + params.geometryType = 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' || geometry.type === 'MultiPolygon') { + params.geometry = geojsonToArcGIS(geometry); + params.geometryType = geojsonTypeToArcGIS(geometry.type); + return params; + } + + // warn the user if we havn't found an appropriate object + warn('invalid geometry passed to spatial query. Should be L.LatLng, L.LatLngBounds, L.Marker or a GeoJSON Point, Line, Polygon or MultiPolygon object'); + } + + function _getAttributionData (url, map) { + if (Support.cors) { + request(url, {}, leaflet.Util.bind(function (error, attributions) { + if (error) { return; } + map._esriAttributions = []; + 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 = leaflet.latLng(coverageArea.bbox[0], coverageArea.bbox[1]); + var northEast = leaflet.latLng(coverageArea.bbox[2], coverageArea.bbox[3]); + map._esriAttributions.push({ + attribution: contributor.attribution, + score: coverageArea.score, + bounds: leaflet.latLngBounds(southWest, northEast), + minZoom: coverageArea.zoomMin, + maxZoom: coverageArea.zoomMax + }); + } + } + + map._esriAttributions.sort(function (a, b) { + return b.score - a.score; + }); + + // pass the same argument as the map's 'moveend' event + var obj = { target: map }; + _updateMapAttribution(obj); + }, this)); + } + } + + function _updateMapAttribution (evt) { + var map = evt.target; + var oldAttributions = map._esriAttributions; + + if (!map || !map.attributionControl) return; + + var attributionElement = map.attributionControl._container.querySelector('.esri-dynamic-attribution'); + + if (attributionElement && oldAttributions) { + var newAttributions = ''; + var bounds = map.getBounds(); + var wrappedBounds = leaflet.latLngBounds( + bounds.getSouthWest().wrap(), + bounds.getNorthEast().wrap() + ); + var zoom = map.getZoom(); + + for (var i = 0; i < oldAttributions.length; i++) { + var attribution = oldAttributions[i]; + var text = attribution.attribution; + + if (!newAttributions.match(text) && attribution.bounds.intersects(wrappedBounds) && zoom >= attribution.minZoom && zoom <= attribution.maxZoom) { + newAttributions += (', ' + text); + } + } + + newAttributions = POWERED_BY_ESRI_ATTRIBUTION_STRING + ' | ' + newAttributions.substr(2); + attributionElement.innerHTML = newAttributions; + attributionElement.style.maxWidth = calcAttributionWidth(map); + + map.fire('attributionupdated', { + attribution: newAttributions + }); + } + } + + var EsriUtil = { + warn: warn, + cleanUrl: cleanUrl, + getUrlParams: getUrlParams, + isArcgisOnline: isArcgisOnline, + geojsonTypeToArcGIS: geojsonTypeToArcGIS, + responseToFeatureCollection: responseToFeatureCollection, + geojsonToArcGIS: geojsonToArcGIS, + arcgisToGeoJSON: arcgisToGeoJSON, + boundsToExtent: boundsToExtent, + extentToBounds: extentToBounds, + calcAttributionWidth: calcAttributionWidth, + setEsriAttribution: setEsriAttribution, + removeEsriAttribution: removeEsriAttribution, + _setGeometry: _setGeometry, + _getAttributionData: _getAttributionData, + _updateMapAttribution: _updateMapAttribution, + _findIdAttributeFromFeature: _findIdAttributeFromFeature, + _findIdAttributeFromResponse: _findIdAttributeFromResponse + }; + + var Task = leaflet.Class.extend({ + + options: { + proxy: false, + useCors: cors + }, + + // Generate a method for each methodName:paramName in the setters for this task. + generateSetter: function (param, context) { + return leaflet.Util.bind(function (value) { + this.params[param] = value; + return this; + }, context); + }, + + initialize: function (endpoint) { + // endpoint can be either a url (and options) for an ArcGIS Rest Service or an instance of EsriLeaflet.Service + if (endpoint.request && endpoint.options) { + this._service = endpoint; + leaflet.Util.setOptions(this, endpoint.options); + } else { + leaflet.Util.setOptions(this, endpoint); + this.options.url = cleanUrl(endpoint.url); + } + + // clone default params into this object + this.params = leaflet.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); + } + } + }, + + token: function (token) { + if (this._service) { + this._service.authenticate(token); + } else { + this.params.token = token; + } + return this; + }, + + apikey: function (apikey) { + return this.token(apikey); + }, + + // ArcGIS Server Find/Identify 10.5+ + format: function (boolean) { + // use double negative to expose a more intuitive positive method name + this.params.returnUnformattedValues = !boolean; + return this; + }, + + request: function (callback, context) { + if (this.options.requestParams) { + leaflet.Util.extend(this.params, this.options.requestParams); + } + if (this._service) { + return this._service.request(this.path, this.params, callback, context); + } + + 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.options.url + path : this.options.url + path; + + if ((method === 'get' || method === 'request') && !this.options.useCors) { + return Request.get.JSONP(url, params, callback, context); + } + + return Request[method](url, params, callback, context); + } + }); + + function task (options) { + options = getUrlParams(options); + return new Task(options); + } + + var Query = Task.extend({ + setters: { + offset: 'resultOffset', + limit: 'resultRecordCount', + fields: 'outFields', + precision: 'geometryPrecision', + featureIds: 'objectIds', + returnGeometry: 'returnGeometry', + returnM: 'returnM', + transform: 'datumTransformation', + token: 'token' + }, + + path: 'query', + + params: { + returnGeometry: true, + where: '1=1', + outSR: 4326, + outFields: '*' + }, + + // Returns a feature if its shape is wholly contained within the search geometry. Valid for all shape type combinations. + within: function (geometry) { + this._setGeometryParams(geometry); + this.params.spatialRel = 'esriSpatialRelContains'; // to the REST api this reads geometry **contains** layer + return this; + }, + + // Returns a feature if any spatial relationship is found. Applies to all shape type combinations. + intersects: function (geometry) { + this._setGeometryParams(geometry); + this.params.spatialRel = 'esriSpatialRelIntersects'; + return this; + }, + + // Returns a feature if its shape wholly contains the search geometry. Valid for all shape type combinations. + contains: function (geometry) { + this._setGeometryParams(geometry); + this.params.spatialRel = 'esriSpatialRelWithin'; // to the REST api this reads geometry **within** layer + return this; + }, + + // Returns a feature if the intersection of the interiors of the two shapes is not empty and has a lower dimension than the maximum dimension of the two shapes. Two lines that share an endpoint in common do not cross. Valid for Line/Line, Line/Area, Multi-point/Area, and Multi-point/Line shape type combinations. + crosses: function (geometry) { + this._setGeometryParams(geometry); + this.params.spatialRel = 'esriSpatialRelCrosses'; + return this; + }, + + // Returns a feature if the two shapes share a common boundary. However, the intersection of the interiors of the two shapes must be empty. In the Point/Line case, the point may touch an endpoint only of the line. Applies to all combinations except Point/Point. + touches: function (geometry) { + this._setGeometryParams(geometry); + this.params.spatialRel = 'esriSpatialRelTouches'; + return this; + }, + + // Returns a feature if the intersection of the two shapes results in an object of the same dimension, but different from both of the shapes. Applies to Area/Area, Line/Line, and Multi-point/Multi-point shape type combinations. + overlaps: function (geometry) { + this._setGeometryParams(geometry); + this.params.spatialRel = 'esriSpatialRelOverlaps'; + return this; + }, + + // Returns a feature if the envelope of the two shapes intersects. + bboxIntersects: function (geometry) { + this._setGeometryParams(geometry); + this.params.spatialRel = 'esriSpatialRelEnvelopeIntersects'; + return this; + }, + + // if someone can help decipher the ArcObjects explanation and translate to plain speak, we should mention this method in the doc + indexIntersects: function (geometry) { + this._setGeometryParams(geometry); + this.params.spatialRel = 'esriSpatialRelIndexIntersects'; // Returns a feature if the envelope of the query geometry intersects the index entry for the target geometry + return this; + }, + + // only valid for Feature Services running on ArcGIS Server 10.3+ or ArcGIS Online + nearby: function (latlng, radius) { + latlng = leaflet.latLng(latlng); + this.params.geometry = [latlng.lng, latlng.lat]; + 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) { + // instead of converting double-quotes to single quotes, pass as is, and provide a more informative message if a 400 is encountered + this.params.where = string; + return this; + }, + + between: function (start, end) { + this.params.time = [start.valueOf(), end.valueOf()]; + 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; + }, + + run: function (callback, context) { + this._cleanParams(); + + // services hosted on ArcGIS Online and ArcGIS Server 10.3.1+ support requesting geojson directly + if (this.options.isModern || (isArcgisOnline(this.options.url) && this.options.isModern === undefined)) { + this.params.f = 'geojson'; + + return this.request(function (error, response) { + this._trapSQLerrors(error); + callback.call(context, error, response, response); + }, this); + + // otherwise convert it in the callback then pass it on + } else { + return this.request(function (error, response) { + this._trapSQLerrors(error); + callback.call(context, error, (response && responseToFeatureCollection(response)), response); + }, this); + } + }, + + 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) { + if (response && response.extent && extentToBounds(response.extent)) { + callback.call(context, error, extentToBounds(response.extent), response); + } else { + error = { + message: 'Invalid Bounds' + }; + callback.call(context, error, null, response); + } + }, context); + }, + + distinct: function () { + // geometry must be omitted for queries requesting distinct values + this.params.returnGeometry = false; + this.params.returnDistinctValues = true; + return this; + }, + + // only valid for image services + pixelSize: function (rawPoint) { + var castPoint = leaflet.point(rawPoint); + this.params.pixelSize = [castPoint.x, castPoint.y]; + return this; + }, + + // only valid for map services + layer: function (layer) { + this.path = layer + '/query'; + return this; + }, + + _trapSQLerrors: function (error) { + if (error) { + if (error.code === '400') { + warn('one common syntax error in query requests is encasing string values in double quotes instead of single quotes'); + } + } + }, + + _cleanParams: function () { + delete this.params.returnIdsOnly; + delete this.params.returnExtentOnly; + delete this.params.returnCountOnly; + }, + + _setGeometryParams: function (geometry) { + this.params.inSR = 4326; + var converted = _setGeometry(geometry); + this.params.geometry = converted.geometry; + this.params.geometryType = converted.geometryType; + } + + }); + + function query (options) { + return new Query(options); + } + + var Find = 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', + // skipped implementing this (for now) because the REST service implementation isnt consistent between operations + // 'transform': 'datumTransformations', + 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 && responseToFeatureCollection(response)), response); + }, context); + } + }); + + function find (options) { + return new Find(options); + } + + var Identify = Task.extend({ + path: 'identify', + + between: function (start, end) { + this.params.time = [start.valueOf(), end.valueOf()]; + return this; + } + }); + + function identify (options) { + return new Identify(options); + } + + var IdentifyFeatures = Identify.extend({ + setters: { + layers: 'layers', + precision: 'geometryPrecision', + tolerance: 'tolerance', + // skipped implementing this (for now) because the REST service implementation isnt consistent between operations. + // 'transform': 'datumTransformations' + returnGeometry: 'returnGeometry' + }, + + params: { + sr: 4326, + layers: 'all', + tolerance: 3, + returnGeometry: true + }, + + on: function (map) { + var extent = boundsToExtent(map.getBounds()); + var size = map.getSize(); + this.params.imageDisplay = [size.x, size.y, 96]; + this.params.mapExtent = [extent.xmin, extent.ymin, extent.xmax, extent.ymax]; + return this; + }, + + at: function (geometry) { + // cast lat, long pairs in raw array form manually + if (geometry.length === 2) { + geometry = leaflet.latLng(geometry); + } + this._setGeometryParams(geometry); + 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) * factor; + return this; + }, + + run: function (callback, context) { + return this.request(function (error, response) { + // immediately invoke with an error + if (error) { + callback.call(context, error, undefined, response); + + // ok no error lets just assume we have features... + } else { + var featureCollection = responseToFeatureCollection(response); + response.results = response.results.reverse(); + for (var i = 0; i < featureCollection.features.length; i++) { + var feature = featureCollection.features[i]; + feature.layerId = response.results[i].layerId; + } + callback.call(context, undefined, featureCollection, response); + } + }); + }, + + _setGeometryParams: function (geometry) { + var converted = _setGeometry(geometry); + this.params.geometry = converted.geometry; + this.params.geometryType = converted.geometryType; + } + }); + + function identifyFeatures (options) { + return new IdentifyFeatures(options); + } + + var IdentifyImage = Identify.extend({ + setters: { + setMosaicRule: 'mosaicRule', + setRenderingRule: 'renderingRule', + setPixelSize: 'pixelSize', + returnCatalogItems: 'returnCatalogItems', + returnGeometry: 'returnGeometry' + }, + + params: { + returnGeometry: false + }, + + at: function (latlng) { + latlng = leaflet.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; + }, + + 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 = 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; + } + + }); + + function identifyImage (params) { + return new IdentifyImage(params); + } + + var Service = leaflet.Evented.extend({ + + options: { + proxy: false, + useCors: cors, + timeout: 0 + }, + + initialize: function (options) { + options = options || {}; + this._requestQueue = []; + this._authenticating = false; + leaflet.Util.setOptions(this, options); + this.options.url = cleanUrl(this.options.url); + }, + + 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; + }, + + getTimeout: function () { + return this.options.timeout; + }, + + setTimeout: function (timeout) { + this.options.timeout = timeout; + }, + + _request: function (method, path, params, callback, context) { + this.fire('requeststart', { + url: this.options.url + path, + params: params, + method: method + }, true); + + var wrappedCallback = this._createServiceCallback(method, path, params, callback, context); + + if (this.options.token) { + params.token = this.options.token; + } + if (this.options.requestParams) { + leaflet.Util.extend(params, this.options.requestParams); + } + if (this._authenticating) { + this._requestQueue.push([method, path, params, callback, context]); + } else { + var url = (this.options.proxy) ? this.options.proxy + '?' + this.options.url + path : this.options.url + path; + + if ((method === 'get' || method === 'request') && !this.options.useCors) { + return Request.get.JSONP(url, params, wrappedCallback, context); + } else { + return Request[method](url, params, wrappedCallback, context); + } + } + }, + + _createServiceCallback: function (method, path, params, callback, context) { + return leaflet.Util.bind(function (error, response) { + if (error && (error.code === 499 || error.code === 498)) { + this._authenticating = true; + + this._requestQueue.push([method, path, params, callback, context]); + + // fire an event for users to handle and re-authenticate + this.fire('authenticationrequired', { + authenticate: leaflet.Util.bind(this.authenticate, this) + }, true); + + // if the user has access to a callback they can handle the auth error + error.authenticate = leaflet.Util.bind(this.authenticate, this); + } + + callback.call(context, error, response); + + if (error) { + this.fire('requesterror', { + url: this.options.url + path, + params: params, + message: error.message, + code: error.code, + method: method + }, true); + } else { + this.fire('requestsuccess', { + url: this.options.url + path, + params: params, + response: response, + method: method + }, true); + } + + this.fire('requestend', { + url: this.options.url + path, + params: params, + method: method + }, true); + }, 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 = []; + } + }); + + function service (options) { + options = getUrlParams(options); + return new Service(options); + } + + var MapService = Service.extend({ + + identify: function () { + return identifyFeatures(this); + }, + + find: function () { + return find(this); + }, + + query: function () { + return query(this); + } + + }); + + function mapService (options) { + return new MapService(options); + } + + var ImageService = Service.extend({ + + query: function () { + return query(this); + }, + + identify: function () { + return identifyImage(this); + } + }); + + function imageService (options) { + return new ImageService(options); + } + + var FeatureLayerService = Service.extend({ + + options: { + idAttribute: 'OBJECTID' + }, + + query: function () { + return query(this); + }, + + addFeature: function (feature, callback, context) { + this.addFeatures(feature, callback, context); + }, + + addFeatures: function (features, callback, context) { + var featuresArray = features.features ? features.features : [features]; + for (var i = featuresArray.length - 1; i >= 0; i--) { + delete featuresArray[i].id; + } + features = geojsonToArcGIS(features); + features = featuresArray.length > 1 ? features : [features]; + return this.post('addFeatures', { + features: features + }, function (error, response) { + // For compatibility reason with former addFeature function, + // we return the object in the array and not the array itself + var result = (response && response.addResults) ? response.addResults.length > 1 ? response.addResults : response.addResults[0] : undefined; + if (callback) { + callback.call(context, error || response.addResults[0].error, result); + } + }, context); + }, + + updateFeature: function (feature, callback, context) { + this.updateFeatures(feature, callback, context); + }, + + updateFeatures: function (features, callback, context) { + var featuresArray = features.features ? features.features : [features]; + features = geojsonToArcGIS(features, this.options.idAttribute); + features = featuresArray.length > 1 ? features : [features]; + + return this.post('updateFeatures', { + features: features + }, function (error, response) { + // For compatibility reason with former updateFeature function, + // we return the object in the array and not the array itself + var result = (response && response.updateResults) ? response.updateResults.length > 1 ? response.updateResults : response.updateResults[0] : undefined; + if (callback) { + callback.call(context, error || response.updateResults[0].error, result); + } + }, context); + }, + + deleteFeature: function (id, callback, context) { + this.deleteFeatures(id, callback, context); + }, + + deleteFeatures: function (ids, callback, context) { + return this.post('deleteFeatures', { + objectIds: ids + }, function (error, response) { + // For compatibility reason with former deleteFeature function, + // we return the object in the array and not the array itself + var result = (response && response.deleteResults) ? response.deleteResults.length > 1 ? response.deleteResults : response.deleteResults[0] : undefined; + if (callback) { + callback.call(context, error || response.deleteResults[0].error, result); + } + }, context); + } + }); + + function featureLayerService (options) { + return new FeatureLayerService(options); + } + + var tileProtocol = (window.location.protocol !== 'https:') ? 'http:' : 'https:'; + + var BasemapLayer = leaflet.TileLayer.extend({ + statics: { + TILES: { + Streets: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 19, + subdomains: ['server', 'services'], + attribution: 'USGS, NOAA', + attributionUrl: 'https://static.arcgis.com/attribution/World_Street_Map' + } + }, + Topographic: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 19, + subdomains: ['server', 'services'], + attribution: 'USGS, NOAA', + attributionUrl: 'https://static.arcgis.com/attribution/World_Topo_Map' + } + }, + Oceans: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 16, + subdomains: ['server', 'services'], + attribution: 'USGS, NOAA', + attributionUrl: 'https://static.arcgis.com/attribution/Ocean_Basemap' + } + }, + OceansLabels: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 16, + subdomains: ['server', 'services'], + pane: (pointerEvents) ? 'esri-labels' : 'tilePane', + attribution: '' + } + }, + NationalGeographic: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 16, + subdomains: ['server', 'services'], + attribution: 'National Geographic, DeLorme, HERE, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, increment P Corp.' + } + }, + DarkGray: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 16, + subdomains: ['server', 'services'], + attribution: 'HERE, DeLorme, MapmyIndia, © OpenStreetMap contributors' + } + }, + DarkGrayLabels: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Reference/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 16, + subdomains: ['server', 'services'], + pane: (pointerEvents) ? 'esri-labels' : 'tilePane', + attribution: '' + + } + }, + Gray: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 16, + subdomains: ['server', 'services'], + attribution: 'HERE, DeLorme, MapmyIndia, © OpenStreetMap contributors' + } + }, + GrayLabels: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 16, + subdomains: ['server', 'services'], + pane: (pointerEvents) ? 'esri-labels' : 'tilePane', + attribution: '' + } + }, + Imagery: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 19, + subdomains: ['server', 'services'], + attribution: 'DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community', + attributionUrl: 'https://static.arcgis.com/attribution/World_Imagery' + } + }, + ImageryLabels: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 19, + subdomains: ['server', 'services'], + pane: (pointerEvents) ? 'esri-labels' : 'tilePane', + attribution: '' + } + }, + ImageryTransportation: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 19, + subdomains: ['server', 'services'], + pane: (pointerEvents) ? 'esri-labels' : 'tilePane', + attribution: '' + } + }, + ShadedRelief: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 13, + subdomains: ['server', 'services'], + attribution: 'USGS' + } + }, + ShadedReliefLabels: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 12, + subdomains: ['server', 'services'], + pane: (pointerEvents) ? 'esri-labels' : 'tilePane', + attribution: '' + } + }, + Terrain: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 13, + subdomains: ['server', 'services'], + attribution: 'USGS, NOAA' + } + }, + TerrainLabels: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 13, + subdomains: ['server', 'services'], + pane: (pointerEvents) ? 'esri-labels' : 'tilePane', + attribution: '' + } + }, + USATopo: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 15, + subdomains: ['server', 'services'], + attribution: 'USGS, National Geographic Society, i-cubed' + } + }, + ImageryClarity: { + urlTemplate: tileProtocol + '//clarity.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 19, + attribution: 'Esri, DigitalGlobe, GeoEye, Earthstar Geographics, CNES/Airbus DS, USDA, USGS, AeroGRID, IGN, and the GIS User Community' + } + }, + Physical: { + urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 8, + subdomains: ['server', 'services'], + attribution: 'U.S. National Park Service' + } + }, + ImageryFirefly: { + urlTemplate: tileProtocol + '//fly.maptiles.arcgis.com/arcgis/rest/services/World_Imagery_Firefly/MapServer/tile/{z}/{y}/{x}', + options: { + minZoom: 1, + maxZoom: 19, + attribution: 'Esri, DigitalGlobe, GeoEye, Earthstar Geographics, CNES/Airbus DS, USDA, USGS, AeroGRID, IGN, and the GIS User Community', + attributionUrl: 'https://static.arcgis.com/attribution/World_Imagery' + } + } + } + }, + + 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' && BasemapLayer.TILES[key]) { + config = BasemapLayer.TILES[key]; + } else { + throw new Error('L.esri.BasemapLayer: Invalid parameter. Use one of "Streets", "Topographic", "Oceans", "OceansLabels", "NationalGeographic", "Physical", "Gray", "GrayLabels", "DarkGray", "DarkGrayLabels", "Imagery", "ImageryLabels", "ImageryTransportation", "ImageryClarity", "ImageryFirefly", ShadedRelief", "ShadedReliefLabels", "Terrain", "TerrainLabels" or "USATopo"'); + } + + // merge passed options into the config options + var tileOptions = leaflet.Util.extend(config.options, options); + + leaflet.Util.setOptions(this, tileOptions); + + // Deprecation notice: + if (!this.options.ignoreDeprecationWarning) { + console.warn('WARNING: L.esri.BasemapLayer uses data services that are in mature support and are not being updated. Please use L.esri.Vector.vectorBasemapLayer instead. More info: https://esriurl.com/esri-leaflet-basemap'); + } + + if (this.options.token && config.urlTemplate.indexOf('token=') === -1) { + config.urlTemplate += ('?token=' + this.options.token); + } + if (this.options.proxy) { + config.urlTemplate = this.options.proxy + '?' + config.urlTemplate; + } + + // call the initialize method on L.TileLayer to set everything up + leaflet.TileLayer.prototype.initialize.call(this, config.urlTemplate, tileOptions); + }, + + onAdd: function (map) { + // include 'Powered by Esri' in map attribution + setEsriAttribution(map); + + if (this.options.pane === 'esri-labels') { + this._initPane(); + } + // some basemaps can supply dynamic attribution + if (this.options.attributionUrl) { + _getAttributionData((this.options.proxy ? this.options.proxy + '?' : '') + this.options.attributionUrl, map); + } + + map.on('moveend', _updateMapAttribution); + + leaflet.TileLayer.prototype.onAdd.call(this, map); + }, + + onRemove: function (map) { + removeEsriAttribution(map); + + map.off('moveend', _updateMapAttribution); + + leaflet.TileLayer.prototype.onRemove.call(this, map); + }, + + _initPane: function () { + if (!this._map.getPane(this.options.pane)) { + var pane = this._map.createPane(this.options.pane); + pane.style.pointerEvents = 'none'; + pane.style.zIndex = 500; + } + }, + + getAttribution: function () { + if (this.options.attribution) { + var attribution = '' + this.options.attribution + ''; + } + return attribution; + } + }); + + function basemapLayer (key, options) { + return new BasemapLayer(key, options); + } + + var TiledMapLayer = leaflet.TileLayer.extend({ + options: { + zoomOffsetAllowance: 0.1, + errorTileUrl: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEABAMAAACuXLVVAAAAA1BMVEUzNDVszlHHAAAAAXRSTlMAQObYZgAAAAlwSFlzAAAAAAAAAAAB6mUWpAAAADZJREFUeJztwQEBAAAAgiD/r25IQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7waBAAABw08RwAAAAABJRU5ErkJggg==' + }, + + statics: { + MercatorZoomLevels: { + 0: 156543.03392799999, + 1: 78271.516963999893, + 2: 39135.758482000099, + 3: 19567.879240999901, + 4: 9783.9396204999593, + 5: 4891.9698102499797, + 6: 2445.9849051249898, + 7: 1222.9924525624899, + 8: 611.49622628138002, + 9: 305.74811314055802, + 10: 152.874056570411, + 11: 76.437028285073197, + 12: 38.218514142536598, + 13: 19.109257071268299, + 14: 9.5546285356341496, + 15: 4.7773142679493699, + 16: 2.38865713397468, + 17: 1.1943285668550501, + 18: 0.59716428355981699, + 19: 0.29858214164761698, + 20: 0.14929107082381, + 21: 0.07464553541191, + 22: 0.0373227677059525, + 23: 0.0186613838529763 + } + }, + + initialize: function (options) { + options = leaflet.Util.setOptions(this, options); + + // set the urls + options = getUrlParams(options); + this.tileUrl = (options.proxy ? options.proxy + '?' : '') + options.url + 'tile/{z}/{y}/{x}' + (options.requestParams && Object.keys(options.requestParams).length > 0 ? leaflet.Util.getParamString(options.requestParams) : ''); + // Remove subdomain in url + // https://github.com/Esri/esri-leaflet/issues/991 + if (options.url.indexOf('{s}') !== -1 && options.subdomains) { + options.url = options.url.replace('{s}', options.subdomains[0]); + } + this.service = mapService(options); + this.service.addEventParent(this); + + var arcgisonline = new RegExp(/tiles.arcgis(online)?\.com/g); + if (arcgisonline.test(options.url)) { + this.tileUrl = this.tileUrl.replace('://tiles', '://tiles{s}'); + options.subdomains = ['1', '2', '3', '4']; + } + + if (this.options.token) { + this.tileUrl += ('?token=' + this.options.token); + } + + // init layer by calling TileLayers initialize method + leaflet.TileLayer.prototype.initialize.call(this, this.tileUrl, options); + }, + + getTileUrl: function (tilePoint) { + var zoom = this._getZoomForUrl(); + + return leaflet.Util.template(this.tileUrl, leaflet.Util.extend({ + s: this._getSubdomain(tilePoint), + x: tilePoint.x, + y: tilePoint.y, + // try lod map first, then just default to zoom level + z: (this._lodMap && this._lodMap[zoom] !== undefined) ? this._lodMap[zoom] : zoom + }, this.options)); + }, + + createTile: function (coords, done) { + var tile = document.createElement('img'); + + leaflet.DomEvent.on(tile, 'load', leaflet.Util.bind(this._tileOnLoad, this, done, tile)); + leaflet.DomEvent.on(tile, 'error', leaflet.Util.bind(this._tileOnError, this, done, tile)); + + if (this.options.crossOrigin) { + tile.crossOrigin = ''; + } + + /* + Alt tag is set to empty string to keep screen readers from reading URL and for compliance reasons + http://www.w3.org/TR/WCAG20-TECHS/H67 + */ + tile.alt = ''; + + // if there is no lod map or an lod map with a proper zoom load the tile + // otherwise wait for the lod map to become available + if (!this._lodMap || (this._lodMap && this._lodMap[this._getZoomForUrl()] !== undefined)) { + tile.src = this.getTileUrl(coords); + } else { + this.once('lodmap', function () { + tile.src = this.getTileUrl(coords); + }, this); + } + + return tile; + }, + + onAdd: function (map) { + // include 'Powered by Esri' in map attribution + setEsriAttribution(map); + + if (!this._lodMap) { + this.metadata(function (error, metadata) { + if (!error && metadata.spatialReference) { + var sr = metadata.spatialReference.latestWkid || metadata.spatialReference.wkid; + // display the copyright text from the service using leaflet's attribution control + if (!this.options.attribution && map.attributionControl && metadata.copyrightText) { + this.options.attribution = metadata.copyrightText; + map.attributionControl.addAttribution(this.getAttribution()); + } + + // if the service tiles were published in web mercator using conventional LODs but missing levels, we can try and remap them + if (map.options.crs === leaflet.CRS.EPSG3857 && (sr === 102100 || sr === 3857)) { + this._lodMap = {}; + // create the zoom level data + var arcgisLODs = metadata.tileInfo.lods; + var correctResolutions = TiledMapLayer.MercatorZoomLevels; + + for (var i = 0; i < arcgisLODs.length; i++) { + var arcgisLOD = arcgisLODs[i]; + for (var ci in correctResolutions) { + var correctRes = correctResolutions[ci]; + + if (this._withinPercentage(arcgisLOD.resolution, correctRes, this.options.zoomOffsetAllowance)) { + this._lodMap[ci] = arcgisLOD.level; + break; + } + } + } + + this.fire('lodmap'); + } else if (map.options.crs && map.options.crs.code && (map.options.crs.code.indexOf(sr) > -1)) ; else { + // if the service was cached in a custom projection and an appropriate LOD hasn't been defined in the map, guide the developer to our Proj4 sample + warn('L.esri.TiledMapLayer is using a non-mercator spatial reference. Support may be available through Proj4Leaflet https://developers.arcgis.com/esri-leaflet/samples/non-mercator-projection/'); + } + } + }, this); + } + + leaflet.TileLayer.prototype.onAdd.call(this, map); + }, + + onRemove: function (map) { + removeEsriAttribution(map); + + leaflet.TileLayer.prototype.onRemove.call(this, map); + }, + + metadata: function (callback, context) { + this.service.metadata(callback, context); + return this; + }, + + identify: function () { + return this.service.identify(); + }, + + find: function () { + return this.service.find(); + }, + + query: function () { + return this.service.query(); + }, + + 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; + }, + + _withinPercentage: function (a, b, percentage) { + var diff = Math.abs((a / b) - 1); + return diff < percentage; + } + }); + + function tiledMapLayer (url, options) { + return new TiledMapLayer(url, options); + } + + var Overlay = leaflet.ImageOverlay.extend({ + onAdd: function (map) { + this._topLeft = map.getPixelBounds().min; + leaflet.ImageOverlay.prototype.onAdd.call(this, map); + }, + _reset: function () { + if (this._map.options.crs === leaflet.CRS.EPSG3857) { + leaflet.ImageOverlay.prototype._reset.call(this); + } else { + leaflet.DomUtil.setPosition(this._image, this._topLeft.subtract(this._map.getPixelOrigin())); + } + } + }); + + var RasterLayer = leaflet.Layer.extend({ + options: { + opacity: 1, + position: 'front', + f: 'image', + useCors: cors, + attribution: null, + interactive: false, + alt: '' + }, + + onAdd: function (map) { + // include 'Powered by Esri' in map attribution + setEsriAttribution(map); + + if (this.options.zIndex) { + this.options.position = null; + } + + this._update = leaflet.Util.throttle(this._update, this.options.updateInterval, this); + + map.on('moveend', this._update, this); + + // if we had an image loaded and it matches the + // current bounds show the image otherwise remove it + if (this._currentImage && this._currentImage._bounds.equals(this._map.getBounds())) { + map.addLayer(this._currentImage); + } else if (this._currentImage) { + this._map.removeLayer(this._currentImage); + this._currentImage = null; + } + + this._update(); + + if (this._popup) { + this._map.on('click', this._getPopupData, this); + this._map.on('dblclick', this._resetPopupState, this); + } + + // add copyright text listed in service metadata + this.metadata(function (err, metadata) { + if (!err && !this.options.attribution && map.attributionControl && metadata.copyrightText) { + this.options.attribution = metadata.copyrightText; + map.attributionControl.addAttribution(this.getAttribution()); + } + }, this); + }, + + onRemove: function (map) { + removeEsriAttribution(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); + }, + + bindPopup: function (fn, popupOptions) { + this._shouldRenderPopup = false; + this._lastClick = false; + this._popup = leaflet.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; + }, + + bringToFront: function () { + this.options.position = 'front'; + if (this._currentImage) { + this._currentImage.bringToFront(); + this._setAutoZIndex(Math.max); + } + return this; + }, + + bringToBack: function () { + this.options.position = 'back'; + if (this._currentImage) { + this._currentImage.bringToBack(); + this._setAutoZIndex(Math.min); + } + return this; + }, + + setZIndex: function (value) { + this.options.zIndex = value; + if (this._currentImage) { + this._currentImage.setZIndex(value); + } + return this; + }, + + _setAutoZIndex: function (compare) { + // go through all other layers of the same pane, set zIndex to max + 1 (front) or min - 1 (back) + if (!this._currentImage) { + return; + } + var layers = this._currentImage.getPane().children; + var edgeZIndex = -compare(-Infinity, Infinity); // -Infinity for max, Infinity for min + for (var i = 0, len = layers.length, zIndex; i < len; i++) { + zIndex = layers[i].style.zIndex; + if (layers[i] !== this._currentImage._image && zIndex) { + edgeZIndex = compare(edgeZIndex, +zIndex); + } + } + + if (isFinite(edgeZIndex)) { + this.options.zIndex = edgeZIndex + compare(-1, 1); + this.setZIndex(this.options.zIndex); + } + }, + + getAttribution: function () { + return this.options.attribution; + }, + + getOpacity: function () { + return this.options.opacity; + }, + + setOpacity: function (opacity) { + this.options.opacity = opacity; + if (this._currentImage) { + 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; + }, + + redraw: function () { + this._update(); + }, + + _renderImage: function (url, bounds, contentType) { + if (this._map) { + // if no output directory has been specified for a service, MIME data will be returned + if (contentType) { + url = 'data:' + contentType + ';base64,' + url; + } + + // if server returns an inappropriate response, abort. + if (!url) return; + + // create a new image overlay and add it to the map + // to start loading the image + // opacity is 0 while the image is loading + var image = new Overlay(url, bounds, { + opacity: 0, + crossOrigin: this.options.withCredentials ? 'use-credentials' : this.options.useCors, + alt: this.options.alt, + pane: this.options.pane || this.getPane(), + interactive: this.options.interactive + }).addTo(this._map); + + var onOverlayError = function () { + this._map.removeLayer(image); + this.fire('error'); + image.off('load', onOverlayLoad, this); + }; + + var onOverlayLoad = function (e) { + image.off('error', onOverlayError, this); + if (this._map) { + var newImage = e.target; + var oldImage = this._currentImage; + + // if the bounds of this image matches the bounds that + // _renderImage was called with and we have a map with the same bounds + // hide the old image if there is one and set the opacity + // of the new image otherwise remove the new image + if (newImage._bounds.equals(bounds) && newImage._bounds.equals(this._map.getBounds())) { + this._currentImage = newImage; + + if (this.options.position === 'front') { + this.bringToFront(); + } else if (this.options.position === 'back') { + this.bringToBack(); + } + + if (this.options.zIndex) { + this.setZIndex(this.options.zIndex); + } + + if (this._map && this._currentImage._map) { + this._currentImage.setOpacity(this.options.opacity); + } else { + this._currentImage._map.removeLayer(this._currentImage); + } + + if (oldImage && this._map) { + this._map.removeLayer(oldImage); + } + + if (oldImage && oldImage._map) { + oldImage._map.removeLayer(oldImage); + } + } else { + this._map.removeLayer(newImage); + } + } + + this.fire('load', { + bounds: bounds + }); + }; + + // If loading the image fails + image.once('error', onOverlayError, this); + + // once the image loads + image.once('load', onOverlayLoad, this); + } + }, + + _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) { + if (this._currentImage) { + this._currentImage._map.removeLayer(this._currentImage); + this._currentImage = null; + } + return; + } + + var params = this._buildExportParams(); + leaflet.Util.extend(params, this.options.requestParams); + + if (params) { + this._requestExport(params, bounds); + + this.fire('loading', { + bounds: bounds + }); + } else if (this._currentImage) { + this._currentImage._map.removeLayer(this._currentImage); + this._currentImage = null; + } + }, + + _renderPopup: function (latlng, error, results, response) { + latlng = leaflet.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; + }, + + _calculateBbox: function () { + var pixelBounds = this._map.getPixelBounds(); + + var sw = this._map.unproject(pixelBounds.getBottomLeft()); + var ne = this._map.unproject(pixelBounds.getTopRight()); + + var neProjected = this._map.options.crs.project(ne); + var swProjected = this._map.options.crs.project(sw); + + // this ensures ne/sw are switched in polar maps where north/top bottom/south is inverted + var boundsProjected = leaflet.bounds(neProjected, swProjected); + + return [boundsProjected.getBottomLeft().x, boundsProjected.getBottomLeft().y, boundsProjected.getTopRight().x, boundsProjected.getTopRight().y].join(','); + }, + + _calculateImageSize: function () { + // ensure that we don't ask ArcGIS Server for a taller image than we have actual map displaying within the div + var bounds = this._map.getPixelBounds(); + var size = this._map.getSize(); + + var sw = this._map.unproject(bounds.getBottomLeft()); + var ne = this._map.unproject(bounds.getTopRight()); + + var top = this._map.latLngToLayerPoint(ne).y; + var bottom = this._map.latLngToLayerPoint(sw).y; + + if (top > 0 || bottom < size.y) { + size.y = bottom - top; + } + + return size.x + ',' + size.y; + } + }); + + var ImageMapLayer = RasterLayer.extend({ + + options: { + updateInterval: 150, + format: 'jpgpng', + transparent: true, + f: 'image' + }, + + query: function () { + return this.service.query(); + }, + + identify: function () { + return this.service.identify(); + }, + + initialize: function (options) { + options = getUrlParams(options); + this.service = imageService(options); + this.service.addEventParent(this); + + leaflet.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 (leaflet.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 (leaflet.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 = leaflet.Util.bind(function (error, results, response) { + if (error) { return; } // we really can't do anything here but authenticate or requesterror will fire + setTimeout(leaflet.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 sr = parseInt(this._map.options.crs.code.split(':')[1], 10); + + var params = { + bbox: this._calculateBbox(), + size: this._calculateImageSize(), + format: this.options.format, + transparent: this.options.transparent, + bboxSR: sr, + imageSR: sr + }; + + 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; + } + + // 0 is falsy *and* a valid input parameter + if (this.options.noData === 0 || 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.request('exportImage', params, function (error, response) { + if (error) { return; } // we really can't do anything here but authenticate or requesterror will fire + if (this.options.token) { + response.href += ('?token=' + this.options.token); + } + if (this.options.proxy) { + response.href = this.options.proxy + '?' + response.href; + } + this._renderImage(response.href, bounds); + }, this); + } else { + params.f = 'image'; + var fullUrl = this.options.url + 'exportImage' + leaflet.Util.getParamString(params); + if (this.options.proxy) { + fullUrl = this.options.proxy + '?' + fullUrl; + } + this._renderImage(fullUrl, bounds); + } + } + }); + + function imageMapLayer (url, options) { + return new ImageMapLayer(url, options); + } + + var DynamicMapLayer = RasterLayer.extend({ + + options: { + updateInterval: 150, + layers: false, + layerDefs: false, + timeOptions: false, + format: 'png32', + transparent: true, + f: 'json' + }, + + initialize: function (options) { + options = getUrlParams(options); + this.service = mapService(options); + this.service.addEventParent(this); + + leaflet.Util.setOptions(this, options); + }, + + getDynamicLayers: function () { + return this.options.dynamicLayers; + }, + + setDynamicLayers: function (dynamicLayers) { + this.options.dynamicLayers = dynamicLayers; + this._update(); + return this; + }, + + 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 = leaflet.Util.bind(function (error, featureCollection, response) { + if (error) { return; } // we really can't do anything here but authenticate or requesterror will fire + setTimeout(leaflet.Util.bind(function () { + this._renderPopup(e.latlng, error, featureCollection, response); + }, this), 300); + }, this); + + var identifyRequest; + if (this.options.popup) { + identifyRequest = this.options.popup.on(this._map).at(e.latlng); + } else { + identifyRequest = this.identify().on(this._map).at(e.latlng); + } + + // remove extraneous vertices from response features if it has not already been done + if (!identifyRequest.params.maxAllowableOffset) { + identifyRequest.simplify(this._map, 0.5); + } + + if (!(this.options.popup && this.options.popup.params && this.options.popup.params.layers)) { + if (this.options.layers) { + identifyRequest.layers('visible:' + this.options.layers.join(',')); + } else { + identifyRequest.layers('visible'); + } + } + + // if present, pass layer ids and sql filters through to the identify task + if (this.options.layerDefs && typeof this.options.layerDefs !== 'string' && !identifyRequest.params.layerDefs) { + for (var id in this.options.layerDefs) { + if (Object.prototype.hasOwnProperty.call(this.options.layerDefs, id)) { + identifyRequest.layerDef(id, this.options.layerDefs[id]); + } + } + } + + identifyRequest.run(callback); + + // set the flags to show the popup + this._shouldRenderPopup = true; + this._lastClick = e.latlng; + }, + + _buildExportParams: function () { + var sr = parseInt(this._map.options.crs.code.split(':')[1], 10); + + var params = { + bbox: this._calculateBbox(), + size: this._calculateImageSize(), + dpi: 96, + format: this.options.format, + transparent: this.options.transparent, + bboxSR: sr, + imageSR: sr + }; + + if (this.options.dynamicLayers) { + params.dynamicLayers = this.options.dynamicLayers; + } + + if (this.options.layers) { + if (this.options.layers.length === 0) { + return; + } else { + params.layers = 'show:' + this.options.layers.join(','); + } + } + + if (this.options.layerDefs) { + params.layerDefs = typeof this.options.layerDefs === 'string' ? this.options.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; + } + + if (this.options.proxy) { + params.proxy = this.options.proxy; + } + + // use a timestamp to bust server cache + if (this.options.disableCache) { + params._ts = Date.now(); + } + + return params; + }, + + _requestExport: function (params, bounds) { + if (this.options.f === 'json') { + this.service.request('export', params, function (error, response) { + if (error) { return; } // we really can't do anything here but authenticate or requesterror will fire + + if (this.options.token && response.href) { + response.href += ('?token=' + this.options.token); + } + if (this.options.proxy && response.href) { + response.href = this.options.proxy + '?' + response.href; + } + if (response.href) { + this._renderImage(response.href, bounds); + } else { + this._renderImage(response.imageData, bounds, response.contentType); + } + }, this); + } else { + params.f = 'image'; + var fullUrl = this.options.url + 'export' + leaflet.Util.getParamString(params); + if (this.options.proxy) { + fullUrl = this.options.proxy + '?' + fullUrl; + } + this._renderImage(fullUrl, bounds); + } + } + }); + + function dynamicMapLayer (url, options) { + return new DynamicMapLayer(url, options); + } + + var FeatureGrid = leaflet.Layer.extend({ + // @section + // @aka GridLayer options + options: { + // @option cellSize: Number|Point = 256 + // Width and height of cells in the grid. Use a number if width and height are equal, or `L.point(width, height)` otherwise. + cellSize: 512, + + // @option updateWhenIdle: Boolean = (depends) + // Load new cells only when panning ends. + // `true` by default on mobile browsers, in order to avoid too many requests and keep smooth navigation. + // `false` otherwise in order to display new cells _during_ panning, since it is easy to pan outside the + // [`keepBuffer`](#gridlayer-keepbuffer) option in desktop browsers. + updateWhenIdle: leaflet.Browser.mobile, + + // @option updateInterval: Number = 150 + // Cells will not update more than once every `updateInterval` milliseconds when panning. + updateInterval: 150, + + // @option noWrap: Boolean = false + // Whether the layer is wrapped around the antimeridian. If `true`, the + // GridLayer will only be displayed once at low zoom levels. Has no + // effect when the [map CRS](#map-crs) doesn't wrap around. Can be used + // in combination with [`bounds`](#gridlayer-bounds) to prevent requesting + // cells outside the CRS limits. + noWrap: false, + + // @option keepBuffer: Number = 1.5 + // When panning the map, keep this many rows and columns of cells before unloading them. + keepBuffer: 1.5 + }, + + initialize: function (options) { + leaflet.Util.setOptions(this, options); + }, + + onAdd: function (map) { + this._cells = {}; + this._activeCells = {}; + this._resetView(); + this._update(); + }, + + onRemove: function (map) { + this._removeAllCells(); + this._cellZoom = undefined; + }, + + // @method isLoading: Boolean + // Returns `true` if any cell in the grid layer has not finished loading. + isLoading: function () { + return this._loading; + }, + + // @method redraw: this + // Causes the layer to clear all the cells and request them again. + redraw: function () { + if (this._map) { + this._removeAllCells(); + this._update(); + } + return this; + }, + + getEvents: function () { + var events = { + viewprereset: this._invalidateAll, + viewreset: this._resetView, + zoom: this._resetView, + moveend: this._onMoveEnd + }; + + if (!this.options.updateWhenIdle) { + // update cells on move, but not more often than once per given interval + if (!this._onMove) { + this._onMove = leaflet.Util.throttle( + this._onMoveEnd, + this.options.updateInterval, + this + ); + } + + events.move = this._onMove; + } + + return events; + }, + + // @section Extension methods + // Layers extending `GridLayer` shall reimplement the following method. + // @method createCell(coords: Object, done?: Function): HTMLElement + // Called only internally, must be overridden by classes extending `GridLayer`. + // Returns the `HTMLElement` corresponding to the given `coords`. If the `done` callback + // is specified, it must be called when the cell has finished loading and drawing. + createCell: function () { + return document.createElement('div'); + }, + + removeCell: function () { + + }, + + reuseCell: function () { + + }, + + cellLeave: function () { + + }, + + cellEnter: function () { + + }, + // @section + // @method getCellSize: Point + // Normalizes the [cellSize option](#gridlayer-cellsize) into a point. Used by the `createCell()` method. + getCellSize: function () { + var s = this.options.cellSize; + return s instanceof leaflet.Point ? s : new leaflet.Point(s, s); + }, + + _pruneCells: function () { + if (!this._map) { + return; + } + + var key, cell; + + for (key in this._cells) { + cell = this._cells[key]; + cell.retain = cell.current; + } + + for (key in this._cells) { + cell = this._cells[key]; + if (cell.current && !cell.active) { + var coords = cell.coords; + if (!this._retainParent(coords.x, coords.y, coords.z, coords.z - 5)) { + this._retainChildren(coords.x, coords.y, coords.z, coords.z + 2); + } + } + } + + for (key in this._cells) { + if (!this._cells[key].retain) { + this._removeCell(key); + } + } + }, + + _removeAllCells: function () { + for (var key in this._cells) { + this._removeCell(key); + } + }, + + _invalidateAll: function () { + this._removeAllCells(); + + this._cellZoom = undefined; + }, + + _retainParent: function (x, y, z, minZoom) { + var x2 = Math.floor(x / 2); + var y2 = Math.floor(y / 2); + var z2 = z - 1; + var coords2 = new leaflet.Point(+x2, +y2); + coords2.z = +z2; + + var key = this._cellCoordsToKey(coords2); + var cell = this._cells[key]; + + if (cell && cell.active) { + cell.retain = true; + return true; + } else if (cell && cell.loaded) { + cell.retain = true; + } + + if (z2 > minZoom) { + return this._retainParent(x2, y2, z2, minZoom); + } + + return false; + }, + + _retainChildren: function (x, y, z, maxZoom) { + for (var i = 2 * x; i < 2 * x + 2; i++) { + for (var j = 2 * y; j < 2 * y + 2; j++) { + var coords = new leaflet.Point(i, j); + coords.z = z + 1; + + var key = this._cellCoordsToKey(coords); + var cell = this._cells[key]; + + if (cell && cell.active) { + cell.retain = true; + continue; + } else if (cell && cell.loaded) { + cell.retain = true; + } + + if (z + 1 < maxZoom) { + this._retainChildren(i, j, z + 1, maxZoom); + } + } + } + }, + + _resetView: function (e) { + var animating = e && (e.pinch || e.flyTo); + + if (animating) { + return; + } + + this._setView( + this._map.getCenter(), + this._map.getZoom(), + animating, + animating + ); + }, + + _setView: function (center, zoom, noPrune, noUpdate) { + var cellZoom = Math.round(zoom); + + if (!noUpdate) { + this._cellZoom = cellZoom; + + if (this._abortLoading) { + this._abortLoading(); + } + + this._resetGrid(); + + if (cellZoom !== undefined) { + this._update(center); + } + + if (!noPrune) { + this._pruneCells(); + } + + // Flag to prevent _updateOpacity from pruning cells during + // a zoom anim or a pinch gesture + this._noPrune = !!noPrune; + } + }, + + _resetGrid: function () { + var map = this._map; + var crs = map.options.crs; + var cellSize = (this._cellSize = this.getCellSize()); + var cellZoom = this._cellZoom; + + var bounds = this._map.getPixelWorldBounds(this._cellZoom); + if (bounds) { + this._globalCellRange = this._pxBoundsToCellRange(bounds); + } + + this._wrapX = crs.wrapLng && + !this.options.noWrap && [ + Math.floor(map.project([0, crs.wrapLng[0]], cellZoom).x / cellSize.x), + Math.ceil(map.project([0, crs.wrapLng[1]], cellZoom).x / cellSize.y) + ]; + this._wrapY = crs.wrapLat && + !this.options.noWrap && [ + Math.floor(map.project([crs.wrapLat[0], 0], cellZoom).y / cellSize.x), + Math.ceil(map.project([crs.wrapLat[1], 0], cellZoom).y / cellSize.y) + ]; + }, + + _onMoveEnd: function (e) { + var animating = e && (e.pinch || e.flyTo); + + if (animating || !this._map || this._map._animatingZoom) { + return; + } + + this._update(); + }, + + _getCelldPixelBounds: function (center) { + var map = this._map; + var mapZoom = map._animatingZoom + ? Math.max(map._animateToZoom, map.getZoom()) + : map.getZoom(); + var scale = map.getZoomScale(mapZoom, this._cellZoom); + var pixelCenter = map.project(center, this._cellZoom).floor(); + var halfSize = map.getSize().divideBy(scale * 2); + + return new leaflet.Bounds( + pixelCenter.subtract(halfSize), + pixelCenter.add(halfSize) + ); + }, + + // Private method to load cells in the grid's active zoom level according to map bounds + _update: function (center) { + var map = this._map; + if (!map) { + return; + } + var zoom = Math.round(map.getZoom()); + + if (center === undefined) { + center = map.getCenter(); + } + + var pixelBounds = this._getCelldPixelBounds(center); + var cellRange = this._pxBoundsToCellRange(pixelBounds); + var cellCenter = cellRange.getCenter(); + var queue = []; + var margin = this.options.keepBuffer; + var noPruneRange = new leaflet.Bounds( + cellRange.getBottomLeft().subtract([margin, -margin]), + cellRange.getTopRight().add([margin, -margin]) + ); + + // Sanity check: panic if the cell range contains Infinity somewhere. + if ( + !( + isFinite(cellRange.min.x) && + isFinite(cellRange.min.y) && + isFinite(cellRange.max.x) && + isFinite(cellRange.max.y) + ) + ) { + throw new Error('Attempted to load an infinite number of cells'); + } + + for (var key in this._cells) { + var c = this._cells[key].coords; + if ( + c.z !== this._cellZoom || + !noPruneRange.contains(new leaflet.Point(c.x, c.y)) + ) { + this._cells[key].current = false; + } + } + + // _update just loads more cells. If the cell zoom level differs too much + // from the map's, let _setView reset levels and prune old cells. + if (Math.abs(zoom - this._cellZoom) > 1) { + this._setView(center, zoom); + return; + } + + // create a queue of coordinates to load cells from + for (var j = cellRange.min.y; j <= cellRange.max.y; j++) { + for (var i = cellRange.min.x; i <= cellRange.max.x; i++) { + var coords = new leaflet.Point(i, j); + coords.z = this._cellZoom; + + if (!this._isValidCell(coords)) { + continue; + } + + var cell = this._cells[this._cellCoordsToKey(coords)]; + if (cell) { + cell.current = true; + } else { + queue.push(coords); + } + } + } + + // sort cell queue to load cells in order of their distance to center + queue.sort(function (a, b) { + return a.distanceTo(cellCenter) - b.distanceTo(cellCenter); + }); + + if (queue.length !== 0) { + // if it's the first batch of cells to load + if (!this._loading) { + this._loading = true; + } + + for (i = 0; i < queue.length; i++) { + var _key = this._cellCoordsToKey(queue[i]); + var _coords = this._keyToCellCoords(_key); + if (this._activeCells[_coords]) { + this._reuseCell(queue[i]); + } else { + this._createCell(queue[i]); + } + } + } + }, + + _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._globalCellRange; + 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 leaflet.toLatLngBounds(this.options.bounds).overlaps(cellBounds); + }, + + _keyToBounds: function (key) { + return this._cellCoordsToBounds(this._keyToCellCoords(key)); + }, + + _cellCoordsToNwSe: function (coords) { + var map = this._map; + var cellSize = this.getCellSize(); + var nwPoint = coords.scaleBy(cellSize); + var sePoint = nwPoint.add(cellSize); + var nw = map.unproject(nwPoint, coords.z); + var se = map.unproject(sePoint, coords.z); + + return [nw, se]; + }, + + // converts cell coordinates to its geographical bounds + _cellCoordsToBounds: function (coords) { + var bp = this._cellCoordsToNwSe(coords); + var bounds = new leaflet.LatLngBounds(bp[0], bp[1]); + + if (!this.options.noWrap) { + bounds = this._map.wrapLatLngBounds(bounds); + } + return bounds; + }, + // converts cell coordinates to key for the cell cache + _cellCoordsToKey: function (coords) { + return coords.x + ':' + coords.y + ':' + coords.z; + }, + + // converts cell cache key to coordinates + _keyToCellCoords: function (key) { + var k = key.split(':'); + var coords = new leaflet.Point(+k[0], +k[1]); + + coords.z = +k[2]; + return coords; + }, + + _removeCell: function (key) { + var cell = this._cells[key]; + + if (!cell) { + return; + } + + var coords = this._keyToCellCoords(key); + var wrappedCoords = this._wrapCoords(coords); + var cellBounds = this._cellCoordsToBounds(this._wrapCoords(coords)); + + cell.current = false; + + delete this._cells[key]; + this._activeCells[key] = cell; + + this.cellLeave(cellBounds, wrappedCoords, key); + + this.fire('cellleave', { + key: key, + coords: wrappedCoords, + bounds: cellBounds + }); + }, + + _reuseCell: function (coords) { + var key = this._cellCoordsToKey(coords); + + // save cell in cache + this._cells[key] = this._activeCells[key]; + this._cells[key].current = true; + + var wrappedCoords = this._wrapCoords(coords); + var cellBounds = this._cellCoordsToBounds(this._wrapCoords(coords)); + + this.cellEnter(cellBounds, wrappedCoords, key); + + this.fire('cellenter', { + key: key, + coords: wrappedCoords, + bounds: cellBounds + }); + }, + + _createCell: function (coords) { + var key = this._cellCoordsToKey(coords); + + var wrappedCoords = this._wrapCoords(coords); + var cellBounds = this._cellCoordsToBounds(this._wrapCoords(coords)); + + this.createCell(cellBounds, wrappedCoords, key); + + this.fire('cellcreate', { + key: key, + coords: wrappedCoords, + bounds: cellBounds + }); + + // save cell in cache + this._cells[key] = { + coords: coords, + current: true + }; + + leaflet.Util.requestAnimFrame(this._pruneCells, this); + }, + + _cellReady: function (coords, err, cell) { + var key = this._cellCoordsToKey(coords); + + cell = this._cells[key]; + + if (!cell) { + return; + } + + cell.loaded = +new Date(); + + cell.active = true; + }, + + _getCellPos: function (coords) { + return coords.scaleBy(this.getCellSize()); + }, + + _wrapCoords: function (coords) { + var newCoords = new leaflet.Point( + this._wrapX ? leaflet.Util.wrapNum(coords.x, this._wrapX) : coords.x, + this._wrapY ? leaflet.Util.wrapNum(coords.y, this._wrapY) : coords.y + ); + newCoords.z = coords.z; + return newCoords; + }, + + _pxBoundsToCellRange: function (bounds) { + var cellSize = this.getCellSize(); + return new leaflet.Bounds( + bounds.min.unscaleBy(cellSize).floor(), + bounds.max.unscaleBy(cellSize).ceil().subtract([1, 1]) + ); + } + }); + + function BinarySearchIndex (values) { + this.values = [].concat(values || []); + } + + BinarySearchIndex.prototype.query = function (value) { + var index = this.getIndex(value); + return this.values[index]; + }; + + BinarySearchIndex.prototype.getIndex = function getIndex (value) { + if (this.dirty) { + this.sort(); + } + + var minIndex = 0; + var maxIndex = this.values.length - 1; + var currentIndex; + var currentElement; + + while (minIndex <= maxIndex) { + currentIndex = (minIndex + maxIndex) / 2 | 0; + currentElement = this.values[Math.round(currentIndex)]; + if (+currentElement.value < +value) { + minIndex = currentIndex + 1; + } else if (+currentElement.value > +value) { + maxIndex = currentIndex - 1; + } else { + return currentIndex; + } + } + + return Math.abs(~maxIndex); + }; + + BinarySearchIndex.prototype.between = function between (start, end) { + var startIndex = this.getIndex(start); + var endIndex = this.getIndex(end); + + if (startIndex === 0 && endIndex === 0) { + return []; + } + + while (this.values[startIndex - 1] && this.values[startIndex - 1].value === start) { + startIndex--; + } + + while (this.values[endIndex + 1] && this.values[endIndex + 1].value === end) { + endIndex++; + } + + if (this.values[endIndex] && this.values[endIndex].value === end && this.values[endIndex + 1]) { + endIndex++; + } + + return this.values.slice(startIndex, endIndex); + }; + + BinarySearchIndex.prototype.insert = function insert (item) { + this.values.splice(this.getIndex(item.value), 0, item); + return this; + }; + + BinarySearchIndex.prototype.bulkAdd = function bulkAdd (items, sort) { + this.values = this.values.concat([].concat(items || [])); + + if (sort) { + this.sort(); + } else { + this.dirty = true; + } + + return this; + }; + + BinarySearchIndex.prototype.sort = function sort () { + this.values.sort(function (a, b) { + return +b.value - +a.value; + }).reverse(); + this.dirty = false; + return this; + }; + + var FeatureManager = FeatureGrid.extend({ + /** + * Options + */ + + options: { + attribution: null, + where: '1=1', + fields: ['*'], + from: false, + to: false, + timeField: false, + timeFilterMode: 'server', + simplifyFactor: 0, + precision: 6, + fetchAllFeatures: false + }, + + /** + * Constructor + */ + + initialize: function (options) { + FeatureGrid.prototype.initialize.call(this, options); + + options = getUrlParams(options); + options = leaflet.Util.setOptions(this, options); + + this.service = featureLayerService(options); + this.service.addEventParent(this); + + // use case insensitive regex to look for common fieldnames used for indexing + 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) { + 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.' + ); + } + } + + 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._cache = {}; + this._currentSnapshot = []; // cache of what layers should be active + this._activeRequests = 0; + }, + + /** + * Layer Interface + */ + + onAdd: function (map) { + // include 'Powered by Esri' in map attribution + setEsriAttribution(map); + + this.service.metadata(function (err, metadata) { + if (!err) { + var supportedFormats = metadata.supportedQueryFormats; + + // Check if someone has requested that we don't use geoJSON, even if it's available + var forceJsonFormat = false; + if ( + this.service.options.isModern === false || + this.options.fetchAllFeatures + ) { + forceJsonFormat = true; + } + + // Unless we've been told otherwise, check to see whether service can emit GeoJSON natively + if ( + !forceJsonFormat && + supportedFormats && + supportedFormats.indexOf('geoJSON') !== -1 + ) { + this.service.options.isModern = true; + } + + if (metadata.objectIdField) { + this.service.options.idAttribute = metadata.objectIdField; + } + + // add copyright text listed in service metadata + if ( + !this.options.attribution && + map.attributionControl && + metadata.copyrightText + ) { + this.options.attribution = metadata.copyrightText; + map.attributionControl.addAttribution(this.getAttribution()); + } + } + }, this); + + map.on('zoomend', this._handleZoomChange, this); + + return FeatureGrid.prototype.onAdd.call(this, map); + }, + + onRemove: function (map) { + removeEsriAttribution(map); + map.off('zoomend', this._handleZoomChange, this); + + return FeatureGrid.prototype.onRemove.call(this, map); + }, + + getAttribution: function () { + return this.options.attribution; + }, + + /** + * Feature Management + */ + + createCell: function (bounds, coords) { + // dont fetch features outside the scale range defined for the layer + if (this._visibleZoom()) { + this._requestFeatures(bounds, coords); + } + }, + + _requestFeatures: function (bounds, coords, callback, offset) { + this._activeRequests++; + + // default param + offset = offset || 0; + + var originalWhere = this.options.where; + + // our first active request fires loading + if (this._activeRequests === 1) { + this.fire( + 'loading', + { + bounds: bounds + }, + true + ); + } + + return this._buildQuery(bounds, offset).run(function ( + error, + featureCollection, + response + ) { + if (response && response.exceededTransferLimit) { + this.fire('drawlimitexceeded'); + } + + // the where changed while this request was being run so don't it. + if (this.options.where !== originalWhere) { + return; + } + + // no error, features + if (!error && featureCollection && featureCollection.features.length) { + // schedule adding features until the next animation frame + leaflet.Util.requestAnimFrame( + leaflet.Util.bind(function () { + this._addFeatures(featureCollection.features, coords); + this._postProcessFeatures(bounds); + }, this) + ); + } + + // no error, no features + if (!error && featureCollection && !featureCollection.features.length) { + this._postProcessFeatures(bounds); + } + + if (error) { + this._postProcessFeatures(bounds); + } + + if (callback) { + callback.call(this, error, featureCollection); + } + if ( + response && + (response.exceededTransferLimit || + (response.properties && response.properties.exceededTransferLimit)) && + this.options.fetchAllFeatures + ) { + this._requestFeatures( + bounds, + coords, + callback, + offset + featureCollection.features.length + ); + } + }, + this); + }, + + _postProcessFeatures: function (bounds) { + // deincrement the request counter now that we have processed features + this._activeRequests--; + + // if there are no more active requests fire a load event for this view + if (this._activeRequests <= 0) { + this.fire('load', { + bounds: bounds + }); + } + }, + + _cacheKey: function (coords) { + return coords.z + ':' + coords.x + ':' + coords.y; + }, + + _addFeatures: function (features, coords) { + // coords is optional - will be false if coming from addFeatures() function + if (coords) { + var key = this._cacheKey(coords); + this._cache[key] = this._cache[key] || []; + } + + for (var i = features.length - 1; i >= 0; i--) { + var id = features[i].id; + + if (this._currentSnapshot.indexOf(id) === -1) { + this._currentSnapshot.push(id); + } + if (typeof key !== 'undefined' && this._cache[key].indexOf(id) === -1) { + this._cache[key].push(id); + } + } + + if (this.options.timeField) { + this._buildTimeIndexes(features); + } + + this.createLayers(features); + }, + + _buildQuery: function (bounds, offset) { + var query = this.service + .query() + .intersects(bounds) + .where(this.options.where) + .fields(this.options.fields) + .precision(this.options.precision); + + if (this.options.fetchAllFeatures && !isNaN(parseInt(offset))) { + query = query.offset(offset); + } + + query.params['resultType'] = 'tile'; + + if (this.options.requestParams) { + leaflet.Util.extend(query.params, this.options.requestParams); + } + + 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 newSnapshot = []; + var pendingRequests = 0; + var requestError = null; + var requestCallback = leaflet.Util.bind(function (error, featureCollection) { + if (error) { + requestError = error; + } + + if (featureCollection) { + for (var i = featureCollection.features.length - 1; i >= 0; i--) { + newSnapshot.push(featureCollection.features[i].id); + } + } + + pendingRequests--; + + if ( + pendingRequests <= 0 && + this._visibleZoom() && + where === this.options.where // the where is still the same so use this one + ) { + this._currentSnapshot = newSnapshot; + // schedule adding features for the next animation frame + leaflet.Util.requestAnimFrame( + leaflet.Util.bind(function () { + this.removeLayers(oldSnapshot); + this.addLayers(newSnapshot); + if (callback) { + callback.call(context, requestError); + } + }, this) + ); + } + }, this); + + for (var i = this._currentSnapshot.length - 1; i >= 0; i--) { + oldSnapshot.push(this._currentSnapshot[i]); + } + + this._cache = {}; + + for (var key in this._cells) { + pendingRequests++; + var coords = this._keyToCellCoords(key); + var bounds = this._cellCoordsToBounds(coords); + this._requestFeatures(bounds, coords, 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 = leaflet.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._cells) { + pendingRequests++; + var coords = this._keyToCellCoords(key); + var bounds = this._cellCoordsToBounds(coords); + this._requestFeatures(bounds, coords, requestCallback); + } + } + + return this; + }, + + refresh: function () { + this.setWhere(this.options.where); + }, + + _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); + } + } + } + + // schedule adding features until the next animation frame + leaflet.Util.requestAnimFrame( + leaflet.Util.bind(function () { + this.removeLayers(layersToRemove); + this.addLayers(layersToAdd); + }, this) + ); + }, + + _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 if (this._timeIndex) { + search = this._timeIndex.between(start, end); + } else { + warn( + 'You must set timeField in the layer constructor in order to manipulate the start and end time filter.' + ); + return []; + } + + 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) || + (startDate <= from && endDate >= to) + ); + } + }, + + _visibleZoom: function () { + // check to see whether the current zoom level of the map is within the optional limit defined for the FeatureLayer + if (!this._map) { + return false; + } + var zoom = this._map.getZoom(); + if (zoom > this.options.maxZoom || zoom < this.options.minZoom) { + return false; + } else { + return true; + } + }, + + _handleZoomChange: function () { + if (!this._visibleZoom()) { + // if we have moved outside the visible zoom range clear the current snapshot, no layers should be active + this.removeLayers(this._currentSnapshot); + this._currentSnapshot = []; + } else { + /* + for every cell in this._cells + 1. Get the cache key for the coords of the cell + 2. If this._cache[key] exists it will be an array of feature IDs. + 3. Call this.addLayers(this._cache[key]) to instruct the feature layer to add the layers back. + */ + for (var i in this._cells) { + var coords = this._cells[i].coords; + var key = this._cacheKey(coords); + if (this._cache[key]) { + this.addLayers(this._cache[key]); + } + } + } + }, + + /** + * 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(); + }, + + _getMetadata: function (callback) { + if (this._metadata) { + var error; + callback(error, this._metadata); + } else { + this.metadata( + leaflet.Util.bind(function (error, response) { + this._metadata = response; + callback(error, this._metadata); + }, this) + ); + } + }, + + addFeature: function (feature, callback, context) { + this.addFeatures(feature, callback, context); + }, + + addFeatures: function (features, callback, context) { + this._getMetadata( + leaflet.Util.bind(function (error, metadata) { + if (error) { + if (callback) { + callback.call(this, error, null); + } + return; + } + // GeoJSON featureCollection or simple feature + var featuresArray = features.features ? features.features : [features]; + + this.service.addFeatures( + features, + leaflet.Util.bind(function (error, response) { + if (!error) { + for (var i = featuresArray.length - 1; i >= 0; i--) { + // assign ID from result to appropriate objectid field from service metadata + featuresArray[i].properties[metadata.objectIdField] = + featuresArray.length > 1 + ? response[i].objectId + : response.objectId; + // we also need to update the geojson id for createLayers() to function + featuresArray[i].id = + featuresArray.length > 1 + ? response[i].objectId + : response.objectId; + } + this._addFeatures(featuresArray); + } + + if (callback) { + callback.call(context, error, response); + } + }, this) + ); + }, this) + ); + }, + + updateFeature: function (feature, callback, context) { + this.updateFeatures(feature, callback, context); + }, + + updateFeatures: function (features, callback, context) { + // GeoJSON featureCollection or simple feature + var featuresArray = features.features ? features.features : [features]; + this.service.updateFeatures( + features, + function (error, response) { + if (!error) { + for (var i = featuresArray.length - 1; i >= 0; i--) { + this.removeLayers([featuresArray[i].id], true); + } + this._addFeatures(featuresArray); + } + + if (callback) { + callback.call(context, error, response); + } + }, + this + ); + }, + + deleteFeature: function (id, callback, context) { + this.deleteFeatures(id, callback, context); + }, + + deleteFeatures: function (ids, callback, context) { + return this.service.deleteFeatures( + ids, + function (error, response) { + var responseArray = response.length ? response : [response]; + if (!error && responseArray.length > 0) { + for (var i = responseArray.length - 1; i >= 0; i--) { + this.removeLayers([responseArray[i].objectId], true); + } + } + if (callback) { + callback.call(context, error, response); + } + }, + this + ); + } + }); + + var FeatureLayer = FeatureManager.extend({ + options: { + cacheLayers: true + }, + + /** + * Constructor + */ + initialize: function (options) { + if (options.apikey) { + options.token = options.apikey; + } + FeatureManager.prototype.initialize.call(this, options); + this._originalStyle = this.options.style; + this._layers = {}; + }, + + /** + * Layer Interface + */ + + onRemove: function (map) { + for (var i in this._layers) { + map.removeLayer(this._layers[i]); + // trigger the event when the entire featureLayer is removed from the map + this.fire( + 'removefeature', + { + feature: this._layers[i].feature, + permanent: false + }, + true + ); + } + + return FeatureManager.prototype.onRemove.call(this, map); + }, + + createNewLayer: function (geojson) { + var layer = leaflet.GeoJSON.geometryToLayer(geojson, this.options); + // trap for GeoJSON without geometry + if (layer) { + layer.defaultOptions = layer.options; + } + return layer; + }, + + _updateLayer: function (layer, geojson) { + // convert the geojson coordinates into a Leaflet LatLng array/nested arrays + // pass it to setLatLngs to update layer geometries + var latlngs = []; + var coordsToLatLng = this.options.coordsToLatLng || leaflet.GeoJSON.coordsToLatLng; + + // copy new attributes, if present + if (geojson.properties) { + layer.feature.properties = geojson.properties; + } + + switch (geojson.geometry.type) { + case 'Point': + latlngs = leaflet.GeoJSON.coordsToLatLng(geojson.geometry.coordinates); + layer.setLatLng(latlngs); + break; + case 'LineString': + latlngs = leaflet.GeoJSON.coordsToLatLngs( + geojson.geometry.coordinates, + 0, + coordsToLatLng + ); + layer.setLatLngs(latlngs); + break; + case 'MultiLineString': + latlngs = leaflet.GeoJSON.coordsToLatLngs( + geojson.geometry.coordinates, + 1, + coordsToLatLng + ); + layer.setLatLngs(latlngs); + break; + case 'Polygon': + latlngs = leaflet.GeoJSON.coordsToLatLngs( + geojson.geometry.coordinates, + 1, + coordsToLatLng + ); + layer.setLatLngs(latlngs); + break; + case 'MultiPolygon': + latlngs = leaflet.GeoJSON.coordsToLatLngs( + geojson.geometry.coordinates, + 2, + coordsToLatLng + ); + layer.setLatLngs(latlngs); + break; + } + + // update symbol/style + this.redraw(layer.feature.id); + }, + + /** + * Feature Management 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 ( + this._visibleZoom() && + layer && + !this._map.hasLayer(layer) && + (!this.options.timeField || this._featureWithinTimeRange(geojson)) + ) { + this._map.addLayer(layer); + this.fire( + 'addfeature', + { + feature: layer.feature + }, + true + ); + } + + // update geometry if the layer already existed. + if (layer && (layer.setLatLngs || layer.setLatLng)) { + this._updateLayer(layer, geojson); + } + + if (!layer) { + newLayer = this.createNewLayer(geojson); + + if (!newLayer) { + warn('invalid GeoJSON encountered'); + } else { + newLayer.feature = geojson; + + // bubble events from individual layers to the feature layer + newLayer.addEventParent(this); + + if (this.options.onEachFeature) { + this.options.onEachFeature(newLayer.feature, newLayer); + } + + // cache the layer + this._layers[newLayer.feature.id] = newLayer; + + // style the layer + this.setFeatureStyle(newLayer.feature.id, this.options.style); + + this.fire( + 'createfeature', + { + feature: newLayer.feature + }, + true + ); + + // add the layer if the current zoom level is inside the range defined for the layer, it is within the current time bounds or our layer is not time enabled + if ( + this._visibleZoom() && + (!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.options.timeField || this._featureWithinTimeRange(layer.feature)) + ) { + this._map.addLayer(layer); + this.fire( + 'addfeature', + { + feature: layer.feature + }, + true + ); + } + } + }, + + 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 + }, + true + ); + this._map.removeLayer(layer); + } + if (layer && permanent) { + delete this._layers[id]; + } + } + }, + + cellEnter: function (bounds, coords) { + if (this._visibleZoom() && !this._zooming && this._map) { + leaflet.Util.requestAnimFrame( + leaflet.Util.bind(function () { + var cacheKey = this._cacheKey(coords); + var cellKey = this._cellCoordsToKey(coords); + var layers = this._cache[cacheKey]; + if (this._activeCells[cellKey] && layers) { + this.addLayers(layers); + } + }, this) + ); + } + }, + + cellLeave: function (bounds, coords) { + if (!this._zooming) { + leaflet.Util.requestAnimFrame( + leaflet.Util.bind(function () { + if (this._map) { + var cacheKey = this._cacheKey(coords); + var cellKey = this._cellCoordsToKey(coords); + var layers = this._cache[cacheKey]; + var mapBounds = this._map.getBounds(); + if (!this._activeCells[cellKey] && layers) { + var removable = true; + + for (var i = 0; i < layers.length; i++) { + var layer = this._layers[layers[i]]; + if ( + layer && + layer.getBounds && + mapBounds.intersects(layer.getBounds()) + ) { + removable = false; + } + } + + if (removable) { + this.removeLayers(layers, !this.options.cacheLayers); + } + + if (!this.options.cacheLayers && removable) { + delete this._cache[cacheKey]; + delete this._cells[cellKey]; + delete this._activeCells[cellKey]; + } + } + } + }, this) + ); + } + }, + + /** + * Styling Methods + */ + + resetStyle: function () { + this.options.style = this._originalStyle; + this.eachFeature(function (layer) { + this.resetFeatureStyle(layer.feature.id); + }, this); + return this; + }, + + setStyle: function (style) { + this.options.style = style; + this.eachFeature(function (layer) { + this.setFeatureStyle(layer.feature.id, style); + }, this); + return this; + }, + + resetFeatureStyle: function (id) { + var layer = this._layers[id]; + var style = this._originalStyle || leaflet.Path.prototype.options; + if (layer) { + leaflet.Util.extend(layer.options, layer.defaultOptions); + this.setFeatureStyle(id, style); + } + 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); + } + return this; + }, + + /** + * Utility Methods + */ + + eachActiveFeature: function (fn, context) { + // figure out (roughly) which layers are in view + if (this._map) { + var activeBounds = this._map.getBounds(); + for (var i in this._layers) { + if (this._currentSnapshot.indexOf(this._layers[i].feature.id) !== -1) { + // a simple point in poly test for point geometries + if ( + typeof this._layers[i].getLatLng === 'function' && + activeBounds.contains(this._layers[i].getLatLng()) + ) { + fn.call(context, this._layers[i]); + } else if ( + typeof this._layers[i].getBounds === 'function' && + activeBounds.intersects(this._layers[i].getBounds()) + ) { + // intersecting bounds check for polyline and polygon geometries + fn.call(context, this._layers[i]); + } + } + } + } + return this; + }, + + 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]; + }, + + bringToBack: function () { + this.eachFeature(function (layer) { + if (layer.bringToBack) { + layer.bringToBack(); + } + }); + }, + + bringToFront: function () { + this.eachFeature(function (layer) { + if (layer.bringToFront) { + layer.bringToFront(); + } + }); + }, + + redraw: function (id) { + if (id) { + this._redraw(id); + } + return this; + }, + + _redraw: function (id) { + var layer = this._layers[id]; + var geojson = layer.feature; + + // if this looks like a marker + if (layer && layer.setIcon && this.options.pointToLayer) { + // update custom symbology, if necessary + if (this.options.pointToLayer) { + var getIcon = this.options.pointToLayer( + geojson, + leaflet.latLng( + geojson.geometry.coordinates[1], + geojson.geometry.coordinates[0] + ) + ); + var updatedIcon = getIcon.options.icon; + layer.setIcon(updatedIcon); + } + } + + // looks like a vector marker (circleMarker) + if (layer && layer.setStyle && this.options.pointToLayer) { + var getStyle = this.options.pointToLayer( + geojson, + leaflet.latLng(geojson.geometry.coordinates[1], geojson.geometry.coordinates[0]) + ); + var updatedStyle = getStyle.options; + this.setFeatureStyle(geojson.id, updatedStyle); + } + + // looks like a path (polygon/polyline) + if (layer && layer.setStyle && this.options.style) { + this.resetFeatureStyle(geojson.id); + } + }, + + // This is the same as the Layer.openPopup method except it excludes the `FeatureGroup` + // logic to work around https://github.com/Leaflet/Leaflet/issues/8761 + openPopup (latlng) { + if (this._popup) { + if (this._popup._prepareOpen(latlng || this._latlng)) { + // open the popup on the map + this._popup.openOn(this._map); + } + } + return this; + }, + + // This is the same as the `Layer.openTooltip` method except it excludes the `FeatureGroup` + // logic to work around https://github.com/Leaflet/Leaflet/issues/8761 + openTooltip (latlng) { + if (this._tooltip) { + if (this._tooltip._prepareOpen(latlng)) { + // open the tooltip on the map + this._tooltip.openOn(this._map); + + if (this.getElement) { + this._setAriaDescribedByOnLayer(this); + } else if (this.eachLayer) { + this.eachLayer(this._setAriaDescribedByOnLayer, this); + } + } + } + return this; + } + }); + + function featureLayer (options) { + return new FeatureLayer(options); + } + + // export version + var version = packageInfo.version; + + exports.BasemapLayer = BasemapLayer; + exports.DynamicMapLayer = DynamicMapLayer; + exports.FeatureLayer = FeatureLayer; + exports.FeatureLayerService = FeatureLayerService; + exports.FeatureManager = FeatureManager; + exports.Find = Find; + exports.Identify = Identify; + exports.IdentifyFeatures = IdentifyFeatures; + exports.IdentifyImage = IdentifyImage; + exports.ImageMapLayer = ImageMapLayer; + exports.ImageService = ImageService; + exports.MapService = MapService; + exports.Query = Query; + exports.RasterLayer = RasterLayer; + exports.Service = Service; + exports.Support = Support; + exports.Task = Task; + exports.TiledMapLayer = TiledMapLayer; + exports.Util = EsriUtil; + exports.VERSION = version; + exports.basemapLayer = basemapLayer; + exports.dynamicMapLayer = dynamicMapLayer; + exports.featureLayer = featureLayer; + exports.featureLayerService = featureLayerService; + exports.find = find; + exports.get = get; + exports.identify = identify; + exports.identifyFeatures = identifyFeatures; + exports.identifyImage = identifyImage; + exports.imageMapLayer = imageMapLayer; + exports.imageService = imageService; + exports.mapService = mapService; + exports.options = options; + exports.post = xmlHttpPost; + exports.query = query; + exports.request = request; + exports.service = service; + exports.task = task; + exports.tiledMapLayer = tiledMapLayer; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +//# sourceMappingURL=esri-leaflet-debug.js.map diff --git a/dist/esri-leaflet-debug.js.map b/dist/esri-leaflet-debug.js.map new file mode 100644 index 000000000..60e57778e --- /dev/null +++ b/dist/esri-leaflet-debug.js.map @@ -0,0 +1 @@ +{"version":3,"file":"esri-leaflet-debug.js","sources":["../src/Support.js","../src/Options.js","../src/Request.js","../node_modules/@terraformer/arcgis/dist/t-arcgis.esm.js","../src/Util.js","../src/Tasks/Task.js","../src/Tasks/Query.js","../src/Tasks/Find.js","../src/Tasks/Identify.js","../src/Tasks/IdentifyFeatures.js","../src/Tasks/IdentifyImage.js","../src/Services/Service.js","../src/Services/MapService.js","../src/Services/ImageService.js","../src/Services/FeatureLayerService.js","../src/Layers/BasemapLayer.js","../src/Layers/TiledMapLayer.js","../src/Layers/RasterLayer.js","../src/Layers/ImageMapLayer.js","../src/Layers/DynamicMapLayer.js","../src/Layers/FeatureLayer/FeatureGrid.js","../node_modules/tiny-binary-search/index.js","../src/Layers/FeatureLayer/FeatureManager.js","../src/Layers/FeatureLayer/FeatureLayer.js","../src/EsriLeaflet.js"],"sourcesContent":["export var cors = ((window.XMLHttpRequest && 'withCredentials' in new window.XMLHttpRequest()));\r\nexport var pointerEvents = document.documentElement.style.pointerEvents === '';\r\n\r\nexport var Support = {\r\n cors: cors,\r\n pointerEvents: pointerEvents\r\n};\r\n\r\nexport default Support;\r\n","export var options = {\r\n attributionWidthOffset: 55\r\n};\r\n\r\nexport default options;\r\n","import { Util, DomUtil } from 'leaflet';\r\nimport { Support } from './Support';\r\n\r\nvar callbacks = 0;\r\n\r\nfunction serialize (params) {\r\n var data = '';\r\n\r\n params.f = params.f || 'json';\r\n\r\n for (var key in params) {\r\n if (Object.prototype.hasOwnProperty.call(params, key)) {\r\n var param = params[key];\r\n var type = Object.prototype.toString.call(param);\r\n var value;\r\n\r\n if (data.length) {\r\n data += '&';\r\n }\r\n\r\n if (type === '[object Array]') {\r\n value = (Object.prototype.toString.call(param[0]) === '[object Object]') ? JSON.stringify(param) : param.join(',');\r\n } else if (type === '[object Object]') {\r\n value = JSON.stringify(param);\r\n } else if (type === '[object Date]') {\r\n value = param.valueOf();\r\n } else {\r\n value = param;\r\n }\r\n\r\n data += encodeURIComponent(key) + '=' + encodeURIComponent(value);\r\n }\r\n }\r\n\r\n const APOSTROPHE_URL_ENCODE = '%27';\r\n return data.replaceAll(\"'\", APOSTROPHE_URL_ENCODE);\r\n}\r\n\r\nfunction createRequest (callback, context) {\r\n var httpRequest = new window.XMLHttpRequest();\r\n\r\n httpRequest.onerror = function (e) {\r\n httpRequest.onreadystatechange = Util.falseFn;\r\n\r\n callback.call(context, {\r\n error: {\r\n code: 500,\r\n message: 'XMLHttpRequest error'\r\n }\r\n }, null);\r\n };\r\n\r\n httpRequest.onreadystatechange = function () {\r\n var response;\r\n var error;\r\n\r\n if (httpRequest.readyState === 4) {\r\n try {\r\n response = JSON.parse(httpRequest.responseText);\r\n } catch (e) {\r\n response = null;\r\n error = {\r\n code: 500,\r\n message: 'Could not parse response as JSON. This could also be caused by a CORS or XMLHttpRequest error.'\r\n };\r\n }\r\n\r\n if (!error && response.error) {\r\n error = response.error;\r\n response = null;\r\n }\r\n\r\n httpRequest.onerror = Util.falseFn;\r\n\r\n callback.call(context, error, response);\r\n }\r\n };\r\n\r\n httpRequest.ontimeout = function () {\r\n this.onerror();\r\n };\r\n\r\n return httpRequest;\r\n}\r\n\r\nfunction xmlHttpPost (url, params, callback, context) {\r\n var httpRequest = createRequest(callback, context);\r\n httpRequest.open('POST', url);\r\n\r\n if (typeof context !== 'undefined' && context !== null) {\r\n if (typeof context.options !== 'undefined') {\r\n httpRequest.timeout = context.options.timeout;\r\n }\r\n }\r\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');\r\n httpRequest.send(serialize(params));\r\n\r\n return httpRequest;\r\n}\r\n\r\nfunction xmlHttpGet (url, params, callback, context) {\r\n var httpRequest = createRequest(callback, context);\r\n httpRequest.open('GET', url + '?' + serialize(params), true);\r\n\r\n if (typeof context !== 'undefined' && context !== null) {\r\n if (typeof context.options !== 'undefined') {\r\n httpRequest.timeout = context.options.timeout;\r\n if (context.options.withCredentials) {\r\n httpRequest.withCredentials = true;\r\n }\r\n }\r\n }\r\n httpRequest.send(null);\r\n\r\n return httpRequest;\r\n}\r\n\r\n// AJAX handlers for CORS (modern browsers) or JSONP (older browsers)\r\nexport function request (url, params, callback, context) {\r\n var paramString = serialize(params);\r\n var httpRequest = createRequest(callback, context);\r\n var requestLength = (url + '?' + paramString).length;\r\n\r\n // ie10/11 require the request be opened before a timeout is applied\r\n if (requestLength <= 2000 && Support.cors) {\r\n httpRequest.open('GET', url + '?' + paramString);\r\n } else if (requestLength > 2000 && Support.cors) {\r\n httpRequest.open('POST', url);\r\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');\r\n }\r\n\r\n if (typeof context !== 'undefined' && context !== null) {\r\n if (typeof context.options !== 'undefined') {\r\n httpRequest.timeout = context.options.timeout;\r\n if (context.options.withCredentials) {\r\n httpRequest.withCredentials = true;\r\n }\r\n }\r\n }\r\n\r\n // request is less than 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest\r\n if (requestLength <= 2000 && Support.cors) {\r\n httpRequest.send(null);\r\n\r\n // request is more than 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest\r\n } else if (requestLength > 2000 && Support.cors) {\r\n httpRequest.send(paramString);\r\n\r\n // request is less than 2000 characters and the browser does not support CORS, make a JSONP request\r\n } else if (requestLength <= 2000 && !Support.cors) {\r\n return jsonp(url, params, callback, context);\r\n\r\n // request is longer then 2000 characters and the browser does not support CORS, log a warning\r\n } else {\r\n warn('a request to ' + url + ' was longer then 2000 characters and this browser cannot make a cross-domain post request. Please use a proxy https://developers.arcgis.com/esri-leaflet/api-reference/request/');\r\n return;\r\n }\r\n\r\n return httpRequest;\r\n}\r\n\r\nexport function jsonp (url, params, callback, context) {\r\n window._EsriLeafletCallbacks = window._EsriLeafletCallbacks || {};\r\n var callbackId = 'c' + callbacks;\r\n params.callback = 'window._EsriLeafletCallbacks.' + callbackId;\r\n\r\n window._EsriLeafletCallbacks[callbackId] = function (response) {\r\n if (window._EsriLeafletCallbacks[callbackId] !== true) {\r\n var error;\r\n var responseType = Object.prototype.toString.call(response);\r\n\r\n if (!(responseType === '[object Object]' || responseType === '[object Array]')) {\r\n error = {\r\n error: {\r\n code: 500,\r\n message: 'Expected array or object as JSONP response'\r\n }\r\n };\r\n response = null;\r\n }\r\n\r\n if (!error && response.error) {\r\n error = response;\r\n response = null;\r\n }\r\n\r\n callback.call(context, error, response);\r\n window._EsriLeafletCallbacks[callbackId] = true;\r\n }\r\n };\r\n\r\n var script = DomUtil.create('script', null, document.body);\r\n script.type = 'text/javascript';\r\n script.src = url + '?' + serialize(params);\r\n script.id = callbackId;\r\n script.onerror = function (error) {\r\n if (error && window._EsriLeafletCallbacks[callbackId] !== true) {\r\n // Can't get true error code: it can be 404, or 401, or 500\r\n var err = {\r\n error: {\r\n code: 500,\r\n message: 'An unknown error occurred'\r\n }\r\n };\r\n\r\n callback.call(context, err);\r\n window._EsriLeafletCallbacks[callbackId] = true;\r\n }\r\n };\r\n DomUtil.addClass(script, 'esri-leaflet-jsonp');\r\n\r\n callbacks++;\r\n\r\n return {\r\n id: callbackId,\r\n url: script.src,\r\n abort: function () {\r\n window._EsriLeafletCallbacks._callback[callbackId]({\r\n code: 0,\r\n message: 'Request aborted.'\r\n });\r\n }\r\n };\r\n}\r\n\r\nvar get = ((Support.cors) ? xmlHttpGet : jsonp);\r\nget.CORS = xmlHttpGet;\r\nget.JSONP = jsonp;\r\n\r\nexport function warn () {\r\n if (console && console.warn) {\r\n console.warn.apply(console, arguments);\r\n }\r\n}\r\n\r\n// choose the correct AJAX handler depending on CORS support\r\nexport { get };\r\n\r\n// always use XMLHttpRequest for posts\r\nexport { xmlHttpPost as post };\r\n\r\n// export the Request object to call the different handlers for debugging\r\nexport var Request = {\r\n request: request,\r\n get: get,\r\n post: xmlHttpPost\r\n};\r\n\r\nexport default Request;\r\n","/* @preserve\n* @terraformer/arcgis - v2.0.7 - MIT\n* Copyright (c) 2012-2021 Environmental Systems Research Institute, Inc.\n* Thu Jul 22 2021 13:58:30 GMT-0700 (Pacific Daylight Time)\n*/\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nvar edgeIntersectsEdge = function edgeIntersectsEdge(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 (ua >= 0 && ua <= 1 && ub >= 0 && ub <= 1) {\n return true;\n }\n }\n\n return false;\n};\nvar coordinatesContainPoint = function coordinatesContainPoint(coordinates, point) {\n var contains = false;\n\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] || 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]) {\n contains = !contains;\n }\n }\n\n return contains;\n};\nvar pointsEqual = 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\n return true;\n};\nvar arrayIntersectsArray = 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 (edgeIntersectsEdge(a[i], a[i + 1], b[j], b[j + 1])) {\n return true;\n }\n }\n }\n\n return false;\n};\n\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nvar closeRing = function closeRing(coordinates) {\n if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) {\n coordinates.push(coordinates[0]);\n }\n\n return coordinates;\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\nvar ringIsClockwise = function ringIsClockwise(ringToTest) {\n var total = 0;\n var i = 0;\n var rLength = ringToTest.length;\n var pt1 = ringToTest[i];\n var pt2;\n\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\n return total >= 0;\n}; // This function ensures that rings are oriented in the right directions\n// from http://jsperf.com/cloning-an-object/2\n\nvar shallowClone = function shallowClone(obj) {\n var target = {};\n\n for (var i in obj) {\n // both arcgis attributes and geojson props are just hardcoded keys\n if (obj.hasOwnProperty(i)) {\n // eslint-disable-line no-prototype-builtins\n target[i] = obj[i];\n }\n }\n\n return target;\n};\n\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nvar coordinatesContainCoordinates = function coordinatesContainCoordinates(outer, inner) {\n var intersects = arrayIntersectsArray(outer, inner);\n var contains = coordinatesContainPoint(outer, inner[0]);\n\n if (!intersects && contains) {\n return true;\n }\n\n return false;\n}; // do any polygons in this array contain any other polygons in this array?\n// used for checking for holes in arcgis rings\n\n\nvar convertRingsToGeoJSON = function convertRingsToGeoJSON(rings) {\n var outerRings = [];\n var holes = [];\n var x; // iterator\n\n var outerRing; // current outer ring being evaluated\n\n var hole; // current hole being evaluated\n // for each ring\n\n for (var r = 0; r < rings.length; r++) {\n var ring = closeRing(rings[r].slice(0));\n\n if (ring.length < 4) {\n continue;\n } // is this ring an outer ring? is it clockwise?\n\n\n if (ringIsClockwise(ring)) {\n var polygon = [ring.slice().reverse()]; // wind outer rings counterclockwise for RFC 7946 compliance\n\n outerRings.push(polygon); // push to outer rings\n } else {\n holes.push(ring.slice().reverse()); // wind inner rings clockwise for RFC 7946 compliance\n }\n }\n\n var uncontainedHoles = []; // while there are holes left...\n\n while (holes.length) {\n // pop a hole off out stack\n hole = holes.pop(); // loop over all outer rings and see if they contain our hole.\n\n var contained = false;\n\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n\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 } // ring is not contained in any outer ring\n // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320\n\n\n if (!contained) {\n uncontainedHoles.push(hole);\n }\n } // if we couldn't match any holes using contains we can try intersects...\n\n\n while (uncontainedHoles.length) {\n // pop a hole off out stack\n hole = uncontainedHoles.pop(); // loop over all outer rings and see if any intersect our hole.\n\n var intersects = false;\n\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n\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\nvar getId = function getId(attributes, idAttribute) {\n var keys = idAttribute ? [idAttribute, 'OBJECTID', 'FID'] : ['OBJECTID', 'FID'];\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n\n if (key in attributes && (typeof attributes[key] === 'string' || typeof attributes[key] === 'number')) {\n return attributes[key];\n }\n }\n\n throw Error('No valid id attribute found');\n};\n\nvar arcgisToGeoJSON = function arcgisToGeoJSON(arcgis, idAttribute) {\n var geojson = {};\n\n if (arcgis.features) {\n geojson.type = 'FeatureCollection';\n geojson.features = [];\n\n for (var i = 0; i < arcgis.features.length; i++) {\n geojson.features.push(arcgisToGeoJSON(arcgis.features[i], idAttribute));\n }\n }\n\n if (typeof arcgis.x === 'number' && typeof arcgis.y === 'number') {\n geojson.type = 'Point';\n geojson.coordinates = [arcgis.x, arcgis.y];\n\n if (typeof arcgis.z === 'number') {\n geojson.coordinates.push(arcgis.z);\n }\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 (typeof arcgis.xmin === 'number' && typeof arcgis.ymin === 'number' && typeof arcgis.xmax === 'number' && typeof arcgis.ymax === 'number') {\n geojson.type = 'Polygon';\n geojson.coordinates = [[[arcgis.xmax, arcgis.ymax], [arcgis.xmin, arcgis.ymax], [arcgis.xmin, arcgis.ymin], [arcgis.xmax, arcgis.ymin], [arcgis.xmax, arcgis.ymax]]];\n }\n\n if (arcgis.geometry || arcgis.attributes) {\n geojson.type = 'Feature';\n geojson.geometry = arcgis.geometry ? arcgisToGeoJSON(arcgis.geometry) : null;\n geojson.properties = arcgis.attributes ? shallowClone(arcgis.attributes) : null;\n\n if (arcgis.attributes) {\n try {\n geojson.id = getId(arcgis.attributes, idAttribute);\n } catch (err) {// don't set an id\n }\n }\n } // if no valid geometry was encountered\n\n\n if (JSON.stringify(geojson.geometry) === JSON.stringify({})) {\n geojson.geometry = null;\n }\n\n if (arcgis.spatialReference && arcgis.spatialReference.wkid && arcgis.spatialReference.wkid !== 4326) {\n console.warn('Object converted in non-standard crs - ' + JSON.stringify(arcgis.spatialReference));\n }\n\n return geojson;\n};\n\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n// outer rings are clockwise, holes are counterclockwise\n// used for converting GeoJSON Polygons to ArcGIS Polygons\n\nvar orientRings = function orientRings(poly) {\n var output = [];\n var polygon = poly.slice(0);\n var outerRing = closeRing(polygon.shift().slice(0));\n\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\n if (hole.length >= 4) {\n if (ringIsClockwise(hole)) {\n hole.reverse();\n }\n\n output.push(hole);\n }\n }\n }\n\n return output;\n}; // This function flattens holes in multipolygons to one array of polygons\n// used for converting GeoJSON Polygons to ArcGIS Polygons\n\n\nvar flattenMultiPolygonRings = function flattenMultiPolygonRings(rings) {\n var output = [];\n\n for (var i = 0; i < rings.length; i++) {\n var polygon = orientRings(rings[i]);\n\n for (var x = polygon.length - 1; x >= 0; x--) {\n var ring = polygon[x].slice(0);\n output.push(ring);\n }\n }\n\n return output;\n};\n\nvar geojsonToArcGIS = function geojsonToArcGIS(geojson, idAttribute) {\n idAttribute = idAttribute || 'OBJECTID';\n var spatialReference = {\n wkid: 4326\n };\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\n if (geojson.coordinates[2]) {\n result.z = geojson.coordinates[2];\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiPoint':\n result.points = geojson.coordinates.slice(0);\n\n if (geojson.coordinates[0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'LineString':\n result.paths = [geojson.coordinates.slice(0)];\n\n if (geojson.coordinates[0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiLineString':\n result.paths = geojson.coordinates.slice(0);\n\n if (geojson.coordinates[0][0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'Polygon':\n result.rings = orientRings(geojson.coordinates.slice(0));\n\n if (geojson.coordinates[0][0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiPolygon':\n result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));\n\n if (geojson.coordinates[0][0][0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'Feature':\n if (geojson.geometry) {\n result.geometry = geojsonToArcGIS(geojson.geometry, idAttribute);\n }\n\n result.attributes = geojson.properties ? shallowClone(geojson.properties) : {};\n\n if (geojson.id) {\n result.attributes[idAttribute] = geojson.id;\n }\n\n break;\n\n case 'FeatureCollection':\n result = [];\n\n for (i = 0; i < geojson.features.length; i++) {\n result.push(geojsonToArcGIS(geojson.features[i], idAttribute));\n }\n\n break;\n\n case 'GeometryCollection':\n result = [];\n\n for (i = 0; i < geojson.geometries.length; i++) {\n result.push(geojsonToArcGIS(geojson.geometries[i], idAttribute));\n }\n\n break;\n }\n\n return result;\n};\n\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nexport { arcgisToGeoJSON, geojsonToArcGIS };\n","import { latLng, latLngBounds, LatLng, LatLngBounds, Util, DomUtil, GeoJSON } from 'leaflet';\r\nimport { request, warn } from './Request';\r\nimport { options } from './Options';\r\nimport { Support } from './Support';\r\n\r\nimport {\r\n geojsonToArcGIS as g2a,\r\n arcgisToGeoJSON as a2g\r\n} from '@terraformer/arcgis';\r\n\r\nvar POWERED_BY_ESRI_ATTRIBUTION_STRING = 'Powered by Esri';\r\n\r\nexport function geojsonToArcGIS (geojson, idAttr) {\r\n return g2a(geojson, idAttr);\r\n}\r\n\r\nexport function arcgisToGeoJSON (arcgis, idAttr) {\r\n return a2g(arcgis, idAttr);\r\n}\r\n\r\n// convert an extent (ArcGIS) to LatLngBounds (Leaflet)\r\nexport function extentToBounds (extent) {\r\n // \"NaN\" coordinates from ArcGIS Server indicate a null geometry\r\n if (extent.xmin !== 'NaN' && extent.ymin !== 'NaN' && extent.xmax !== 'NaN' && extent.ymax !== 'NaN') {\r\n var sw = latLng(extent.ymin, extent.xmin);\r\n var ne = latLng(extent.ymax, extent.xmax);\r\n return latLngBounds(sw, ne);\r\n } else {\r\n return null;\r\n }\r\n}\r\n\r\n// convert an LatLngBounds (Leaflet) to extent (ArcGIS)\r\nexport function boundsToExtent (bounds) {\r\n bounds = latLngBounds(bounds);\r\n return {\r\n xmin: bounds.getSouthWest().lng,\r\n ymin: bounds.getSouthWest().lat,\r\n xmax: bounds.getNorthEast().lng,\r\n ymax: bounds.getNorthEast().lat,\r\n spatialReference: {\r\n wkid: 4326\r\n }\r\n };\r\n}\r\n\r\nvar knownFieldNames = /^(OBJECTID|FID|OID|ID)$/i;\r\n\r\n// Attempts to find the ID Field from response\r\nexport function _findIdAttributeFromResponse (response) {\r\n var result;\r\n\r\n if (response.objectIdFieldName) {\r\n // Find Id Field directly\r\n result = response.objectIdFieldName;\r\n } else if (response.fields) {\r\n // Find ID Field based on field type\r\n for (var j = 0; j <= response.fields.length - 1; j++) {\r\n if (response.fields[j].type === 'esriFieldTypeOID') {\r\n result = response.fields[j].name;\r\n break;\r\n }\r\n }\r\n if (!result) {\r\n // If no field was marked as being the esriFieldTypeOID try well known field names\r\n for (j = 0; j <= response.fields.length - 1; j++) {\r\n if (response.fields[j].name.match(knownFieldNames)) {\r\n result = response.fields[j].name;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return result;\r\n}\r\n\r\n// This is the 'last' resort, find the Id field from the specified feature\r\nexport function _findIdAttributeFromFeature (feature) {\r\n for (var key in feature.attributes) {\r\n if (key.match(knownFieldNames)) {\r\n return key;\r\n }\r\n }\r\n}\r\n\r\nexport function responseToFeatureCollection (response, idAttribute) {\r\n var objectIdField;\r\n var features = response.features || response.results;\r\n var count = features && features.length;\r\n\r\n if (idAttribute) {\r\n objectIdField = idAttribute;\r\n } else {\r\n objectIdField = _findIdAttributeFromResponse(response);\r\n }\r\n\r\n var featureCollection = {\r\n type: 'FeatureCollection',\r\n features: []\r\n };\r\n\r\n if (count) {\r\n for (var i = features.length - 1; i >= 0; i--) {\r\n var feature = arcgisToGeoJSON(features[i], objectIdField || _findIdAttributeFromFeature(features[i]));\r\n featureCollection.features.push(feature);\r\n }\r\n }\r\n\r\n return featureCollection;\r\n}\r\n\r\n// trim url whitespace and add a trailing slash if needed\r\nexport function cleanUrl (url) {\r\n // trim leading and trailing spaces, but not spaces inside the url\r\n url = Util.trim(url);\r\n\r\n // add a trailing slash to the url if the user omitted it\r\n if (url[url.length - 1] !== '/') {\r\n url += '/';\r\n }\r\n\r\n return url;\r\n}\r\n\r\n/* Extract url params if any and store them in requestParams attribute.\r\n Return the options params updated */\r\nexport function getUrlParams (options) {\r\n if (options.url.indexOf('?') !== -1) {\r\n options.requestParams = options.requestParams || {};\r\n var queryString = options.url.substring(options.url.indexOf('?') + 1);\r\n options.url = options.url.split('?')[0];\r\n options.requestParams = JSON.parse('{\"' + decodeURI(queryString).replace(/\"/g, '\\\\\"').replace(/&/g, '\",\"').replace(/=/g, '\":\"') + '\"}');\r\n }\r\n options.url = cleanUrl(options.url.split('?')[0]);\r\n return options;\r\n}\r\n\r\nexport function isArcgisOnline (url) {\r\n /* hosted feature services support geojson as an output format\r\n utility.arcgis.com services are proxied from a variety of ArcGIS Server vintages, and may not */\r\n return (/^(?!.*utility\\.arcgis\\.com).*\\.arcgis\\.com.*FeatureServer/i).test(url);\r\n}\r\n\r\nexport function geojsonTypeToArcGIS (geoJsonType) {\r\n var arcgisGeometryType;\r\n switch (geoJsonType) {\r\n case 'Point':\r\n arcgisGeometryType = 'esriGeometryPoint';\r\n break;\r\n case 'MultiPoint':\r\n arcgisGeometryType = 'esriGeometryMultipoint';\r\n break;\r\n case 'LineString':\r\n arcgisGeometryType = 'esriGeometryPolyline';\r\n break;\r\n case 'MultiLineString':\r\n arcgisGeometryType = 'esriGeometryPolyline';\r\n break;\r\n case 'Polygon':\r\n arcgisGeometryType = 'esriGeometryPolygon';\r\n break;\r\n case 'MultiPolygon':\r\n arcgisGeometryType = 'esriGeometryPolygon';\r\n break;\r\n }\r\n\r\n return arcgisGeometryType;\r\n}\r\n\r\nexport function calcAttributionWidth (map) {\r\n // either crop at 55px or user defined buffer\r\n return (map.getSize().x - options.attributionWidthOffset) + 'px';\r\n}\r\n\r\nexport function setEsriAttribution (map) {\r\n if (!map.attributionControl) {\r\n return;\r\n }\r\n\r\n if (!map.attributionControl._esriAttributionLayerCount) {\r\n map.attributionControl._esriAttributionLayerCount = 0;\r\n }\r\n\r\n if (map.attributionControl._esriAttributionLayerCount === 0) {\r\n // Dynamically creating the CSS rules, only run this once per page load:\r\n if (!map.attributionControl._esriAttributionAddedOnce) {\r\n var hoverAttributionStyle = document.createElement('style');\r\n hoverAttributionStyle.type = 'text/css';\r\n hoverAttributionStyle.innerHTML = '.esri-truncated-attribution:hover {' +\r\n 'white-space: normal;' +\r\n '}';\r\n document.getElementsByTagName('head')[0].appendChild(hoverAttributionStyle);\r\n\r\n // define a new css class in JS to trim attribution into a single line\r\n var attributionStyle = document.createElement('style');\r\n attributionStyle.type = 'text/css';\r\n attributionStyle.innerHTML = '.esri-truncated-attribution {' +\r\n 'vertical-align: -3px;' +\r\n 'white-space: nowrap;' +\r\n 'overflow: hidden;' +\r\n 'text-overflow: ellipsis;' +\r\n 'display: inline-block;' +\r\n 'transition: 0s white-space;' +\r\n 'transition-delay: 1s;' +\r\n 'max-width: ' + calcAttributionWidth(map) + ';' +\r\n '}';\r\n document.getElementsByTagName('head')[0].appendChild(attributionStyle);\r\n\r\n // update the width used to truncate when the map itself is resized\r\n map.on('resize', function (e) {\r\n if (map.attributionControl) {\r\n map.attributionControl._container.style.maxWidth = calcAttributionWidth(e.target);\r\n }\r\n });\r\n\r\n map.attributionControl._esriAttributionAddedOnce = true;\r\n }\r\n\r\n DomUtil.addClass(map.attributionControl._container, 'esri-truncated-attribution:hover');\r\n DomUtil.addClass(map.attributionControl._container, 'esri-truncated-attribution');\r\n }\r\n\r\n // Track the number of esri-leaflet layers that are on the map so we can know when we can remove the attribution (below in removeEsriAttribution)\r\n map.attributionControl._esriAttributionLayerCount = map.attributionControl._esriAttributionLayerCount + 1;\r\n}\r\n\r\nexport function removeEsriAttribution (map) {\r\n if (!map.attributionControl) {\r\n return;\r\n }\r\n\r\n // Only remove the attribution if we're about to remove the LAST esri-leaflet layer (_esriAttributionLayerCount)\r\n if (map.attributionControl._esriAttributionLayerCount && map.attributionControl._esriAttributionLayerCount === 1) {\r\n DomUtil.removeClass(map.attributionControl._container, 'esri-truncated-attribution:hover');\r\n DomUtil.removeClass(map.attributionControl._container, 'esri-truncated-attribution');\r\n }\r\n map.attributionControl._esriAttributionLayerCount = map.attributionControl._esriAttributionLayerCount - 1;\r\n}\r\n\r\nexport function _setGeometry (geometry) {\r\n var params = {\r\n geometry: null,\r\n geometryType: null\r\n };\r\n\r\n // convert bounds to extent and finish\r\n if (geometry instanceof LatLngBounds) {\r\n // set geometry + geometryType\r\n params.geometry = boundsToExtent(geometry);\r\n params.geometryType = 'esriGeometryEnvelope';\r\n return params;\r\n }\r\n\r\n // convert L.Marker > L.LatLng\r\n if (geometry.getLatLng) {\r\n geometry = geometry.getLatLng();\r\n }\r\n\r\n // convert L.LatLng to a geojson point and continue;\r\n if (geometry instanceof LatLng) {\r\n geometry = {\r\n type: 'Point',\r\n coordinates: [geometry.lng, geometry.lat]\r\n };\r\n }\r\n\r\n // handle L.GeoJSON, pull out the first geometry\r\n if (geometry instanceof GeoJSON) {\r\n // reassign geometry to the GeoJSON value (we are assuming that only one feature is present)\r\n geometry = geometry.getLayers()[0].feature.geometry;\r\n params.geometry = geojsonToArcGIS(geometry);\r\n params.geometryType = geojsonTypeToArcGIS(geometry.type);\r\n }\r\n\r\n // Handle L.Polyline and L.Polygon\r\n if (geometry.toGeoJSON) {\r\n geometry = geometry.toGeoJSON();\r\n }\r\n\r\n // handle GeoJSON feature by pulling out the geometry\r\n if (geometry.type === 'Feature') {\r\n // get the geometry of the geojson feature\r\n geometry = geometry.geometry;\r\n }\r\n\r\n // confirm that our GeoJSON is a point, line or polygon\r\n if (geometry.type === 'Point' || geometry.type === 'LineString' || geometry.type === 'Polygon' || geometry.type === 'MultiPolygon') {\r\n params.geometry = geojsonToArcGIS(geometry);\r\n params.geometryType = geojsonTypeToArcGIS(geometry.type);\r\n return params;\r\n }\r\n\r\n // warn the user if we havn't found an appropriate object\r\n warn('invalid geometry passed to spatial query. Should be L.LatLng, L.LatLngBounds, L.Marker or a GeoJSON Point, Line, Polygon or MultiPolygon object');\r\n}\r\n\r\nexport function _getAttributionData (url, map) {\r\n if (Support.cors) {\r\n request(url, {}, Util.bind(function (error, attributions) {\r\n if (error) { return; }\r\n map._esriAttributions = [];\r\n for (var c = 0; c < attributions.contributors.length; c++) {\r\n var contributor = attributions.contributors[c];\r\n\r\n for (var i = 0; i < contributor.coverageAreas.length; i++) {\r\n var coverageArea = contributor.coverageAreas[i];\r\n var southWest = latLng(coverageArea.bbox[0], coverageArea.bbox[1]);\r\n var northEast = latLng(coverageArea.bbox[2], coverageArea.bbox[3]);\r\n map._esriAttributions.push({\r\n attribution: contributor.attribution,\r\n score: coverageArea.score,\r\n bounds: latLngBounds(southWest, northEast),\r\n minZoom: coverageArea.zoomMin,\r\n maxZoom: coverageArea.zoomMax\r\n });\r\n }\r\n }\r\n\r\n map._esriAttributions.sort(function (a, b) {\r\n return b.score - a.score;\r\n });\r\n\r\n // pass the same argument as the map's 'moveend' event\r\n var obj = { target: map };\r\n _updateMapAttribution(obj);\r\n }, this));\r\n }\r\n}\r\n\r\nexport function _updateMapAttribution (evt) {\r\n var map = evt.target;\r\n var oldAttributions = map._esriAttributions;\r\n\r\n if (!map || !map.attributionControl) return;\r\n\r\n var attributionElement = map.attributionControl._container.querySelector('.esri-dynamic-attribution');\r\n\r\n if (attributionElement && oldAttributions) {\r\n var newAttributions = '';\r\n var bounds = map.getBounds();\r\n var wrappedBounds = latLngBounds(\r\n bounds.getSouthWest().wrap(),\r\n bounds.getNorthEast().wrap()\r\n );\r\n var zoom = map.getZoom();\r\n\r\n for (var i = 0; i < oldAttributions.length; i++) {\r\n var attribution = oldAttributions[i];\r\n var text = attribution.attribution;\r\n\r\n if (!newAttributions.match(text) && attribution.bounds.intersects(wrappedBounds) && zoom >= attribution.minZoom && zoom <= attribution.maxZoom) {\r\n newAttributions += (', ' + text);\r\n }\r\n }\r\n\r\n newAttributions = POWERED_BY_ESRI_ATTRIBUTION_STRING + ' | ' + newAttributions.substr(2);\r\n attributionElement.innerHTML = newAttributions;\r\n attributionElement.style.maxWidth = calcAttributionWidth(map);\r\n\r\n map.fire('attributionupdated', {\r\n attribution: newAttributions\r\n });\r\n }\r\n}\r\n\r\n// for backwards compatibility\r\nexport { warn };\r\n\r\nexport var EsriUtil = {\r\n warn: warn,\r\n cleanUrl: cleanUrl,\r\n getUrlParams: getUrlParams,\r\n isArcgisOnline: isArcgisOnline,\r\n geojsonTypeToArcGIS: geojsonTypeToArcGIS,\r\n responseToFeatureCollection: responseToFeatureCollection,\r\n geojsonToArcGIS: geojsonToArcGIS,\r\n arcgisToGeoJSON: arcgisToGeoJSON,\r\n boundsToExtent: boundsToExtent,\r\n extentToBounds: extentToBounds,\r\n calcAttributionWidth: calcAttributionWidth,\r\n setEsriAttribution: setEsriAttribution,\r\n removeEsriAttribution: removeEsriAttribution,\r\n _setGeometry: _setGeometry,\r\n _getAttributionData: _getAttributionData,\r\n _updateMapAttribution: _updateMapAttribution,\r\n _findIdAttributeFromFeature: _findIdAttributeFromFeature,\r\n _findIdAttributeFromResponse: _findIdAttributeFromResponse\r\n};\r\n\r\nexport default EsriUtil;\r\n","import { Class, Util } from 'leaflet';\r\nimport { cors } from '../Support';\r\nimport { cleanUrl, getUrlParams } from '../Util';\r\nimport Request from '../Request';\r\n\r\nexport var Task = Class.extend({\r\n\r\n options: {\r\n proxy: false,\r\n useCors: cors\r\n },\r\n\r\n // Generate a method for each methodName:paramName in the setters for this task.\r\n generateSetter: function (param, context) {\r\n return Util.bind(function (value) {\r\n this.params[param] = value;\r\n return this;\r\n }, context);\r\n },\r\n\r\n initialize: function (endpoint) {\r\n // endpoint can be either a url (and options) for an ArcGIS Rest Service or an instance of EsriLeaflet.Service\r\n if (endpoint.request && endpoint.options) {\r\n this._service = endpoint;\r\n Util.setOptions(this, endpoint.options);\r\n } else {\r\n Util.setOptions(this, endpoint);\r\n this.options.url = cleanUrl(endpoint.url);\r\n }\r\n\r\n // clone default params into this object\r\n this.params = Util.extend({}, this.params || {});\r\n\r\n // generate setter methods based on the setters object implimented a child class\r\n if (this.setters) {\r\n for (var setter in this.setters) {\r\n var param = this.setters[setter];\r\n this[setter] = this.generateSetter(param, this);\r\n }\r\n }\r\n },\r\n\r\n token: function (token) {\r\n if (this._service) {\r\n this._service.authenticate(token);\r\n } else {\r\n this.params.token = token;\r\n }\r\n return this;\r\n },\r\n\r\n apikey: function (apikey) {\r\n return this.token(apikey);\r\n },\r\n\r\n // ArcGIS Server Find/Identify 10.5+\r\n format: function (boolean) {\r\n // use double negative to expose a more intuitive positive method name\r\n this.params.returnUnformattedValues = !boolean;\r\n return this;\r\n },\r\n\r\n request: function (callback, context) {\r\n if (this.options.requestParams) {\r\n Util.extend(this.params, this.options.requestParams);\r\n }\r\n if (this._service) {\r\n return this._service.request(this.path, this.params, callback, context);\r\n }\r\n\r\n return this._request('request', this.path, this.params, callback, context);\r\n },\r\n\r\n _request: function (method, path, params, callback, context) {\r\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.options.url + path : this.options.url + path;\r\n\r\n if ((method === 'get' || method === 'request') && !this.options.useCors) {\r\n return Request.get.JSONP(url, params, callback, context);\r\n }\r\n\r\n return Request[method](url, params, callback, context);\r\n }\r\n});\r\n\r\nexport function task (options) {\r\n options = getUrlParams(options);\r\n return new Task(options);\r\n}\r\n\r\nexport default task;\r\n","import { point, latLng } from 'leaflet';\r\nimport { Task } from './Task';\r\nimport {\r\n warn,\r\n responseToFeatureCollection,\r\n isArcgisOnline,\r\n extentToBounds,\r\n _setGeometry\r\n} from '../Util';\r\n\r\nexport var Query = Task.extend({\r\n setters: {\r\n offset: 'resultOffset',\r\n limit: 'resultRecordCount',\r\n fields: 'outFields',\r\n precision: 'geometryPrecision',\r\n featureIds: 'objectIds',\r\n returnGeometry: 'returnGeometry',\r\n returnM: 'returnM',\r\n transform: 'datumTransformation',\r\n token: 'token'\r\n },\r\n\r\n path: 'query',\r\n\r\n params: {\r\n returnGeometry: true,\r\n where: '1=1',\r\n outSR: 4326,\r\n outFields: '*'\r\n },\r\n\r\n // Returns a feature if its shape is wholly contained within the search geometry. Valid for all shape type combinations.\r\n within: function (geometry) {\r\n this._setGeometryParams(geometry);\r\n this.params.spatialRel = 'esriSpatialRelContains'; // to the REST api this reads geometry **contains** layer\r\n return this;\r\n },\r\n\r\n // Returns a feature if any spatial relationship is found. Applies to all shape type combinations.\r\n intersects: function (geometry) {\r\n this._setGeometryParams(geometry);\r\n this.params.spatialRel = 'esriSpatialRelIntersects';\r\n return this;\r\n },\r\n\r\n // Returns a feature if its shape wholly contains the search geometry. Valid for all shape type combinations.\r\n contains: function (geometry) {\r\n this._setGeometryParams(geometry);\r\n this.params.spatialRel = 'esriSpatialRelWithin'; // to the REST api this reads geometry **within** layer\r\n return this;\r\n },\r\n\r\n // Returns a feature if the intersection of the interiors of the two shapes is not empty and has a lower dimension than the maximum dimension of the two shapes. Two lines that share an endpoint in common do not cross. Valid for Line/Line, Line/Area, Multi-point/Area, and Multi-point/Line shape type combinations.\r\n crosses: function (geometry) {\r\n this._setGeometryParams(geometry);\r\n this.params.spatialRel = 'esriSpatialRelCrosses';\r\n return this;\r\n },\r\n\r\n // Returns a feature if the two shapes share a common boundary. However, the intersection of the interiors of the two shapes must be empty. In the Point/Line case, the point may touch an endpoint only of the line. Applies to all combinations except Point/Point.\r\n touches: function (geometry) {\r\n this._setGeometryParams(geometry);\r\n this.params.spatialRel = 'esriSpatialRelTouches';\r\n return this;\r\n },\r\n\r\n // Returns a feature if the intersection of the two shapes results in an object of the same dimension, but different from both of the shapes. Applies to Area/Area, Line/Line, and Multi-point/Multi-point shape type combinations.\r\n overlaps: function (geometry) {\r\n this._setGeometryParams(geometry);\r\n this.params.spatialRel = 'esriSpatialRelOverlaps';\r\n return this;\r\n },\r\n\r\n // Returns a feature if the envelope of the two shapes intersects.\r\n bboxIntersects: function (geometry) {\r\n this._setGeometryParams(geometry);\r\n this.params.spatialRel = 'esriSpatialRelEnvelopeIntersects';\r\n return this;\r\n },\r\n\r\n // if someone can help decipher the ArcObjects explanation and translate to plain speak, we should mention this method in the doc\r\n indexIntersects: function (geometry) {\r\n this._setGeometryParams(geometry);\r\n this.params.spatialRel = 'esriSpatialRelIndexIntersects'; // Returns a feature if the envelope of the query geometry intersects the index entry for the target geometry\r\n return this;\r\n },\r\n\r\n // only valid for Feature Services running on ArcGIS Server 10.3+ or ArcGIS Online\r\n nearby: function (latlng, radius) {\r\n latlng = latLng(latlng);\r\n this.params.geometry = [latlng.lng, latlng.lat];\r\n this.params.geometryType = 'esriGeometryPoint';\r\n this.params.spatialRel = 'esriSpatialRelIntersects';\r\n this.params.units = 'esriSRUnit_Meter';\r\n this.params.distance = radius;\r\n this.params.inSR = 4326;\r\n return this;\r\n },\r\n\r\n where: function (string) {\r\n // instead of converting double-quotes to single quotes, pass as is, and provide a more informative message if a 400 is encountered\r\n this.params.where = string;\r\n return this;\r\n },\r\n\r\n between: function (start, end) {\r\n this.params.time = [start.valueOf(), end.valueOf()];\r\n return this;\r\n },\r\n\r\n simplify: function (map, factor) {\r\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\r\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\r\n return this;\r\n },\r\n\r\n orderBy: function (fieldName, order) {\r\n order = order || 'ASC';\r\n this.params.orderByFields = (this.params.orderByFields) ? this.params.orderByFields + ',' : '';\r\n this.params.orderByFields += ([fieldName, order]).join(' ');\r\n return this;\r\n },\r\n\r\n run: function (callback, context) {\r\n this._cleanParams();\r\n\r\n // services hosted on ArcGIS Online and ArcGIS Server 10.3.1+ support requesting geojson directly\r\n if (this.options.isModern || (isArcgisOnline(this.options.url) && this.options.isModern === undefined)) {\r\n this.params.f = 'geojson';\r\n\r\n return this.request(function (error, response) {\r\n this._trapSQLerrors(error);\r\n callback.call(context, error, response, response);\r\n }, this);\r\n\r\n // otherwise convert it in the callback then pass it on\r\n } else {\r\n return this.request(function (error, response) {\r\n this._trapSQLerrors(error);\r\n callback.call(context, error, (response && responseToFeatureCollection(response)), response);\r\n }, this);\r\n }\r\n },\r\n\r\n count: function (callback, context) {\r\n this._cleanParams();\r\n this.params.returnCountOnly = true;\r\n return this.request(function (error, response) {\r\n callback.call(this, error, (response && response.count), response);\r\n }, context);\r\n },\r\n\r\n ids: function (callback, context) {\r\n this._cleanParams();\r\n this.params.returnIdsOnly = true;\r\n return this.request(function (error, response) {\r\n callback.call(this, error, (response && response.objectIds), response);\r\n }, context);\r\n },\r\n\r\n // only valid for Feature Services running on ArcGIS Server 10.3+ or ArcGIS Online\r\n bounds: function (callback, context) {\r\n this._cleanParams();\r\n this.params.returnExtentOnly = true;\r\n return this.request(function (error, response) {\r\n if (response && response.extent && extentToBounds(response.extent)) {\r\n callback.call(context, error, extentToBounds(response.extent), response);\r\n } else {\r\n error = {\r\n message: 'Invalid Bounds'\r\n };\r\n callback.call(context, error, null, response);\r\n }\r\n }, context);\r\n },\r\n\r\n distinct: function () {\r\n // geometry must be omitted for queries requesting distinct values\r\n this.params.returnGeometry = false;\r\n this.params.returnDistinctValues = true;\r\n return this;\r\n },\r\n\r\n // only valid for image services\r\n pixelSize: function (rawPoint) {\r\n var castPoint = point(rawPoint);\r\n this.params.pixelSize = [castPoint.x, castPoint.y];\r\n return this;\r\n },\r\n\r\n // only valid for map services\r\n layer: function (layer) {\r\n this.path = layer + '/query';\r\n return this;\r\n },\r\n\r\n _trapSQLerrors: function (error) {\r\n if (error) {\r\n if (error.code === '400') {\r\n warn('one common syntax error in query requests is encasing string values in double quotes instead of single quotes');\r\n }\r\n }\r\n },\r\n\r\n _cleanParams: function () {\r\n delete this.params.returnIdsOnly;\r\n delete this.params.returnExtentOnly;\r\n delete this.params.returnCountOnly;\r\n },\r\n\r\n _setGeometryParams: function (geometry) {\r\n this.params.inSR = 4326;\r\n var converted = _setGeometry(geometry);\r\n this.params.geometry = converted.geometry;\r\n this.params.geometryType = converted.geometryType;\r\n }\r\n\r\n});\r\n\r\nexport function query (options) {\r\n return new Query(options);\r\n}\r\n\r\nexport default query;\r\n","import { Task } from './Task';\r\nimport { responseToFeatureCollection } from '../Util';\r\n\r\nexport var Find = Task.extend({\r\n setters: {\r\n // method name > param name\r\n contains: 'contains',\r\n text: 'searchText',\r\n fields: 'searchFields', // denote an array or single string\r\n spatialReference: 'sr',\r\n sr: 'sr',\r\n layers: 'layers',\r\n returnGeometry: 'returnGeometry',\r\n maxAllowableOffset: 'maxAllowableOffset',\r\n precision: 'geometryPrecision',\r\n dynamicLayers: 'dynamicLayers',\r\n returnZ: 'returnZ',\r\n returnM: 'returnM',\r\n gdbVersion: 'gdbVersion',\r\n // skipped implementing this (for now) because the REST service implementation isnt consistent between operations\r\n // 'transform': 'datumTransformations',\r\n token: 'token'\r\n },\r\n\r\n path: 'find',\r\n\r\n params: {\r\n sr: 4326,\r\n contains: true,\r\n returnGeometry: true,\r\n returnZ: true,\r\n returnM: false\r\n },\r\n\r\n layerDefs: function (id, where) {\r\n this.params.layerDefs = (this.params.layerDefs) ? this.params.layerDefs + ';' : '';\r\n this.params.layerDefs += ([id, where]).join(':');\r\n return this;\r\n },\r\n\r\n simplify: function (map, factor) {\r\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\r\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\r\n return this;\r\n },\r\n\r\n run: function (callback, context) {\r\n return this.request(function (error, response) {\r\n callback.call(context, error, (response && responseToFeatureCollection(response)), response);\r\n }, context);\r\n }\r\n});\r\n\r\nexport function find (options) {\r\n return new Find(options);\r\n}\r\n\r\nexport default find;\r\n","import { Task } from './Task';\r\n\r\nexport var Identify = Task.extend({\r\n path: 'identify',\r\n\r\n between: function (start, end) {\r\n this.params.time = [start.valueOf(), end.valueOf()];\r\n return this;\r\n }\r\n});\r\n\r\nexport function identify (options) {\r\n return new Identify(options);\r\n}\r\n\r\nexport default identify;\r\n","import { latLng } from 'leaflet';\r\nimport { Identify } from './Identify';\r\nimport { responseToFeatureCollection,\r\n boundsToExtent,\r\n _setGeometry\r\n} from '../Util';\r\n\r\nexport var IdentifyFeatures = Identify.extend({\r\n setters: {\r\n layers: 'layers',\r\n precision: 'geometryPrecision',\r\n tolerance: 'tolerance',\r\n // skipped implementing this (for now) because the REST service implementation isnt consistent between operations.\r\n // 'transform': 'datumTransformations'\r\n returnGeometry: 'returnGeometry'\r\n },\r\n\r\n params: {\r\n sr: 4326,\r\n layers: 'all',\r\n tolerance: 3,\r\n returnGeometry: true\r\n },\r\n\r\n on: function (map) {\r\n var extent = boundsToExtent(map.getBounds());\r\n var size = map.getSize();\r\n this.params.imageDisplay = [size.x, size.y, 96];\r\n this.params.mapExtent = [extent.xmin, extent.ymin, extent.xmax, extent.ymax];\r\n return this;\r\n },\r\n\r\n at: function (geometry) {\r\n // cast lat, long pairs in raw array form manually\r\n if (geometry.length === 2) {\r\n geometry = latLng(geometry);\r\n }\r\n this._setGeometryParams(geometry);\r\n return this;\r\n },\r\n\r\n layerDef: function (id, where) {\r\n this.params.layerDefs = (this.params.layerDefs) ? this.params.layerDefs + ';' : '';\r\n this.params.layerDefs += ([id, where]).join(':');\r\n return this;\r\n },\r\n\r\n simplify: function (map, factor) {\r\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\r\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\r\n return this;\r\n },\r\n\r\n run: function (callback, context) {\r\n return this.request(function (error, response) {\r\n // immediately invoke with an error\r\n if (error) {\r\n callback.call(context, error, undefined, response);\r\n\r\n // ok no error lets just assume we have features...\r\n } else {\r\n var featureCollection = responseToFeatureCollection(response);\r\n response.results = response.results.reverse();\r\n for (var i = 0; i < featureCollection.features.length; i++) {\r\n var feature = featureCollection.features[i];\r\n feature.layerId = response.results[i].layerId;\r\n }\r\n callback.call(context, undefined, featureCollection, response);\r\n }\r\n });\r\n },\r\n\r\n _setGeometryParams: function (geometry) {\r\n var converted = _setGeometry(geometry);\r\n this.params.geometry = converted.geometry;\r\n this.params.geometryType = converted.geometryType;\r\n }\r\n});\r\n\r\nexport function identifyFeatures (options) {\r\n return new IdentifyFeatures(options);\r\n}\r\n\r\nexport default identifyFeatures;\r\n","import { latLng } from 'leaflet';\r\nimport { Identify } from './Identify';\r\nimport { responseToFeatureCollection } from '../Util';\r\n\r\nexport var IdentifyImage = Identify.extend({\r\n setters: {\r\n setMosaicRule: 'mosaicRule',\r\n setRenderingRule: 'renderingRule',\r\n setPixelSize: 'pixelSize',\r\n returnCatalogItems: 'returnCatalogItems',\r\n returnGeometry: 'returnGeometry'\r\n },\r\n\r\n params: {\r\n returnGeometry: false\r\n },\r\n\r\n at: function (latlng) {\r\n latlng = latLng(latlng);\r\n this.params.geometry = JSON.stringify({\r\n x: latlng.lng,\r\n y: latlng.lat,\r\n spatialReference: {\r\n wkid: 4326\r\n }\r\n });\r\n this.params.geometryType = 'esriGeometryPoint';\r\n return this;\r\n },\r\n\r\n getMosaicRule: function () {\r\n return this.params.mosaicRule;\r\n },\r\n\r\n getRenderingRule: function () {\r\n return this.params.renderingRule;\r\n },\r\n\r\n getPixelSize: function () {\r\n return this.params.pixelSize;\r\n },\r\n\r\n run: function (callback, context) {\r\n return this.request(function (error, response) {\r\n callback.call(context, error, (response && this._responseToGeoJSON(response)), response);\r\n }, this);\r\n },\r\n\r\n // get pixel data and return as geoJSON point\r\n // populate catalog items (if any)\r\n // merging in any catalogItemVisibilities as a propery of each feature\r\n _responseToGeoJSON: function (response) {\r\n var location = response.location;\r\n var catalogItems = response.catalogItems;\r\n var catalogItemVisibilities = response.catalogItemVisibilities;\r\n var geoJSON = {\r\n pixel: {\r\n type: 'Feature',\r\n geometry: {\r\n type: 'Point',\r\n coordinates: [location.x, location.y]\r\n },\r\n crs: {\r\n type: 'EPSG',\r\n properties: {\r\n code: location.spatialReference.wkid\r\n }\r\n },\r\n properties: {\r\n OBJECTID: response.objectId,\r\n name: response.name,\r\n value: response.value\r\n },\r\n id: response.objectId\r\n }\r\n };\r\n\r\n if (response.properties && response.properties.Values) {\r\n geoJSON.pixel.properties.values = response.properties.Values;\r\n }\r\n\r\n if (catalogItems && catalogItems.features) {\r\n geoJSON.catalogItems = responseToFeatureCollection(catalogItems);\r\n if (catalogItemVisibilities && catalogItemVisibilities.length === geoJSON.catalogItems.features.length) {\r\n for (var i = catalogItemVisibilities.length - 1; i >= 0; i--) {\r\n geoJSON.catalogItems.features[i].properties.catalogItemVisibility = catalogItemVisibilities[i];\r\n }\r\n }\r\n }\r\n return geoJSON;\r\n }\r\n\r\n});\r\n\r\nexport function identifyImage (params) {\r\n return new IdentifyImage(params);\r\n}\r\n\r\nexport default identifyImage;\r\n","import { Util, Evented } from 'leaflet';\r\nimport { cors } from '../Support';\r\nimport { cleanUrl, getUrlParams } from '../Util';\r\nimport Request from '../Request';\r\n\r\nexport var Service = Evented.extend({\r\n\r\n options: {\r\n proxy: false,\r\n useCors: cors,\r\n timeout: 0\r\n },\r\n\r\n initialize: function (options) {\r\n options = options || {};\r\n this._requestQueue = [];\r\n this._authenticating = false;\r\n Util.setOptions(this, options);\r\n this.options.url = cleanUrl(this.options.url);\r\n },\r\n\r\n get: function (path, params, callback, context) {\r\n return this._request('get', path, params, callback, context);\r\n },\r\n\r\n post: function (path, params, callback, context) {\r\n return this._request('post', path, params, callback, context);\r\n },\r\n\r\n request: function (path, params, callback, context) {\r\n return this._request('request', path, params, callback, context);\r\n },\r\n\r\n metadata: function (callback, context) {\r\n return this._request('get', '', {}, callback, context);\r\n },\r\n\r\n authenticate: function (token) {\r\n this._authenticating = false;\r\n this.options.token = token;\r\n this._runQueue();\r\n return this;\r\n },\r\n\r\n getTimeout: function () {\r\n return this.options.timeout;\r\n },\r\n\r\n setTimeout: function (timeout) {\r\n this.options.timeout = timeout;\r\n },\r\n\r\n _request: function (method, path, params, callback, context) {\r\n this.fire('requeststart', {\r\n url: this.options.url + path,\r\n params: params,\r\n method: method\r\n }, true);\r\n\r\n var wrappedCallback = this._createServiceCallback(method, path, params, callback, context);\r\n\r\n if (this.options.token) {\r\n params.token = this.options.token;\r\n }\r\n if (this.options.requestParams) {\r\n Util.extend(params, this.options.requestParams);\r\n }\r\n if (this._authenticating) {\r\n this._requestQueue.push([method, path, params, callback, context]);\r\n } else {\r\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.options.url + path : this.options.url + path;\r\n\r\n if ((method === 'get' || method === 'request') && !this.options.useCors) {\r\n return Request.get.JSONP(url, params, wrappedCallback, context);\r\n } else {\r\n return Request[method](url, params, wrappedCallback, context);\r\n }\r\n }\r\n },\r\n\r\n _createServiceCallback: function (method, path, params, callback, context) {\r\n return Util.bind(function (error, response) {\r\n if (error && (error.code === 499 || error.code === 498)) {\r\n this._authenticating = true;\r\n\r\n this._requestQueue.push([method, path, params, callback, context]);\r\n\r\n // fire an event for users to handle and re-authenticate\r\n this.fire('authenticationrequired', {\r\n authenticate: Util.bind(this.authenticate, this)\r\n }, true);\r\n\r\n // if the user has access to a callback they can handle the auth error\r\n error.authenticate = Util.bind(this.authenticate, this);\r\n }\r\n\r\n callback.call(context, error, response);\r\n\r\n if (error) {\r\n this.fire('requesterror', {\r\n url: this.options.url + path,\r\n params: params,\r\n message: error.message,\r\n code: error.code,\r\n method: method\r\n }, true);\r\n } else {\r\n this.fire('requestsuccess', {\r\n url: this.options.url + path,\r\n params: params,\r\n response: response,\r\n method: method\r\n }, true);\r\n }\r\n\r\n this.fire('requestend', {\r\n url: this.options.url + path,\r\n params: params,\r\n method: method\r\n }, true);\r\n }, this);\r\n },\r\n\r\n _runQueue: function () {\r\n for (var i = this._requestQueue.length - 1; i >= 0; i--) {\r\n var request = this._requestQueue[i];\r\n var method = request.shift();\r\n this[method].apply(this, request);\r\n }\r\n this._requestQueue = [];\r\n }\r\n});\r\n\r\nexport function service (options) {\r\n options = getUrlParams(options);\r\n return new Service(options);\r\n}\r\n\r\nexport default service;\r\n","import { Service } from './Service';\r\nimport identifyFeatures from '../Tasks/IdentifyFeatures';\r\nimport query from '../Tasks/Query';\r\nimport find from '../Tasks/Find';\r\n\r\nexport var MapService = Service.extend({\r\n\r\n identify: function () {\r\n return identifyFeatures(this);\r\n },\r\n\r\n find: function () {\r\n return find(this);\r\n },\r\n\r\n query: function () {\r\n return query(this);\r\n }\r\n\r\n});\r\n\r\nexport function mapService (options) {\r\n return new MapService(options);\r\n}\r\n\r\nexport default mapService;\r\n","import { Service } from './Service';\r\nimport identifyImage from '../Tasks/IdentifyImage';\r\nimport query from '../Tasks/Query';\r\n\r\nexport var ImageService = Service.extend({\r\n\r\n query: function () {\r\n return query(this);\r\n },\r\n\r\n identify: function () {\r\n return identifyImage(this);\r\n }\r\n});\r\n\r\nexport function imageService (options) {\r\n return new ImageService(options);\r\n}\r\n\r\nexport default imageService;\r\n","import { Service } from './Service';\r\nimport query from '../Tasks/Query';\r\nimport { geojsonToArcGIS } from '../Util';\r\n\r\nexport var FeatureLayerService = Service.extend({\r\n\r\n options: {\r\n idAttribute: 'OBJECTID'\r\n },\r\n\r\n query: function () {\r\n return query(this);\r\n },\r\n\r\n addFeature: function (feature, callback, context) {\r\n this.addFeatures(feature, callback, context);\r\n },\r\n\r\n addFeatures: function (features, callback, context) {\r\n var featuresArray = features.features ? features.features : [features];\r\n for (var i = featuresArray.length - 1; i >= 0; i--) {\r\n delete featuresArray[i].id;\r\n }\r\n features = geojsonToArcGIS(features);\r\n features = featuresArray.length > 1 ? features : [features];\r\n return this.post('addFeatures', {\r\n features: features\r\n }, function (error, response) {\r\n // For compatibility reason with former addFeature function,\r\n // we return the object in the array and not the array itself\r\n var result = (response && response.addResults) ? response.addResults.length > 1 ? response.addResults : response.addResults[0] : undefined;\r\n if (callback) {\r\n callback.call(context, error || response.addResults[0].error, result);\r\n }\r\n }, context);\r\n },\r\n\r\n updateFeature: function (feature, callback, context) {\r\n this.updateFeatures(feature, callback, context);\r\n },\r\n\r\n updateFeatures: function (features, callback, context) {\r\n var featuresArray = features.features ? features.features : [features];\r\n features = geojsonToArcGIS(features, this.options.idAttribute);\r\n features = featuresArray.length > 1 ? features : [features];\r\n\r\n return this.post('updateFeatures', {\r\n features: features\r\n }, function (error, response) {\r\n // For compatibility reason with former updateFeature function,\r\n // we return the object in the array and not the array itself\r\n var result = (response && response.updateResults) ? response.updateResults.length > 1 ? response.updateResults : response.updateResults[0] : undefined;\r\n if (callback) {\r\n callback.call(context, error || response.updateResults[0].error, result);\r\n }\r\n }, context);\r\n },\r\n\r\n deleteFeature: function (id, callback, context) {\r\n this.deleteFeatures(id, callback, context);\r\n },\r\n\r\n deleteFeatures: function (ids, callback, context) {\r\n return this.post('deleteFeatures', {\r\n objectIds: ids\r\n }, function (error, response) {\r\n // For compatibility reason with former deleteFeature function,\r\n // we return the object in the array and not the array itself\r\n var result = (response && response.deleteResults) ? response.deleteResults.length > 1 ? response.deleteResults : response.deleteResults[0] : undefined;\r\n if (callback) {\r\n callback.call(context, error || response.deleteResults[0].error, result);\r\n }\r\n }, context);\r\n }\r\n});\r\n\r\nexport function featureLayerService (options) {\r\n return new FeatureLayerService(options);\r\n}\r\n\r\nexport default featureLayerService;\r\n","import { TileLayer, Util } from 'leaflet';\r\nimport { pointerEvents } from '../Support';\r\nimport {\r\n setEsriAttribution,\r\n removeEsriAttribution,\r\n _getAttributionData,\r\n _updateMapAttribution\r\n} from '../Util';\r\n\r\nvar tileProtocol = (window.location.protocol !== 'https:') ? 'http:' : 'https:';\r\n\r\nexport var BasemapLayer = TileLayer.extend({\r\n statics: {\r\n TILES: {\r\n Streets: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 19,\r\n subdomains: ['server', 'services'],\r\n attribution: 'USGS, NOAA',\r\n attributionUrl: 'https://static.arcgis.com/attribution/World_Street_Map'\r\n }\r\n },\r\n Topographic: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 19,\r\n subdomains: ['server', 'services'],\r\n attribution: 'USGS, NOAA',\r\n attributionUrl: 'https://static.arcgis.com/attribution/World_Topo_Map'\r\n }\r\n },\r\n Oceans: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 16,\r\n subdomains: ['server', 'services'],\r\n attribution: 'USGS, NOAA',\r\n attributionUrl: 'https://static.arcgis.com/attribution/Ocean_Basemap'\r\n }\r\n },\r\n OceansLabels: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 16,\r\n subdomains: ['server', 'services'],\r\n pane: (pointerEvents) ? 'esri-labels' : 'tilePane',\r\n attribution: ''\r\n }\r\n },\r\n NationalGeographic: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 16,\r\n subdomains: ['server', 'services'],\r\n attribution: 'National Geographic, DeLorme, HERE, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, increment P Corp.'\r\n }\r\n },\r\n DarkGray: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 16,\r\n subdomains: ['server', 'services'],\r\n attribution: 'HERE, DeLorme, MapmyIndia, © OpenStreetMap contributors'\r\n }\r\n },\r\n DarkGrayLabels: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Reference/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 16,\r\n subdomains: ['server', 'services'],\r\n pane: (pointerEvents) ? 'esri-labels' : 'tilePane',\r\n attribution: ''\r\n\r\n }\r\n },\r\n Gray: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 16,\r\n subdomains: ['server', 'services'],\r\n attribution: 'HERE, DeLorme, MapmyIndia, © OpenStreetMap contributors'\r\n }\r\n },\r\n GrayLabels: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 16,\r\n subdomains: ['server', 'services'],\r\n pane: (pointerEvents) ? 'esri-labels' : 'tilePane',\r\n attribution: ''\r\n }\r\n },\r\n Imagery: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 19,\r\n subdomains: ['server', 'services'],\r\n attribution: 'DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community',\r\n attributionUrl: 'https://static.arcgis.com/attribution/World_Imagery'\r\n }\r\n },\r\n ImageryLabels: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 19,\r\n subdomains: ['server', 'services'],\r\n pane: (pointerEvents) ? 'esri-labels' : 'tilePane',\r\n attribution: ''\r\n }\r\n },\r\n ImageryTransportation: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 19,\r\n subdomains: ['server', 'services'],\r\n pane: (pointerEvents) ? 'esri-labels' : 'tilePane',\r\n attribution: ''\r\n }\r\n },\r\n ShadedRelief: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 13,\r\n subdomains: ['server', 'services'],\r\n attribution: 'USGS'\r\n }\r\n },\r\n ShadedReliefLabels: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 12,\r\n subdomains: ['server', 'services'],\r\n pane: (pointerEvents) ? 'esri-labels' : 'tilePane',\r\n attribution: ''\r\n }\r\n },\r\n Terrain: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 13,\r\n subdomains: ['server', 'services'],\r\n attribution: 'USGS, NOAA'\r\n }\r\n },\r\n TerrainLabels: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 13,\r\n subdomains: ['server', 'services'],\r\n pane: (pointerEvents) ? 'esri-labels' : 'tilePane',\r\n attribution: ''\r\n }\r\n },\r\n USATopo: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 15,\r\n subdomains: ['server', 'services'],\r\n attribution: 'USGS, National Geographic Society, i-cubed'\r\n }\r\n },\r\n ImageryClarity: {\r\n urlTemplate: tileProtocol + '//clarity.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 19,\r\n attribution: 'Esri, DigitalGlobe, GeoEye, Earthstar Geographics, CNES/Airbus DS, USDA, USGS, AeroGRID, IGN, and the GIS User Community'\r\n }\r\n },\r\n Physical: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 8,\r\n subdomains: ['server', 'services'],\r\n attribution: 'U.S. National Park Service'\r\n }\r\n },\r\n ImageryFirefly: {\r\n urlTemplate: tileProtocol + '//fly.maptiles.arcgis.com/arcgis/rest/services/World_Imagery_Firefly/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 19,\r\n attribution: 'Esri, DigitalGlobe, GeoEye, Earthstar Geographics, CNES/Airbus DS, USDA, USGS, AeroGRID, IGN, and the GIS User Community',\r\n attributionUrl: 'https://static.arcgis.com/attribution/World_Imagery'\r\n }\r\n }\r\n }\r\n },\r\n\r\n initialize: function (key, options) {\r\n var config;\r\n\r\n // set the config variable with the appropriate config object\r\n if (typeof key === 'object' && key.urlTemplate && key.options) {\r\n config = key;\r\n } else if (typeof key === 'string' && BasemapLayer.TILES[key]) {\r\n config = BasemapLayer.TILES[key];\r\n } else {\r\n throw new Error('L.esri.BasemapLayer: Invalid parameter. Use one of \"Streets\", \"Topographic\", \"Oceans\", \"OceansLabels\", \"NationalGeographic\", \"Physical\", \"Gray\", \"GrayLabels\", \"DarkGray\", \"DarkGrayLabels\", \"Imagery\", \"ImageryLabels\", \"ImageryTransportation\", \"ImageryClarity\", \"ImageryFirefly\", ShadedRelief\", \"ShadedReliefLabels\", \"Terrain\", \"TerrainLabels\" or \"USATopo\"');\r\n }\r\n\r\n // merge passed options into the config options\r\n var tileOptions = Util.extend(config.options, options);\r\n\r\n Util.setOptions(this, tileOptions);\r\n\r\n // Deprecation notice:\r\n if (!this.options.ignoreDeprecationWarning) {\r\n console.warn('WARNING: L.esri.BasemapLayer uses data services that are in mature support and are not being updated. Please use L.esri.Vector.vectorBasemapLayer instead. More info: https://esriurl.com/esri-leaflet-basemap');\r\n }\r\n\r\n if (this.options.token && config.urlTemplate.indexOf('token=') === -1) {\r\n config.urlTemplate += ('?token=' + this.options.token);\r\n }\r\n if (this.options.proxy) {\r\n config.urlTemplate = this.options.proxy + '?' + config.urlTemplate;\r\n }\r\n\r\n // call the initialize method on L.TileLayer to set everything up\r\n TileLayer.prototype.initialize.call(this, config.urlTemplate, tileOptions);\r\n },\r\n\r\n onAdd: function (map) {\r\n // include 'Powered by Esri' in map attribution\r\n setEsriAttribution(map);\r\n\r\n if (this.options.pane === 'esri-labels') {\r\n this._initPane();\r\n }\r\n // some basemaps can supply dynamic attribution\r\n if (this.options.attributionUrl) {\r\n _getAttributionData((this.options.proxy ? this.options.proxy + '?' : '') + this.options.attributionUrl, map);\r\n }\r\n\r\n map.on('moveend', _updateMapAttribution);\r\n\r\n TileLayer.prototype.onAdd.call(this, map);\r\n },\r\n\r\n onRemove: function (map) {\r\n removeEsriAttribution(map);\r\n\r\n map.off('moveend', _updateMapAttribution);\r\n\r\n TileLayer.prototype.onRemove.call(this, map);\r\n },\r\n\r\n _initPane: function () {\r\n if (!this._map.getPane(this.options.pane)) {\r\n var pane = this._map.createPane(this.options.pane);\r\n pane.style.pointerEvents = 'none';\r\n pane.style.zIndex = 500;\r\n }\r\n },\r\n\r\n getAttribution: function () {\r\n if (this.options.attribution) {\r\n var attribution = '' + this.options.attribution + '';\r\n }\r\n return attribution;\r\n }\r\n});\r\n\r\nexport function basemapLayer (key, options) {\r\n return new BasemapLayer(key, options);\r\n}\r\n\r\nexport default basemapLayer;\r\n","import { CRS, DomEvent, TileLayer, Util } from 'leaflet';\r\nimport { warn, getUrlParams, setEsriAttribution, removeEsriAttribution } from '../Util';\r\nimport mapService from '../Services/MapService';\r\n\r\nexport var TiledMapLayer = TileLayer.extend({\r\n options: {\r\n zoomOffsetAllowance: 0.1,\r\n errorTileUrl: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEABAMAAACuXLVVAAAAA1BMVEUzNDVszlHHAAAAAXRSTlMAQObYZgAAAAlwSFlzAAAAAAAAAAAB6mUWpAAAADZJREFUeJztwQEBAAAAgiD/r25IQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7waBAAABw08RwAAAAABJRU5ErkJggg=='\r\n },\r\n\r\n statics: {\r\n MercatorZoomLevels: {\r\n 0: 156543.03392799999,\r\n 1: 78271.516963999893,\r\n 2: 39135.758482000099,\r\n 3: 19567.879240999901,\r\n 4: 9783.9396204999593,\r\n 5: 4891.9698102499797,\r\n 6: 2445.9849051249898,\r\n 7: 1222.9924525624899,\r\n 8: 611.49622628138002,\r\n 9: 305.74811314055802,\r\n 10: 152.874056570411,\r\n 11: 76.437028285073197,\r\n 12: 38.218514142536598,\r\n 13: 19.109257071268299,\r\n 14: 9.5546285356341496,\r\n 15: 4.7773142679493699,\r\n 16: 2.38865713397468,\r\n 17: 1.1943285668550501,\r\n 18: 0.59716428355981699,\r\n 19: 0.29858214164761698,\r\n 20: 0.14929107082381,\r\n 21: 0.07464553541191,\r\n 22: 0.0373227677059525,\r\n 23: 0.0186613838529763\r\n }\r\n },\r\n\r\n initialize: function (options) {\r\n options = Util.setOptions(this, options);\r\n\r\n // set the urls\r\n options = getUrlParams(options);\r\n this.tileUrl = (options.proxy ? options.proxy + '?' : '') + options.url + 'tile/{z}/{y}/{x}' + (options.requestParams && Object.keys(options.requestParams).length > 0 ? Util.getParamString(options.requestParams) : '');\r\n // Remove subdomain in url\r\n // https://github.com/Esri/esri-leaflet/issues/991\r\n if (options.url.indexOf('{s}') !== -1 && options.subdomains) {\r\n options.url = options.url.replace('{s}', options.subdomains[0]);\r\n }\r\n this.service = mapService(options);\r\n this.service.addEventParent(this);\r\n\r\n var arcgisonline = new RegExp(/tiles.arcgis(online)?\\.com/g);\r\n if (arcgisonline.test(options.url)) {\r\n this.tileUrl = this.tileUrl.replace('://tiles', '://tiles{s}');\r\n options.subdomains = ['1', '2', '3', '4'];\r\n }\r\n\r\n if (this.options.token) {\r\n this.tileUrl += ('?token=' + this.options.token);\r\n }\r\n\r\n // init layer by calling TileLayers initialize method\r\n TileLayer.prototype.initialize.call(this, this.tileUrl, options);\r\n },\r\n\r\n getTileUrl: function (tilePoint) {\r\n var zoom = this._getZoomForUrl();\r\n\r\n return Util.template(this.tileUrl, Util.extend({\r\n s: this._getSubdomain(tilePoint),\r\n x: tilePoint.x,\r\n y: tilePoint.y,\r\n // try lod map first, then just default to zoom level\r\n z: (this._lodMap && this._lodMap[zoom] !== undefined) ? this._lodMap[zoom] : zoom\r\n }, this.options));\r\n },\r\n\r\n createTile: function (coords, done) {\r\n var tile = document.createElement('img');\r\n\r\n DomEvent.on(tile, 'load', Util.bind(this._tileOnLoad, this, done, tile));\r\n DomEvent.on(tile, 'error', Util.bind(this._tileOnError, this, done, tile));\r\n\r\n if (this.options.crossOrigin) {\r\n tile.crossOrigin = '';\r\n }\r\n\r\n /*\r\n Alt tag is set to empty string to keep screen readers from reading URL and for compliance reasons\r\n http://www.w3.org/TR/WCAG20-TECHS/H67\r\n */\r\n tile.alt = '';\r\n\r\n // if there is no lod map or an lod map with a proper zoom load the tile\r\n // otherwise wait for the lod map to become available\r\n if (!this._lodMap || (this._lodMap && this._lodMap[this._getZoomForUrl()] !== undefined)) {\r\n tile.src = this.getTileUrl(coords);\r\n } else {\r\n this.once('lodmap', function () {\r\n tile.src = this.getTileUrl(coords);\r\n }, this);\r\n }\r\n\r\n return tile;\r\n },\r\n\r\n onAdd: function (map) {\r\n // include 'Powered by Esri' in map attribution\r\n setEsriAttribution(map);\r\n\r\n if (!this._lodMap) {\r\n this.metadata(function (error, metadata) {\r\n if (!error && metadata.spatialReference) {\r\n var sr = metadata.spatialReference.latestWkid || metadata.spatialReference.wkid;\r\n // display the copyright text from the service using leaflet's attribution control\r\n if (!this.options.attribution && map.attributionControl && metadata.copyrightText) {\r\n this.options.attribution = metadata.copyrightText;\r\n map.attributionControl.addAttribution(this.getAttribution());\r\n }\r\n\r\n // if the service tiles were published in web mercator using conventional LODs but missing levels, we can try and remap them\r\n if (map.options.crs === CRS.EPSG3857 && (sr === 102100 || sr === 3857)) {\r\n this._lodMap = {};\r\n // create the zoom level data\r\n var arcgisLODs = metadata.tileInfo.lods;\r\n var correctResolutions = TiledMapLayer.MercatorZoomLevels;\r\n\r\n for (var i = 0; i < arcgisLODs.length; i++) {\r\n var arcgisLOD = arcgisLODs[i];\r\n for (var ci in correctResolutions) {\r\n var correctRes = correctResolutions[ci];\r\n\r\n if (this._withinPercentage(arcgisLOD.resolution, correctRes, this.options.zoomOffsetAllowance)) {\r\n this._lodMap[ci] = arcgisLOD.level;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n this.fire('lodmap');\r\n } else if (map.options.crs && map.options.crs.code && (map.options.crs.code.indexOf(sr) > -1)) {\r\n // if the projection is WGS84, or the developer is using Proj4 to define a custom CRS, no action is required\r\n } else {\r\n // if the service was cached in a custom projection and an appropriate LOD hasn't been defined in the map, guide the developer to our Proj4 sample\r\n warn('L.esri.TiledMapLayer is using a non-mercator spatial reference. Support may be available through Proj4Leaflet https://developers.arcgis.com/esri-leaflet/samples/non-mercator-projection/');\r\n }\r\n }\r\n }, this);\r\n }\r\n\r\n TileLayer.prototype.onAdd.call(this, map);\r\n },\r\n\r\n onRemove: function (map) {\r\n removeEsriAttribution(map);\r\n\r\n TileLayer.prototype.onRemove.call(this, map);\r\n },\r\n\r\n metadata: function (callback, context) {\r\n this.service.metadata(callback, context);\r\n return this;\r\n },\r\n\r\n identify: function () {\r\n return this.service.identify();\r\n },\r\n\r\n find: function () {\r\n return this.service.find();\r\n },\r\n\r\n query: function () {\r\n return this.service.query();\r\n },\r\n\r\n authenticate: function (token) {\r\n var tokenQs = '?token=' + token;\r\n this.tileUrl = (this.options.token) ? this.tileUrl.replace(/\\?token=(.+)/g, tokenQs) : this.tileUrl + tokenQs;\r\n this.options.token = token;\r\n this.service.authenticate(token);\r\n return this;\r\n },\r\n\r\n _withinPercentage: function (a, b, percentage) {\r\n var diff = Math.abs((a / b) - 1);\r\n return diff < percentage;\r\n }\r\n});\r\n\r\nexport function tiledMapLayer (url, options) {\r\n return new TiledMapLayer(url, options);\r\n}\r\n\r\nexport default tiledMapLayer;\r\n","import { ImageOverlay, CRS, DomUtil, Util, Layer, popup, latLng, bounds } from 'leaflet';\r\nimport { cors } from '../Support';\r\nimport { setEsriAttribution, removeEsriAttribution } from '../Util';\r\n\r\nvar Overlay = ImageOverlay.extend({\r\n onAdd: function (map) {\r\n this._topLeft = map.getPixelBounds().min;\r\n ImageOverlay.prototype.onAdd.call(this, map);\r\n },\r\n _reset: function () {\r\n if (this._map.options.crs === CRS.EPSG3857) {\r\n ImageOverlay.prototype._reset.call(this);\r\n } else {\r\n DomUtil.setPosition(this._image, this._topLeft.subtract(this._map.getPixelOrigin()));\r\n }\r\n }\r\n});\r\n\r\nexport var RasterLayer = Layer.extend({\r\n options: {\r\n opacity: 1,\r\n position: 'front',\r\n f: 'image',\r\n useCors: cors,\r\n attribution: null,\r\n interactive: false,\r\n alt: ''\r\n },\r\n\r\n onAdd: function (map) {\r\n // include 'Powered by Esri' in map attribution\r\n setEsriAttribution(map);\r\n\r\n if (this.options.zIndex) {\r\n this.options.position = null;\r\n }\r\n\r\n this._update = Util.throttle(this._update, this.options.updateInterval, this);\r\n\r\n map.on('moveend', this._update, this);\r\n\r\n // if we had an image loaded and it matches the\r\n // current bounds show the image otherwise remove it\r\n if (this._currentImage && this._currentImage._bounds.equals(this._map.getBounds())) {\r\n map.addLayer(this._currentImage);\r\n } else if (this._currentImage) {\r\n this._map.removeLayer(this._currentImage);\r\n this._currentImage = null;\r\n }\r\n\r\n this._update();\r\n\r\n if (this._popup) {\r\n this._map.on('click', this._getPopupData, this);\r\n this._map.on('dblclick', this._resetPopupState, this);\r\n }\r\n\r\n // add copyright text listed in service metadata\r\n this.metadata(function (err, metadata) {\r\n if (!err && !this.options.attribution && map.attributionControl && metadata.copyrightText) {\r\n this.options.attribution = metadata.copyrightText;\r\n map.attributionControl.addAttribution(this.getAttribution());\r\n }\r\n }, this);\r\n },\r\n\r\n onRemove: function (map) {\r\n removeEsriAttribution(map);\r\n\r\n if (this._currentImage) {\r\n this._map.removeLayer(this._currentImage);\r\n }\r\n\r\n if (this._popup) {\r\n this._map.off('click', this._getPopupData, this);\r\n this._map.off('dblclick', this._resetPopupState, this);\r\n }\r\n\r\n this._map.off('moveend', this._update, this);\r\n },\r\n\r\n bindPopup: function (fn, popupOptions) {\r\n this._shouldRenderPopup = false;\r\n this._lastClick = false;\r\n this._popup = popup(popupOptions);\r\n this._popupFunction = fn;\r\n if (this._map) {\r\n this._map.on('click', this._getPopupData, this);\r\n this._map.on('dblclick', this._resetPopupState, this);\r\n }\r\n return this;\r\n },\r\n\r\n unbindPopup: function () {\r\n if (this._map) {\r\n this._map.closePopup(this._popup);\r\n this._map.off('click', this._getPopupData, this);\r\n this._map.off('dblclick', this._resetPopupState, this);\r\n }\r\n this._popup = false;\r\n return this;\r\n },\r\n\r\n bringToFront: function () {\r\n this.options.position = 'front';\r\n if (this._currentImage) {\r\n this._currentImage.bringToFront();\r\n this._setAutoZIndex(Math.max);\r\n }\r\n return this;\r\n },\r\n\r\n bringToBack: function () {\r\n this.options.position = 'back';\r\n if (this._currentImage) {\r\n this._currentImage.bringToBack();\r\n this._setAutoZIndex(Math.min);\r\n }\r\n return this;\r\n },\r\n\r\n setZIndex: function (value) {\r\n this.options.zIndex = value;\r\n if (this._currentImage) {\r\n this._currentImage.setZIndex(value);\r\n }\r\n return this;\r\n },\r\n\r\n _setAutoZIndex: function (compare) {\r\n // go through all other layers of the same pane, set zIndex to max + 1 (front) or min - 1 (back)\r\n if (!this._currentImage) {\r\n return;\r\n }\r\n var layers = this._currentImage.getPane().children;\r\n var edgeZIndex = -compare(-Infinity, Infinity); // -Infinity for max, Infinity for min\r\n for (var i = 0, len = layers.length, zIndex; i < len; i++) {\r\n zIndex = layers[i].style.zIndex;\r\n if (layers[i] !== this._currentImage._image && zIndex) {\r\n edgeZIndex = compare(edgeZIndex, +zIndex);\r\n }\r\n }\r\n\r\n if (isFinite(edgeZIndex)) {\r\n this.options.zIndex = edgeZIndex + compare(-1, 1);\r\n this.setZIndex(this.options.zIndex);\r\n }\r\n },\r\n\r\n getAttribution: function () {\r\n return this.options.attribution;\r\n },\r\n\r\n getOpacity: function () {\r\n return this.options.opacity;\r\n },\r\n\r\n setOpacity: function (opacity) {\r\n this.options.opacity = opacity;\r\n if (this._currentImage) {\r\n this._currentImage.setOpacity(opacity);\r\n }\r\n return this;\r\n },\r\n\r\n getTimeRange: function () {\r\n return [this.options.from, this.options.to];\r\n },\r\n\r\n setTimeRange: function (from, to) {\r\n this.options.from = from;\r\n this.options.to = to;\r\n this._update();\r\n return this;\r\n },\r\n\r\n metadata: function (callback, context) {\r\n this.service.metadata(callback, context);\r\n return this;\r\n },\r\n\r\n authenticate: function (token) {\r\n this.service.authenticate(token);\r\n return this;\r\n },\r\n\r\n redraw: function () {\r\n this._update();\r\n },\r\n\r\n _renderImage: function (url, bounds, contentType) {\r\n if (this._map) {\r\n // if no output directory has been specified for a service, MIME data will be returned\r\n if (contentType) {\r\n url = 'data:' + contentType + ';base64,' + url;\r\n }\r\n\r\n // if server returns an inappropriate response, abort.\r\n if (!url) return;\r\n\r\n // create a new image overlay and add it to the map\r\n // to start loading the image\r\n // opacity is 0 while the image is loading\r\n var image = new Overlay(url, bounds, {\r\n opacity: 0,\r\n crossOrigin: this.options.withCredentials ? 'use-credentials' : this.options.useCors,\r\n alt: this.options.alt,\r\n pane: this.options.pane || this.getPane(),\r\n interactive: this.options.interactive\r\n }).addTo(this._map);\r\n\r\n var onOverlayError = function () {\r\n this._map.removeLayer(image);\r\n this.fire('error');\r\n image.off('load', onOverlayLoad, this);\r\n };\r\n\r\n var onOverlayLoad = function (e) {\r\n image.off('error', onOverlayError, this);\r\n if (this._map) {\r\n var newImage = e.target;\r\n var oldImage = this._currentImage;\r\n\r\n // if the bounds of this image matches the bounds that\r\n // _renderImage was called with and we have a map with the same bounds\r\n // hide the old image if there is one and set the opacity\r\n // of the new image otherwise remove the new image\r\n if (newImage._bounds.equals(bounds) && newImage._bounds.equals(this._map.getBounds())) {\r\n this._currentImage = newImage;\r\n\r\n if (this.options.position === 'front') {\r\n this.bringToFront();\r\n } else if (this.options.position === 'back') {\r\n this.bringToBack();\r\n }\r\n\r\n if (this.options.zIndex) {\r\n this.setZIndex(this.options.zIndex);\r\n }\r\n\r\n if (this._map && this._currentImage._map) {\r\n this._currentImage.setOpacity(this.options.opacity);\r\n } else {\r\n this._currentImage._map.removeLayer(this._currentImage);\r\n }\r\n\r\n if (oldImage && this._map) {\r\n this._map.removeLayer(oldImage);\r\n }\r\n\r\n if (oldImage && oldImage._map) {\r\n oldImage._map.removeLayer(oldImage);\r\n }\r\n } else {\r\n this._map.removeLayer(newImage);\r\n }\r\n }\r\n\r\n this.fire('load', {\r\n bounds: bounds\r\n });\r\n };\r\n\r\n // If loading the image fails\r\n image.once('error', onOverlayError, this);\r\n\r\n // once the image loads\r\n image.once('load', onOverlayLoad, this);\r\n }\r\n },\r\n\r\n _update: function () {\r\n if (!this._map) {\r\n return;\r\n }\r\n\r\n var zoom = this._map.getZoom();\r\n var bounds = this._map.getBounds();\r\n\r\n if (this._animatingZoom) {\r\n return;\r\n }\r\n\r\n if (this._map._panTransition && this._map._panTransition._inProgress) {\r\n return;\r\n }\r\n\r\n if (zoom > this.options.maxZoom || zoom < this.options.minZoom) {\r\n if (this._currentImage) {\r\n this._currentImage._map.removeLayer(this._currentImage);\r\n this._currentImage = null;\r\n }\r\n return;\r\n }\r\n\r\n var params = this._buildExportParams();\r\n Util.extend(params, this.options.requestParams);\r\n\r\n if (params) {\r\n this._requestExport(params, bounds);\r\n\r\n this.fire('loading', {\r\n bounds: bounds\r\n });\r\n } else if (this._currentImage) {\r\n this._currentImage._map.removeLayer(this._currentImage);\r\n this._currentImage = null;\r\n }\r\n },\r\n\r\n _renderPopup: function (latlng, error, results, response) {\r\n latlng = latLng(latlng);\r\n if (this._shouldRenderPopup && this._lastClick.equals(latlng)) {\r\n // add the popup to the map where the mouse was clicked at\r\n var content = this._popupFunction(error, results, response);\r\n if (content) {\r\n this._popup.setLatLng(latlng).setContent(content).openOn(this._map);\r\n }\r\n }\r\n },\r\n\r\n _resetPopupState: function (e) {\r\n this._shouldRenderPopup = false;\r\n this._lastClick = e.latlng;\r\n },\r\n\r\n _calculateBbox: function () {\r\n var pixelBounds = this._map.getPixelBounds();\r\n\r\n var sw = this._map.unproject(pixelBounds.getBottomLeft());\r\n var ne = this._map.unproject(pixelBounds.getTopRight());\r\n\r\n var neProjected = this._map.options.crs.project(ne);\r\n var swProjected = this._map.options.crs.project(sw);\r\n\r\n // this ensures ne/sw are switched in polar maps where north/top bottom/south is inverted\r\n var boundsProjected = bounds(neProjected, swProjected);\r\n\r\n return [boundsProjected.getBottomLeft().x, boundsProjected.getBottomLeft().y, boundsProjected.getTopRight().x, boundsProjected.getTopRight().y].join(',');\r\n },\r\n\r\n _calculateImageSize: function () {\r\n // ensure that we don't ask ArcGIS Server for a taller image than we have actual map displaying within the div\r\n var bounds = this._map.getPixelBounds();\r\n var size = this._map.getSize();\r\n\r\n var sw = this._map.unproject(bounds.getBottomLeft());\r\n var ne = this._map.unproject(bounds.getTopRight());\r\n\r\n var top = this._map.latLngToLayerPoint(ne).y;\r\n var bottom = this._map.latLngToLayerPoint(sw).y;\r\n\r\n if (top > 0 || bottom < size.y) {\r\n size.y = bottom - top;\r\n }\r\n\r\n return size.x + ',' + size.y;\r\n }\r\n});\r\n","import { Util } from 'leaflet';\r\nimport { RasterLayer } from './RasterLayer';\r\nimport { getUrlParams } from '../Util';\r\nimport imageService from '../Services/ImageService';\r\n\r\nexport var ImageMapLayer = RasterLayer.extend({\r\n\r\n options: {\r\n updateInterval: 150,\r\n format: 'jpgpng',\r\n transparent: true,\r\n f: 'image'\r\n },\r\n\r\n query: function () {\r\n return this.service.query();\r\n },\r\n\r\n identify: function () {\r\n return this.service.identify();\r\n },\r\n\r\n initialize: function (options) {\r\n options = getUrlParams(options);\r\n this.service = imageService(options);\r\n this.service.addEventParent(this);\r\n\r\n Util.setOptions(this, options);\r\n },\r\n\r\n setPixelType: function (pixelType) {\r\n this.options.pixelType = pixelType;\r\n this._update();\r\n return this;\r\n },\r\n\r\n getPixelType: function () {\r\n return this.options.pixelType;\r\n },\r\n\r\n setBandIds: function (bandIds) {\r\n if (Util.isArray(bandIds)) {\r\n this.options.bandIds = bandIds.join(',');\r\n } else {\r\n this.options.bandIds = bandIds.toString();\r\n }\r\n this._update();\r\n return this;\r\n },\r\n\r\n getBandIds: function () {\r\n return this.options.bandIds;\r\n },\r\n\r\n setNoData: function (noData, noDataInterpretation) {\r\n if (Util.isArray(noData)) {\r\n this.options.noData = noData.join(',');\r\n } else {\r\n this.options.noData = noData.toString();\r\n }\r\n if (noDataInterpretation) {\r\n this.options.noDataInterpretation = noDataInterpretation;\r\n }\r\n this._update();\r\n return this;\r\n },\r\n\r\n getNoData: function () {\r\n return this.options.noData;\r\n },\r\n\r\n getNoDataInterpretation: function () {\r\n return this.options.noDataInterpretation;\r\n },\r\n\r\n setRenderingRule: function (renderingRule) {\r\n this.options.renderingRule = renderingRule;\r\n this._update();\r\n },\r\n\r\n getRenderingRule: function () {\r\n return this.options.renderingRule;\r\n },\r\n\r\n setMosaicRule: function (mosaicRule) {\r\n this.options.mosaicRule = mosaicRule;\r\n this._update();\r\n },\r\n\r\n getMosaicRule: function () {\r\n return this.options.mosaicRule;\r\n },\r\n\r\n _getPopupData: function (e) {\r\n var callback = Util.bind(function (error, results, response) {\r\n if (error) { return; } // we really can't do anything here but authenticate or requesterror will fire\r\n setTimeout(Util.bind(function () {\r\n this._renderPopup(e.latlng, error, results, response);\r\n }, this), 300);\r\n }, this);\r\n\r\n var identifyRequest = this.identify().at(e.latlng);\r\n\r\n // set mosaic rule for identify task if it is set for layer\r\n if (this.options.mosaicRule) {\r\n identifyRequest.setMosaicRule(this.options.mosaicRule);\r\n // @TODO: force return catalog items too?\r\n }\r\n\r\n // @TODO: set rendering rule? Not sure,\r\n // sometimes you want raw pixel values\r\n // if (this.options.renderingRule) {\r\n // identifyRequest.setRenderingRule(this.options.renderingRule);\r\n // }\r\n\r\n identifyRequest.run(callback);\r\n\r\n // set the flags to show the popup\r\n this._shouldRenderPopup = true;\r\n this._lastClick = e.latlng;\r\n },\r\n\r\n _buildExportParams: function () {\r\n var sr = parseInt(this._map.options.crs.code.split(':')[1], 10);\r\n\r\n var params = {\r\n bbox: this._calculateBbox(),\r\n size: this._calculateImageSize(),\r\n format: this.options.format,\r\n transparent: this.options.transparent,\r\n bboxSR: sr,\r\n imageSR: sr\r\n };\r\n\r\n if (this.options.from && this.options.to) {\r\n params.time = this.options.from.valueOf() + ',' + this.options.to.valueOf();\r\n }\r\n\r\n if (this.options.pixelType) {\r\n params.pixelType = this.options.pixelType;\r\n }\r\n\r\n if (this.options.interpolation) {\r\n params.interpolation = this.options.interpolation;\r\n }\r\n\r\n if (this.options.compressionQuality) {\r\n params.compressionQuality = this.options.compressionQuality;\r\n }\r\n\r\n if (this.options.bandIds) {\r\n params.bandIds = this.options.bandIds;\r\n }\r\n\r\n // 0 is falsy *and* a valid input parameter\r\n if (this.options.noData === 0 || this.options.noData) {\r\n params.noData = this.options.noData;\r\n }\r\n\r\n if (this.options.noDataInterpretation) {\r\n params.noDataInterpretation = this.options.noDataInterpretation;\r\n }\r\n\r\n if (this.service.options.token) {\r\n params.token = this.service.options.token;\r\n }\r\n\r\n if (this.options.renderingRule) {\r\n params.renderingRule = JSON.stringify(this.options.renderingRule);\r\n }\r\n\r\n if (this.options.mosaicRule) {\r\n params.mosaicRule = JSON.stringify(this.options.mosaicRule);\r\n }\r\n\r\n return params;\r\n },\r\n\r\n _requestExport: function (params, bounds) {\r\n if (this.options.f === 'json') {\r\n this.service.request('exportImage', params, function (error, response) {\r\n if (error) { return; } // we really can't do anything here but authenticate or requesterror will fire\r\n if (this.options.token) {\r\n response.href += ('?token=' + this.options.token);\r\n }\r\n if (this.options.proxy) {\r\n response.href = this.options.proxy + '?' + response.href;\r\n }\r\n this._renderImage(response.href, bounds);\r\n }, this);\r\n } else {\r\n params.f = 'image';\r\n var fullUrl = this.options.url + 'exportImage' + Util.getParamString(params);\r\n if (this.options.proxy) {\r\n fullUrl = this.options.proxy + '?' + fullUrl;\r\n }\r\n this._renderImage(fullUrl, bounds);\r\n }\r\n }\r\n});\r\n\r\nexport function imageMapLayer (url, options) {\r\n return new ImageMapLayer(url, options);\r\n}\r\n\r\nexport default imageMapLayer;\r\n","import { Util } from 'leaflet';\r\nimport { RasterLayer } from './RasterLayer';\r\nimport { getUrlParams } from '../Util';\r\nimport mapService from '../Services/MapService';\r\n\r\nexport var DynamicMapLayer = RasterLayer.extend({\r\n\r\n options: {\r\n updateInterval: 150,\r\n layers: false,\r\n layerDefs: false,\r\n timeOptions: false,\r\n format: 'png32',\r\n transparent: true,\r\n f: 'json'\r\n },\r\n\r\n initialize: function (options) {\r\n options = getUrlParams(options);\r\n this.service = mapService(options);\r\n this.service.addEventParent(this);\r\n\r\n Util.setOptions(this, options);\r\n },\r\n\r\n getDynamicLayers: function () {\r\n return this.options.dynamicLayers;\r\n },\r\n\r\n setDynamicLayers: function (dynamicLayers) {\r\n this.options.dynamicLayers = dynamicLayers;\r\n this._update();\r\n return this;\r\n },\r\n\r\n getLayers: function () {\r\n return this.options.layers;\r\n },\r\n\r\n setLayers: function (layers) {\r\n this.options.layers = layers;\r\n this._update();\r\n return this;\r\n },\r\n\r\n getLayerDefs: function () {\r\n return this.options.layerDefs;\r\n },\r\n\r\n setLayerDefs: function (layerDefs) {\r\n this.options.layerDefs = layerDefs;\r\n this._update();\r\n return this;\r\n },\r\n\r\n getTimeOptions: function () {\r\n return this.options.timeOptions;\r\n },\r\n\r\n setTimeOptions: function (timeOptions) {\r\n this.options.timeOptions = timeOptions;\r\n this._update();\r\n return this;\r\n },\r\n\r\n query: function () {\r\n return this.service.query();\r\n },\r\n\r\n identify: function () {\r\n return this.service.identify();\r\n },\r\n\r\n find: function () {\r\n return this.service.find();\r\n },\r\n\r\n _getPopupData: function (e) {\r\n var callback = Util.bind(function (error, featureCollection, response) {\r\n if (error) { return; } // we really can't do anything here but authenticate or requesterror will fire\r\n setTimeout(Util.bind(function () {\r\n this._renderPopup(e.latlng, error, featureCollection, response);\r\n }, this), 300);\r\n }, this);\r\n\r\n var identifyRequest;\r\n if (this.options.popup) {\r\n identifyRequest = this.options.popup.on(this._map).at(e.latlng);\r\n } else {\r\n identifyRequest = this.identify().on(this._map).at(e.latlng);\r\n }\r\n\r\n // remove extraneous vertices from response features if it has not already been done\r\n if (!identifyRequest.params.maxAllowableOffset) {\r\n identifyRequest.simplify(this._map, 0.5);\r\n }\r\n\r\n if (!(this.options.popup && this.options.popup.params && this.options.popup.params.layers)) {\r\n if (this.options.layers) {\r\n identifyRequest.layers('visible:' + this.options.layers.join(','));\r\n } else {\r\n identifyRequest.layers('visible');\r\n }\r\n }\r\n\r\n // if present, pass layer ids and sql filters through to the identify task\r\n if (this.options.layerDefs && typeof this.options.layerDefs !== 'string' && !identifyRequest.params.layerDefs) {\r\n for (var id in this.options.layerDefs) {\r\n if (Object.prototype.hasOwnProperty.call(this.options.layerDefs, id)) {\r\n identifyRequest.layerDef(id, this.options.layerDefs[id]);\r\n }\r\n }\r\n }\r\n\r\n identifyRequest.run(callback);\r\n\r\n // set the flags to show the popup\r\n this._shouldRenderPopup = true;\r\n this._lastClick = e.latlng;\r\n },\r\n\r\n _buildExportParams: function () {\r\n var sr = parseInt(this._map.options.crs.code.split(':')[1], 10);\r\n\r\n var params = {\r\n bbox: this._calculateBbox(),\r\n size: this._calculateImageSize(),\r\n dpi: 96,\r\n format: this.options.format,\r\n transparent: this.options.transparent,\r\n bboxSR: sr,\r\n imageSR: sr\r\n };\r\n\r\n if (this.options.dynamicLayers) {\r\n params.dynamicLayers = this.options.dynamicLayers;\r\n }\r\n\r\n if (this.options.layers) {\r\n if (this.options.layers.length === 0) {\r\n return;\r\n } else {\r\n params.layers = 'show:' + this.options.layers.join(',');\r\n }\r\n }\r\n\r\n if (this.options.layerDefs) {\r\n params.layerDefs = typeof this.options.layerDefs === 'string' ? this.options.layerDefs : JSON.stringify(this.options.layerDefs);\r\n }\r\n\r\n if (this.options.timeOptions) {\r\n params.timeOptions = JSON.stringify(this.options.timeOptions);\r\n }\r\n\r\n if (this.options.from && this.options.to) {\r\n params.time = this.options.from.valueOf() + ',' + this.options.to.valueOf();\r\n }\r\n\r\n if (this.service.options.token) {\r\n params.token = this.service.options.token;\r\n }\r\n\r\n if (this.options.proxy) {\r\n params.proxy = this.options.proxy;\r\n }\r\n\r\n // use a timestamp to bust server cache\r\n if (this.options.disableCache) {\r\n params._ts = Date.now();\r\n }\r\n\r\n return params;\r\n },\r\n\r\n _requestExport: function (params, bounds) {\r\n if (this.options.f === 'json') {\r\n this.service.request('export', params, function (error, response) {\r\n if (error) { return; } // we really can't do anything here but authenticate or requesterror will fire\r\n\r\n if (this.options.token && response.href) {\r\n response.href += ('?token=' + this.options.token);\r\n }\r\n if (this.options.proxy && response.href) {\r\n response.href = this.options.proxy + '?' + response.href;\r\n }\r\n if (response.href) {\r\n this._renderImage(response.href, bounds);\r\n } else {\r\n this._renderImage(response.imageData, bounds, response.contentType);\r\n }\r\n }, this);\r\n } else {\r\n params.f = 'image';\r\n var fullUrl = this.options.url + 'export' + Util.getParamString(params);\r\n if (this.options.proxy) {\r\n fullUrl = this.options.proxy + '?' + fullUrl;\r\n }\r\n this._renderImage(fullUrl, bounds);\r\n }\r\n }\r\n});\r\n\r\nexport function dynamicMapLayer (url, options) {\r\n return new DynamicMapLayer(url, options);\r\n}\r\n\r\nexport default dynamicMapLayer;\r\n","import {\r\n LatLngBounds,\r\n toLatLngBounds as latLngBounds,\r\n Layer,\r\n Browser,\r\n Util,\r\n Point,\r\n Bounds\r\n} from 'leaflet';\r\n\r\nexport var FeatureGrid = Layer.extend({\r\n // @section\r\n // @aka GridLayer options\r\n options: {\r\n // @option cellSize: Number|Point = 256\r\n // Width and height of cells in the grid. Use a number if width and height are equal, or `L.point(width, height)` otherwise.\r\n cellSize: 512,\r\n\r\n // @option updateWhenIdle: Boolean = (depends)\r\n // Load new cells only when panning ends.\r\n // `true` by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.\r\n // `false` otherwise in order to display new cells _during_ panning, since it is easy to pan outside the\r\n // [`keepBuffer`](#gridlayer-keepbuffer) option in desktop browsers.\r\n updateWhenIdle: Browser.mobile,\r\n\r\n // @option updateInterval: Number = 150\r\n // Cells will not update more than once every `updateInterval` milliseconds when panning.\r\n updateInterval: 150,\r\n\r\n // @option noWrap: Boolean = false\r\n // Whether the layer is wrapped around the antimeridian. If `true`, the\r\n // GridLayer will only be displayed once at low zoom levels. Has no\r\n // effect when the [map CRS](#map-crs) doesn't wrap around. Can be used\r\n // in combination with [`bounds`](#gridlayer-bounds) to prevent requesting\r\n // cells outside the CRS limits.\r\n noWrap: false,\r\n\r\n // @option keepBuffer: Number = 1.5\r\n // When panning the map, keep this many rows and columns of cells before unloading them.\r\n keepBuffer: 1.5\r\n },\r\n\r\n initialize: function (options) {\r\n Util.setOptions(this, options);\r\n },\r\n\r\n onAdd: function (map) {\r\n this._cells = {};\r\n this._activeCells = {};\r\n this._resetView();\r\n this._update();\r\n },\r\n\r\n onRemove: function (map) {\r\n this._removeAllCells();\r\n this._cellZoom = undefined;\r\n },\r\n\r\n // @method isLoading: Boolean\r\n // Returns `true` if any cell in the grid layer has not finished loading.\r\n isLoading: function () {\r\n return this._loading;\r\n },\r\n\r\n // @method redraw: this\r\n // Causes the layer to clear all the cells and request them again.\r\n redraw: function () {\r\n if (this._map) {\r\n this._removeAllCells();\r\n this._update();\r\n }\r\n return this;\r\n },\r\n\r\n getEvents: function () {\r\n var events = {\r\n viewprereset: this._invalidateAll,\r\n viewreset: this._resetView,\r\n zoom: this._resetView,\r\n moveend: this._onMoveEnd\r\n };\r\n\r\n if (!this.options.updateWhenIdle) {\r\n // update cells on move, but not more often than once per given interval\r\n if (!this._onMove) {\r\n this._onMove = Util.throttle(\r\n this._onMoveEnd,\r\n this.options.updateInterval,\r\n this\r\n );\r\n }\r\n\r\n events.move = this._onMove;\r\n }\r\n\r\n return events;\r\n },\r\n\r\n // @section Extension methods\r\n // Layers extending `GridLayer` shall reimplement the following method.\r\n // @method createCell(coords: Object, done?: Function): HTMLElement\r\n // Called only internally, must be overridden by classes extending `GridLayer`.\r\n // Returns the `HTMLElement` corresponding to the given `coords`. If the `done` callback\r\n // is specified, it must be called when the cell has finished loading and drawing.\r\n createCell: function () {\r\n return document.createElement('div');\r\n },\r\n\r\n removeCell: function () {\r\n\r\n },\r\n\r\n reuseCell: function () {\r\n\r\n },\r\n\r\n cellLeave: function () {\r\n\r\n },\r\n\r\n cellEnter: function () {\r\n\r\n },\r\n // @section\r\n // @method getCellSize: Point\r\n // Normalizes the [cellSize option](#gridlayer-cellsize) into a point. Used by the `createCell()` method.\r\n getCellSize: function () {\r\n var s = this.options.cellSize;\r\n return s instanceof Point ? s : new Point(s, s);\r\n },\r\n\r\n _pruneCells: function () {\r\n if (!this._map) {\r\n return;\r\n }\r\n\r\n var key, cell;\r\n\r\n for (key in this._cells) {\r\n cell = this._cells[key];\r\n cell.retain = cell.current;\r\n }\r\n\r\n for (key in this._cells) {\r\n cell = this._cells[key];\r\n if (cell.current && !cell.active) {\r\n var coords = cell.coords;\r\n if (!this._retainParent(coords.x, coords.y, coords.z, coords.z - 5)) {\r\n this._retainChildren(coords.x, coords.y, coords.z, coords.z + 2);\r\n }\r\n }\r\n }\r\n\r\n for (key in this._cells) {\r\n if (!this._cells[key].retain) {\r\n this._removeCell(key);\r\n }\r\n }\r\n },\r\n\r\n _removeAllCells: function () {\r\n for (var key in this._cells) {\r\n this._removeCell(key);\r\n }\r\n },\r\n\r\n _invalidateAll: function () {\r\n this._removeAllCells();\r\n\r\n this._cellZoom = undefined;\r\n },\r\n\r\n _retainParent: function (x, y, z, minZoom) {\r\n var x2 = Math.floor(x / 2);\r\n var y2 = Math.floor(y / 2);\r\n var z2 = z - 1;\r\n var coords2 = new Point(+x2, +y2);\r\n coords2.z = +z2;\r\n\r\n var key = this._cellCoordsToKey(coords2);\r\n var cell = this._cells[key];\r\n\r\n if (cell && cell.active) {\r\n cell.retain = true;\r\n return true;\r\n } else if (cell && cell.loaded) {\r\n cell.retain = true;\r\n }\r\n\r\n if (z2 > minZoom) {\r\n return this._retainParent(x2, y2, z2, minZoom);\r\n }\r\n\r\n return false;\r\n },\r\n\r\n _retainChildren: function (x, y, z, maxZoom) {\r\n for (var i = 2 * x; i < 2 * x + 2; i++) {\r\n for (var j = 2 * y; j < 2 * y + 2; j++) {\r\n var coords = new Point(i, j);\r\n coords.z = z + 1;\r\n\r\n var key = this._cellCoordsToKey(coords);\r\n var cell = this._cells[key];\r\n\r\n if (cell && cell.active) {\r\n cell.retain = true;\r\n continue;\r\n } else if (cell && cell.loaded) {\r\n cell.retain = true;\r\n }\r\n\r\n if (z + 1 < maxZoom) {\r\n this._retainChildren(i, j, z + 1, maxZoom);\r\n }\r\n }\r\n }\r\n },\r\n\r\n _resetView: function (e) {\r\n var animating = e && (e.pinch || e.flyTo);\r\n\r\n if (animating) {\r\n return;\r\n }\r\n\r\n this._setView(\r\n this._map.getCenter(),\r\n this._map.getZoom(),\r\n animating,\r\n animating\r\n );\r\n },\r\n\r\n _setView: function (center, zoom, noPrune, noUpdate) {\r\n var cellZoom = Math.round(zoom);\r\n\r\n if (!noUpdate) {\r\n this._cellZoom = cellZoom;\r\n\r\n if (this._abortLoading) {\r\n this._abortLoading();\r\n }\r\n\r\n this._resetGrid();\r\n\r\n if (cellZoom !== undefined) {\r\n this._update(center);\r\n }\r\n\r\n if (!noPrune) {\r\n this._pruneCells();\r\n }\r\n\r\n // Flag to prevent _updateOpacity from pruning cells during\r\n // a zoom anim or a pinch gesture\r\n this._noPrune = !!noPrune;\r\n }\r\n },\r\n\r\n _resetGrid: function () {\r\n var map = this._map;\r\n var crs = map.options.crs;\r\n var cellSize = (this._cellSize = this.getCellSize());\r\n var cellZoom = this._cellZoom;\r\n\r\n var bounds = this._map.getPixelWorldBounds(this._cellZoom);\r\n if (bounds) {\r\n this._globalCellRange = this._pxBoundsToCellRange(bounds);\r\n }\r\n\r\n this._wrapX = crs.wrapLng &&\r\n !this.options.noWrap && [\r\n Math.floor(map.project([0, crs.wrapLng[0]], cellZoom).x / cellSize.x),\r\n Math.ceil(map.project([0, crs.wrapLng[1]], cellZoom).x / cellSize.y)\r\n ];\r\n this._wrapY = crs.wrapLat &&\r\n !this.options.noWrap && [\r\n Math.floor(map.project([crs.wrapLat[0], 0], cellZoom).y / cellSize.x),\r\n Math.ceil(map.project([crs.wrapLat[1], 0], cellZoom).y / cellSize.y)\r\n ];\r\n },\r\n\r\n _onMoveEnd: function (e) {\r\n var animating = e && (e.pinch || e.flyTo);\r\n\r\n if (animating || !this._map || this._map._animatingZoom) {\r\n return;\r\n }\r\n\r\n this._update();\r\n },\r\n\r\n _getCelldPixelBounds: function (center) {\r\n var map = this._map;\r\n var mapZoom = map._animatingZoom\r\n ? Math.max(map._animateToZoom, map.getZoom())\r\n : map.getZoom();\r\n var scale = map.getZoomScale(mapZoom, this._cellZoom);\r\n var pixelCenter = map.project(center, this._cellZoom).floor();\r\n var halfSize = map.getSize().divideBy(scale * 2);\r\n\r\n return new Bounds(\r\n pixelCenter.subtract(halfSize),\r\n pixelCenter.add(halfSize)\r\n );\r\n },\r\n\r\n // Private method to load cells in the grid's active zoom level according to map bounds\r\n _update: function (center) {\r\n var map = this._map;\r\n if (!map) {\r\n return;\r\n }\r\n var zoom = Math.round(map.getZoom());\r\n\r\n if (center === undefined) {\r\n center = map.getCenter();\r\n }\r\n\r\n var pixelBounds = this._getCelldPixelBounds(center);\r\n var cellRange = this._pxBoundsToCellRange(pixelBounds);\r\n var cellCenter = cellRange.getCenter();\r\n var queue = [];\r\n var margin = this.options.keepBuffer;\r\n var noPruneRange = new Bounds(\r\n cellRange.getBottomLeft().subtract([margin, -margin]),\r\n cellRange.getTopRight().add([margin, -margin])\r\n );\r\n\r\n // Sanity check: panic if the cell range contains Infinity somewhere.\r\n if (\r\n !(\r\n isFinite(cellRange.min.x) &&\r\n isFinite(cellRange.min.y) &&\r\n isFinite(cellRange.max.x) &&\r\n isFinite(cellRange.max.y)\r\n )\r\n ) {\r\n throw new Error('Attempted to load an infinite number of cells');\r\n }\r\n\r\n for (var key in this._cells) {\r\n var c = this._cells[key].coords;\r\n if (\r\n c.z !== this._cellZoom ||\r\n !noPruneRange.contains(new Point(c.x, c.y))\r\n ) {\r\n this._cells[key].current = false;\r\n }\r\n }\r\n\r\n // _update just loads more cells. If the cell zoom level differs too much\r\n // from the map's, let _setView reset levels and prune old cells.\r\n if (Math.abs(zoom - this._cellZoom) > 1) {\r\n this._setView(center, zoom);\r\n return;\r\n }\r\n\r\n // create a queue of coordinates to load cells from\r\n for (var j = cellRange.min.y; j <= cellRange.max.y; j++) {\r\n for (var i = cellRange.min.x; i <= cellRange.max.x; i++) {\r\n var coords = new Point(i, j);\r\n coords.z = this._cellZoom;\r\n\r\n if (!this._isValidCell(coords)) {\r\n continue;\r\n }\r\n\r\n var cell = this._cells[this._cellCoordsToKey(coords)];\r\n if (cell) {\r\n cell.current = true;\r\n } else {\r\n queue.push(coords);\r\n }\r\n }\r\n }\r\n\r\n // sort cell queue to load cells in order of their distance to center\r\n queue.sort(function (a, b) {\r\n return a.distanceTo(cellCenter) - b.distanceTo(cellCenter);\r\n });\r\n\r\n if (queue.length !== 0) {\r\n // if it's the first batch of cells to load\r\n if (!this._loading) {\r\n this._loading = true;\r\n }\r\n\r\n for (i = 0; i < queue.length; i++) {\r\n var _key = this._cellCoordsToKey(queue[i]);\r\n var _coords = this._keyToCellCoords(_key);\r\n if (this._activeCells[_coords]) {\r\n this._reuseCell(queue[i]);\r\n } else {\r\n this._createCell(queue[i]);\r\n }\r\n }\r\n }\r\n },\r\n\r\n _isValidCell: function (coords) {\r\n var crs = this._map.options.crs;\r\n\r\n if (!crs.infinite) {\r\n // don't load cell if it's out of bounds and not wrapped\r\n var bounds = this._globalCellRange;\r\n if (\r\n (!crs.wrapLng &&\r\n (coords.x < bounds.min.x || coords.x > bounds.max.x)) ||\r\n (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y))\r\n ) {\r\n return false;\r\n }\r\n }\r\n\r\n if (!this.options.bounds) {\r\n return true;\r\n }\r\n\r\n // don't load cell if it doesn't intersect the bounds in options\r\n var cellBounds = this._cellCoordsToBounds(coords);\r\n return latLngBounds(this.options.bounds).overlaps(cellBounds);\r\n },\r\n\r\n _keyToBounds: function (key) {\r\n return this._cellCoordsToBounds(this._keyToCellCoords(key));\r\n },\r\n\r\n _cellCoordsToNwSe: function (coords) {\r\n var map = this._map;\r\n var cellSize = this.getCellSize();\r\n var nwPoint = coords.scaleBy(cellSize);\r\n var sePoint = nwPoint.add(cellSize);\r\n var nw = map.unproject(nwPoint, coords.z);\r\n var se = map.unproject(sePoint, coords.z);\r\n\r\n return [nw, se];\r\n },\r\n\r\n // converts cell coordinates to its geographical bounds\r\n _cellCoordsToBounds: function (coords) {\r\n var bp = this._cellCoordsToNwSe(coords);\r\n var bounds = new LatLngBounds(bp[0], bp[1]);\r\n\r\n if (!this.options.noWrap) {\r\n bounds = this._map.wrapLatLngBounds(bounds);\r\n }\r\n return bounds;\r\n },\r\n // converts cell coordinates to key for the cell cache\r\n _cellCoordsToKey: function (coords) {\r\n return coords.x + ':' + coords.y + ':' + coords.z;\r\n },\r\n\r\n // converts cell cache key to coordinates\r\n _keyToCellCoords: function (key) {\r\n var k = key.split(':');\r\n var coords = new Point(+k[0], +k[1]);\r\n\r\n coords.z = +k[2];\r\n return coords;\r\n },\r\n\r\n _removeCell: function (key) {\r\n var cell = this._cells[key];\r\n\r\n if (!cell) {\r\n return;\r\n }\r\n\r\n var coords = this._keyToCellCoords(key);\r\n var wrappedCoords = this._wrapCoords(coords);\r\n var cellBounds = this._cellCoordsToBounds(this._wrapCoords(coords));\r\n\r\n cell.current = false;\r\n\r\n delete this._cells[key];\r\n this._activeCells[key] = cell;\r\n\r\n this.cellLeave(cellBounds, wrappedCoords, key);\r\n\r\n this.fire('cellleave', {\r\n key: key,\r\n coords: wrappedCoords,\r\n bounds: cellBounds\r\n });\r\n },\r\n\r\n _reuseCell: function (coords) {\r\n var key = this._cellCoordsToKey(coords);\r\n\r\n // save cell in cache\r\n this._cells[key] = this._activeCells[key];\r\n this._cells[key].current = true;\r\n\r\n var wrappedCoords = this._wrapCoords(coords);\r\n var cellBounds = this._cellCoordsToBounds(this._wrapCoords(coords));\r\n\r\n this.cellEnter(cellBounds, wrappedCoords, key);\r\n\r\n this.fire('cellenter', {\r\n key: key,\r\n coords: wrappedCoords,\r\n bounds: cellBounds\r\n });\r\n },\r\n\r\n _createCell: function (coords) {\r\n var key = this._cellCoordsToKey(coords);\r\n\r\n var wrappedCoords = this._wrapCoords(coords);\r\n var cellBounds = this._cellCoordsToBounds(this._wrapCoords(coords));\r\n\r\n this.createCell(cellBounds, wrappedCoords, key);\r\n\r\n this.fire('cellcreate', {\r\n key: key,\r\n coords: wrappedCoords,\r\n bounds: cellBounds\r\n });\r\n\r\n // save cell in cache\r\n this._cells[key] = {\r\n coords: coords,\r\n current: true\r\n };\r\n\r\n Util.requestAnimFrame(this._pruneCells, this);\r\n },\r\n\r\n _cellReady: function (coords, err, cell) {\r\n var key = this._cellCoordsToKey(coords);\r\n\r\n cell = this._cells[key];\r\n\r\n if (!cell) {\r\n return;\r\n }\r\n\r\n cell.loaded = +new Date();\r\n\r\n cell.active = true;\r\n },\r\n\r\n _getCellPos: function (coords) {\r\n return coords.scaleBy(this.getCellSize());\r\n },\r\n\r\n _wrapCoords: function (coords) {\r\n var newCoords = new Point(\r\n this._wrapX ? Util.wrapNum(coords.x, this._wrapX) : coords.x,\r\n this._wrapY ? Util.wrapNum(coords.y, this._wrapY) : coords.y\r\n );\r\n newCoords.z = coords.z;\r\n return newCoords;\r\n },\r\n\r\n _pxBoundsToCellRange: function (bounds) {\r\n var cellSize = this.getCellSize();\r\n return new Bounds(\r\n bounds.min.unscaleBy(cellSize).floor(),\r\n bounds.max.unscaleBy(cellSize).ceil().subtract([1, 1])\r\n );\r\n }\r\n});\r\n","function BinarySearchIndex (values) {\n this.values = [].concat(values || []);\n}\n\nBinarySearchIndex.prototype.query = function (value) {\n var index = this.getIndex(value);\n return this.values[index];\n};\n\nBinarySearchIndex.prototype.getIndex = function getIndex (value) {\n if (this.dirty) {\n this.sort();\n }\n\n var minIndex = 0;\n var maxIndex = this.values.length - 1;\n var currentIndex;\n var currentElement;\n\n while (minIndex <= maxIndex) {\n currentIndex = (minIndex + maxIndex) / 2 | 0;\n currentElement = this.values[Math.round(currentIndex)];\n if (+currentElement.value < +value) {\n minIndex = currentIndex + 1;\n } else if (+currentElement.value > +value) {\n maxIndex = currentIndex - 1;\n } else {\n return currentIndex;\n }\n }\n\n return Math.abs(~maxIndex);\n};\n\nBinarySearchIndex.prototype.between = function between (start, end) {\n var startIndex = this.getIndex(start);\n var endIndex = this.getIndex(end);\n\n if (startIndex === 0 && endIndex === 0) {\n return [];\n }\n\n while (this.values[startIndex - 1] && this.values[startIndex - 1].value === start) {\n startIndex--;\n }\n\n while (this.values[endIndex + 1] && this.values[endIndex + 1].value === end) {\n endIndex++;\n }\n\n if (this.values[endIndex] && this.values[endIndex].value === end && this.values[endIndex + 1]) {\n endIndex++;\n }\n\n return this.values.slice(startIndex, endIndex);\n};\n\nBinarySearchIndex.prototype.insert = function insert (item) {\n this.values.splice(this.getIndex(item.value), 0, item);\n return this;\n};\n\nBinarySearchIndex.prototype.bulkAdd = function bulkAdd (items, sort) {\n this.values = this.values.concat([].concat(items || []));\n\n if (sort) {\n this.sort();\n } else {\n this.dirty = true;\n }\n\n return this;\n};\n\nBinarySearchIndex.prototype.sort = function sort () {\n this.values.sort(function (a, b) {\n return +b.value - +a.value;\n }).reverse();\n this.dirty = false;\n return this;\n};\n\nexport default BinarySearchIndex;\n","import { Util } from 'leaflet';\r\nimport featureLayerService from '../../Services/FeatureLayerService';\r\nimport {\r\n getUrlParams,\r\n warn,\r\n setEsriAttribution,\r\n removeEsriAttribution\r\n} from '../../Util';\r\nimport { FeatureGrid } from './FeatureGrid';\r\nimport BinarySearchIndex from 'tiny-binary-search';\r\n\r\nexport var FeatureManager = FeatureGrid.extend({\r\n /**\r\n * Options\r\n */\r\n\r\n options: {\r\n attribution: null,\r\n where: '1=1',\r\n fields: ['*'],\r\n from: false,\r\n to: false,\r\n timeField: false,\r\n timeFilterMode: 'server',\r\n simplifyFactor: 0,\r\n precision: 6,\r\n fetchAllFeatures: false\r\n },\r\n\r\n /**\r\n * Constructor\r\n */\r\n\r\n initialize: function (options) {\r\n FeatureGrid.prototype.initialize.call(this, options);\r\n\r\n options = getUrlParams(options);\r\n options = Util.setOptions(this, options);\r\n\r\n this.service = featureLayerService(options);\r\n this.service.addEventParent(this);\r\n\r\n // use case insensitive regex to look for common fieldnames used for indexing\r\n if (this.options.fields[0] !== '*') {\r\n var oidCheck = false;\r\n for (var i = 0; i < this.options.fields.length; i++) {\r\n if (this.options.fields[i].match(/^(OBJECTID|FID|OID|ID)$/i)) {\r\n oidCheck = true;\r\n }\r\n }\r\n if (oidCheck === false) {\r\n warn(\r\n 'no known esriFieldTypeOID field detected in fields Array. Please add an attribute field containing unique IDs to ensure the layer can be drawn correctly.'\r\n );\r\n }\r\n }\r\n\r\n if (this.options.timeField.start && this.options.timeField.end) {\r\n this._startTimeIndex = new BinarySearchIndex();\r\n this._endTimeIndex = new BinarySearchIndex();\r\n } else if (this.options.timeField) {\r\n this._timeIndex = new BinarySearchIndex();\r\n }\r\n\r\n this._cache = {};\r\n this._currentSnapshot = []; // cache of what layers should be active\r\n this._activeRequests = 0;\r\n },\r\n\r\n /**\r\n * Layer Interface\r\n */\r\n\r\n onAdd: function (map) {\r\n // include 'Powered by Esri' in map attribution\r\n setEsriAttribution(map);\r\n\r\n this.service.metadata(function (err, metadata) {\r\n if (!err) {\r\n var supportedFormats = metadata.supportedQueryFormats;\r\n\r\n // Check if someone has requested that we don't use geoJSON, even if it's available\r\n var forceJsonFormat = false;\r\n if (\r\n this.service.options.isModern === false ||\r\n this.options.fetchAllFeatures\r\n ) {\r\n forceJsonFormat = true;\r\n }\r\n\r\n // Unless we've been told otherwise, check to see whether service can emit GeoJSON natively\r\n if (\r\n !forceJsonFormat &&\r\n supportedFormats &&\r\n supportedFormats.indexOf('geoJSON') !== -1\r\n ) {\r\n this.service.options.isModern = true;\r\n }\r\n\r\n if (metadata.objectIdField) {\r\n this.service.options.idAttribute = metadata.objectIdField;\r\n }\r\n\r\n // add copyright text listed in service metadata\r\n if (\r\n !this.options.attribution &&\r\n map.attributionControl &&\r\n metadata.copyrightText\r\n ) {\r\n this.options.attribution = metadata.copyrightText;\r\n map.attributionControl.addAttribution(this.getAttribution());\r\n }\r\n }\r\n }, this);\r\n\r\n map.on('zoomend', this._handleZoomChange, this);\r\n\r\n return FeatureGrid.prototype.onAdd.call(this, map);\r\n },\r\n\r\n onRemove: function (map) {\r\n removeEsriAttribution(map);\r\n map.off('zoomend', this._handleZoomChange, this);\r\n\r\n return FeatureGrid.prototype.onRemove.call(this, map);\r\n },\r\n\r\n getAttribution: function () {\r\n return this.options.attribution;\r\n },\r\n\r\n /**\r\n * Feature Management\r\n */\r\n\r\n createCell: function (bounds, coords) {\r\n // dont fetch features outside the scale range defined for the layer\r\n if (this._visibleZoom()) {\r\n this._requestFeatures(bounds, coords);\r\n }\r\n },\r\n\r\n _requestFeatures: function (bounds, coords, callback, offset) {\r\n this._activeRequests++;\r\n\r\n // default param\r\n offset = offset || 0;\r\n\r\n var originalWhere = this.options.where;\r\n\r\n // our first active request fires loading\r\n if (this._activeRequests === 1) {\r\n this.fire(\r\n 'loading',\r\n {\r\n bounds: bounds\r\n },\r\n true\r\n );\r\n }\r\n\r\n return this._buildQuery(bounds, offset).run(function (\r\n error,\r\n featureCollection,\r\n response\r\n ) {\r\n if (response && response.exceededTransferLimit) {\r\n this.fire('drawlimitexceeded');\r\n }\r\n\r\n // the where changed while this request was being run so don't it.\r\n if (this.options.where !== originalWhere) {\r\n return;\r\n }\r\n\r\n // no error, features\r\n if (!error && featureCollection && featureCollection.features.length) {\r\n // schedule adding features until the next animation frame\r\n Util.requestAnimFrame(\r\n Util.bind(function () {\r\n this._addFeatures(featureCollection.features, coords);\r\n this._postProcessFeatures(bounds);\r\n }, this)\r\n );\r\n }\r\n\r\n // no error, no features\r\n if (!error && featureCollection && !featureCollection.features.length) {\r\n this._postProcessFeatures(bounds);\r\n }\r\n\r\n if (error) {\r\n this._postProcessFeatures(bounds);\r\n }\r\n\r\n if (callback) {\r\n callback.call(this, error, featureCollection);\r\n }\r\n if (\r\n response &&\r\n (response.exceededTransferLimit ||\r\n (response.properties && response.properties.exceededTransferLimit)) &&\r\n this.options.fetchAllFeatures\r\n ) {\r\n this._requestFeatures(\r\n bounds,\r\n coords,\r\n callback,\r\n offset + featureCollection.features.length\r\n );\r\n }\r\n },\r\n this);\r\n },\r\n\r\n _postProcessFeatures: function (bounds) {\r\n // deincrement the request counter now that we have processed features\r\n this._activeRequests--;\r\n\r\n // if there are no more active requests fire a load event for this view\r\n if (this._activeRequests <= 0) {\r\n this.fire('load', {\r\n bounds: bounds\r\n });\r\n }\r\n },\r\n\r\n _cacheKey: function (coords) {\r\n return coords.z + ':' + coords.x + ':' + coords.y;\r\n },\r\n\r\n _addFeatures: function (features, coords) {\r\n // coords is optional - will be false if coming from addFeatures() function\r\n if (coords) {\r\n var key = this._cacheKey(coords);\r\n this._cache[key] = this._cache[key] || [];\r\n }\r\n\r\n for (var i = features.length - 1; i >= 0; i--) {\r\n var id = features[i].id;\r\n\r\n if (this._currentSnapshot.indexOf(id) === -1) {\r\n this._currentSnapshot.push(id);\r\n }\r\n if (typeof key !== 'undefined' && this._cache[key].indexOf(id) === -1) {\r\n this._cache[key].push(id);\r\n }\r\n }\r\n\r\n if (this.options.timeField) {\r\n this._buildTimeIndexes(features);\r\n }\r\n\r\n this.createLayers(features);\r\n },\r\n\r\n _buildQuery: function (bounds, offset) {\r\n var query = this.service\r\n .query()\r\n .intersects(bounds)\r\n .where(this.options.where)\r\n .fields(this.options.fields)\r\n .precision(this.options.precision);\r\n\r\n if (this.options.fetchAllFeatures && !isNaN(parseInt(offset))) {\r\n query = query.offset(offset);\r\n }\r\n\r\n query.params['resultType'] = 'tile';\r\n\r\n if (this.options.requestParams) {\r\n Util.extend(query.params, this.options.requestParams);\r\n }\r\n\r\n if (this.options.simplifyFactor) {\r\n query.simplify(this._map, this.options.simplifyFactor);\r\n }\r\n\r\n if (\r\n this.options.timeFilterMode === 'server' &&\r\n this.options.from &&\r\n this.options.to\r\n ) {\r\n query.between(this.options.from, this.options.to);\r\n }\r\n\r\n return query;\r\n },\r\n\r\n /**\r\n * Where Methods\r\n */\r\n\r\n setWhere: function (where, callback, context) {\r\n this.options.where = where && where.length ? where : '1=1';\r\n\r\n var oldSnapshot = [];\r\n var newSnapshot = [];\r\n var pendingRequests = 0;\r\n var requestError = null;\r\n var requestCallback = Util.bind(function (error, featureCollection) {\r\n if (error) {\r\n requestError = error;\r\n }\r\n\r\n if (featureCollection) {\r\n for (var i = featureCollection.features.length - 1; i >= 0; i--) {\r\n newSnapshot.push(featureCollection.features[i].id);\r\n }\r\n }\r\n\r\n pendingRequests--;\r\n\r\n if (\r\n pendingRequests <= 0 &&\r\n this._visibleZoom() &&\r\n where === this.options.where // the where is still the same so use this one\r\n ) {\r\n this._currentSnapshot = newSnapshot;\r\n // schedule adding features for the next animation frame\r\n Util.requestAnimFrame(\r\n Util.bind(function () {\r\n this.removeLayers(oldSnapshot);\r\n this.addLayers(newSnapshot);\r\n if (callback) {\r\n callback.call(context, requestError);\r\n }\r\n }, this)\r\n );\r\n }\r\n }, this);\r\n\r\n for (var i = this._currentSnapshot.length - 1; i >= 0; i--) {\r\n oldSnapshot.push(this._currentSnapshot[i]);\r\n }\r\n\r\n this._cache = {};\r\n\r\n for (var key in this._cells) {\r\n pendingRequests++;\r\n var coords = this._keyToCellCoords(key);\r\n var bounds = this._cellCoordsToBounds(coords);\r\n this._requestFeatures(bounds, coords, requestCallback);\r\n }\r\n\r\n return this;\r\n },\r\n\r\n getWhere: function () {\r\n return this.options.where;\r\n },\r\n\r\n /**\r\n * Time Range Methods\r\n */\r\n\r\n getTimeRange: function () {\r\n return [this.options.from, this.options.to];\r\n },\r\n\r\n setTimeRange: function (from, to, callback, context) {\r\n var oldFrom = this.options.from;\r\n var oldTo = this.options.to;\r\n var pendingRequests = 0;\r\n var requestError = null;\r\n var requestCallback = Util.bind(function (error) {\r\n if (error) {\r\n requestError = error;\r\n }\r\n this._filterExistingFeatures(oldFrom, oldTo, from, to);\r\n\r\n pendingRequests--;\r\n\r\n if (callback && pendingRequests <= 0) {\r\n callback.call(context, requestError);\r\n }\r\n }, this);\r\n\r\n this.options.from = from;\r\n this.options.to = to;\r\n\r\n this._filterExistingFeatures(oldFrom, oldTo, from, to);\r\n\r\n if (this.options.timeFilterMode === 'server') {\r\n for (var key in this._cells) {\r\n pendingRequests++;\r\n var coords = this._keyToCellCoords(key);\r\n var bounds = this._cellCoordsToBounds(coords);\r\n this._requestFeatures(bounds, coords, requestCallback);\r\n }\r\n }\r\n\r\n return this;\r\n },\r\n\r\n refresh: function () {\r\n this.setWhere(this.options.where);\r\n },\r\n\r\n _filterExistingFeatures: function (oldFrom, oldTo, newFrom, newTo) {\r\n var layersToRemove =\r\n oldFrom && oldTo\r\n ? this._getFeaturesInTimeRange(oldFrom, oldTo)\r\n : this._currentSnapshot;\r\n var layersToAdd = this._getFeaturesInTimeRange(newFrom, newTo);\r\n\r\n if (layersToAdd.indexOf) {\r\n for (var i = 0; i < layersToAdd.length; i++) {\r\n var shouldRemoveLayer = layersToRemove.indexOf(layersToAdd[i]);\r\n if (shouldRemoveLayer >= 0) {\r\n layersToRemove.splice(shouldRemoveLayer, 1);\r\n }\r\n }\r\n }\r\n\r\n // schedule adding features until the next animation frame\r\n Util.requestAnimFrame(\r\n Util.bind(function () {\r\n this.removeLayers(layersToRemove);\r\n this.addLayers(layersToAdd);\r\n }, this)\r\n );\r\n },\r\n\r\n _getFeaturesInTimeRange: function (start, end) {\r\n var ids = [];\r\n var search;\r\n\r\n if (this.options.timeField.start && this.options.timeField.end) {\r\n var startTimes = this._startTimeIndex.between(start, end);\r\n var endTimes = this._endTimeIndex.between(start, end);\r\n search = startTimes.concat(endTimes);\r\n } else if (this._timeIndex) {\r\n search = this._timeIndex.between(start, end);\r\n } else {\r\n warn(\r\n 'You must set timeField in the layer constructor in order to manipulate the start and end time filter.'\r\n );\r\n return [];\r\n }\r\n\r\n for (var i = search.length - 1; i >= 0; i--) {\r\n ids.push(search[i].id);\r\n }\r\n\r\n return ids;\r\n },\r\n\r\n _buildTimeIndexes: function (geojson) {\r\n var i;\r\n var feature;\r\n if (this.options.timeField.start && this.options.timeField.end) {\r\n var startTimeEntries = [];\r\n var endTimeEntries = [];\r\n for (i = geojson.length - 1; i >= 0; i--) {\r\n feature = geojson[i];\r\n startTimeEntries.push({\r\n id: feature.id,\r\n value: new Date(feature.properties[this.options.timeField.start])\r\n });\r\n endTimeEntries.push({\r\n id: feature.id,\r\n value: new Date(feature.properties[this.options.timeField.end])\r\n });\r\n }\r\n this._startTimeIndex.bulkAdd(startTimeEntries);\r\n this._endTimeIndex.bulkAdd(endTimeEntries);\r\n } else {\r\n var timeEntries = [];\r\n for (i = geojson.length - 1; i >= 0; i--) {\r\n feature = geojson[i];\r\n timeEntries.push({\r\n id: feature.id,\r\n value: new Date(feature.properties[this.options.timeField])\r\n });\r\n }\r\n\r\n this._timeIndex.bulkAdd(timeEntries);\r\n }\r\n },\r\n\r\n _featureWithinTimeRange: function (feature) {\r\n if (!this.options.from || !this.options.to) {\r\n return true;\r\n }\r\n\r\n var from = +this.options.from.valueOf();\r\n var to = +this.options.to.valueOf();\r\n\r\n if (typeof this.options.timeField === 'string') {\r\n var date = +feature.properties[this.options.timeField];\r\n return date >= from && date <= to;\r\n }\r\n\r\n if (this.options.timeField.start && this.options.timeField.end) {\r\n var startDate = +feature.properties[this.options.timeField.start];\r\n var endDate = +feature.properties[this.options.timeField.end];\r\n return (\r\n (startDate >= from && startDate <= to) ||\r\n (endDate >= from && endDate <= to) ||\r\n (startDate <= from && endDate >= to)\r\n );\r\n }\r\n },\r\n\r\n _visibleZoom: function () {\r\n // check to see whether the current zoom level of the map is within the optional limit defined for the FeatureLayer\r\n if (!this._map) {\r\n return false;\r\n }\r\n var zoom = this._map.getZoom();\r\n if (zoom > this.options.maxZoom || zoom < this.options.minZoom) {\r\n return false;\r\n } else {\r\n return true;\r\n }\r\n },\r\n\r\n _handleZoomChange: function () {\r\n if (!this._visibleZoom()) {\r\n // if we have moved outside the visible zoom range clear the current snapshot, no layers should be active\r\n this.removeLayers(this._currentSnapshot);\r\n this._currentSnapshot = [];\r\n } else {\r\n /*\r\n for every cell in this._cells\r\n 1. Get the cache key for the coords of the cell\r\n 2. If this._cache[key] exists it will be an array of feature IDs.\r\n 3. Call this.addLayers(this._cache[key]) to instruct the feature layer to add the layers back.\r\n */\r\n for (var i in this._cells) {\r\n var coords = this._cells[i].coords;\r\n var key = this._cacheKey(coords);\r\n if (this._cache[key]) {\r\n this.addLayers(this._cache[key]);\r\n }\r\n }\r\n }\r\n },\r\n\r\n /**\r\n * Service Methods\r\n */\r\n\r\n authenticate: function (token) {\r\n this.service.authenticate(token);\r\n return this;\r\n },\r\n\r\n metadata: function (callback, context) {\r\n this.service.metadata(callback, context);\r\n return this;\r\n },\r\n\r\n query: function () {\r\n return this.service.query();\r\n },\r\n\r\n _getMetadata: function (callback) {\r\n if (this._metadata) {\r\n var error;\r\n callback(error, this._metadata);\r\n } else {\r\n this.metadata(\r\n Util.bind(function (error, response) {\r\n this._metadata = response;\r\n callback(error, this._metadata);\r\n }, this)\r\n );\r\n }\r\n },\r\n\r\n addFeature: function (feature, callback, context) {\r\n this.addFeatures(feature, callback, context);\r\n },\r\n\r\n addFeatures: function (features, callback, context) {\r\n this._getMetadata(\r\n Util.bind(function (error, metadata) {\r\n if (error) {\r\n if (callback) {\r\n callback.call(this, error, null);\r\n }\r\n return;\r\n }\r\n // GeoJSON featureCollection or simple feature\r\n var featuresArray = features.features ? features.features : [features];\r\n\r\n this.service.addFeatures(\r\n features,\r\n Util.bind(function (error, response) {\r\n if (!error) {\r\n for (var i = featuresArray.length - 1; i >= 0; i--) {\r\n // assign ID from result to appropriate objectid field from service metadata\r\n featuresArray[i].properties[metadata.objectIdField] =\r\n featuresArray.length > 1\r\n ? response[i].objectId\r\n : response.objectId;\r\n // we also need to update the geojson id for createLayers() to function\r\n featuresArray[i].id =\r\n featuresArray.length > 1\r\n ? response[i].objectId\r\n : response.objectId;\r\n }\r\n this._addFeatures(featuresArray);\r\n }\r\n\r\n if (callback) {\r\n callback.call(context, error, response);\r\n }\r\n }, this)\r\n );\r\n }, this)\r\n );\r\n },\r\n\r\n updateFeature: function (feature, callback, context) {\r\n this.updateFeatures(feature, callback, context);\r\n },\r\n\r\n updateFeatures: function (features, callback, context) {\r\n // GeoJSON featureCollection or simple feature\r\n var featuresArray = features.features ? features.features : [features];\r\n this.service.updateFeatures(\r\n features,\r\n function (error, response) {\r\n if (!error) {\r\n for (var i = featuresArray.length - 1; i >= 0; i--) {\r\n this.removeLayers([featuresArray[i].id], true);\r\n }\r\n this._addFeatures(featuresArray);\r\n }\r\n\r\n if (callback) {\r\n callback.call(context, error, response);\r\n }\r\n },\r\n this\r\n );\r\n },\r\n\r\n deleteFeature: function (id, callback, context) {\r\n this.deleteFeatures(id, callback, context);\r\n },\r\n\r\n deleteFeatures: function (ids, callback, context) {\r\n return this.service.deleteFeatures(\r\n ids,\r\n function (error, response) {\r\n var responseArray = response.length ? response : [response];\r\n if (!error && responseArray.length > 0) {\r\n for (var i = responseArray.length - 1; i >= 0; i--) {\r\n this.removeLayers([responseArray[i].objectId], true);\r\n }\r\n }\r\n if (callback) {\r\n callback.call(context, error, response);\r\n }\r\n },\r\n this\r\n );\r\n }\r\n});\r\n","import { Path, Util, GeoJSON, latLng } from 'leaflet';\r\nimport { FeatureManager } from './FeatureManager';\r\nimport { warn } from '../../Util';\r\n\r\nexport var FeatureLayer = FeatureManager.extend({\r\n options: {\r\n cacheLayers: true\r\n },\r\n\r\n /**\r\n * Constructor\r\n */\r\n initialize: function (options) {\r\n if (options.apikey) {\r\n options.token = options.apikey;\r\n }\r\n FeatureManager.prototype.initialize.call(this, options);\r\n this._originalStyle = this.options.style;\r\n this._layers = {};\r\n },\r\n\r\n /**\r\n * Layer Interface\r\n */\r\n\r\n onRemove: function (map) {\r\n for (var i in this._layers) {\r\n map.removeLayer(this._layers[i]);\r\n // trigger the event when the entire featureLayer is removed from the map\r\n this.fire(\r\n 'removefeature',\r\n {\r\n feature: this._layers[i].feature,\r\n permanent: false\r\n },\r\n true\r\n );\r\n }\r\n\r\n return FeatureManager.prototype.onRemove.call(this, map);\r\n },\r\n\r\n createNewLayer: function (geojson) {\r\n var layer = GeoJSON.geometryToLayer(geojson, this.options);\r\n // trap for GeoJSON without geometry\r\n if (layer) {\r\n layer.defaultOptions = layer.options;\r\n }\r\n return layer;\r\n },\r\n\r\n _updateLayer: function (layer, geojson) {\r\n // convert the geojson coordinates into a Leaflet LatLng array/nested arrays\r\n // pass it to setLatLngs to update layer geometries\r\n var latlngs = [];\r\n var coordsToLatLng = this.options.coordsToLatLng || GeoJSON.coordsToLatLng;\r\n\r\n // copy new attributes, if present\r\n if (geojson.properties) {\r\n layer.feature.properties = geojson.properties;\r\n }\r\n\r\n switch (geojson.geometry.type) {\r\n case 'Point':\r\n latlngs = GeoJSON.coordsToLatLng(geojson.geometry.coordinates);\r\n layer.setLatLng(latlngs);\r\n break;\r\n case 'LineString':\r\n latlngs = GeoJSON.coordsToLatLngs(\r\n geojson.geometry.coordinates,\r\n 0,\r\n coordsToLatLng\r\n );\r\n layer.setLatLngs(latlngs);\r\n break;\r\n case 'MultiLineString':\r\n latlngs = GeoJSON.coordsToLatLngs(\r\n geojson.geometry.coordinates,\r\n 1,\r\n coordsToLatLng\r\n );\r\n layer.setLatLngs(latlngs);\r\n break;\r\n case 'Polygon':\r\n latlngs = GeoJSON.coordsToLatLngs(\r\n geojson.geometry.coordinates,\r\n 1,\r\n coordsToLatLng\r\n );\r\n layer.setLatLngs(latlngs);\r\n break;\r\n case 'MultiPolygon':\r\n latlngs = GeoJSON.coordsToLatLngs(\r\n geojson.geometry.coordinates,\r\n 2,\r\n coordsToLatLng\r\n );\r\n layer.setLatLngs(latlngs);\r\n break;\r\n }\r\n\r\n // update symbol/style\r\n this.redraw(layer.feature.id);\r\n },\r\n\r\n /**\r\n * Feature Management Methods\r\n */\r\n\r\n createLayers: function (features) {\r\n for (var i = features.length - 1; i >= 0; i--) {\r\n var geojson = features[i];\r\n\r\n var layer = this._layers[geojson.id];\r\n var newLayer;\r\n\r\n if (\r\n this._visibleZoom() &&\r\n layer &&\r\n !this._map.hasLayer(layer) &&\r\n (!this.options.timeField || this._featureWithinTimeRange(geojson))\r\n ) {\r\n this._map.addLayer(layer);\r\n this.fire(\r\n 'addfeature',\r\n {\r\n feature: layer.feature\r\n },\r\n true\r\n );\r\n }\r\n\r\n // update geometry if the layer already existed.\r\n if (layer && (layer.setLatLngs || layer.setLatLng)) {\r\n this._updateLayer(layer, geojson);\r\n }\r\n\r\n if (!layer) {\r\n newLayer = this.createNewLayer(geojson);\r\n\r\n if (!newLayer) {\r\n warn('invalid GeoJSON encountered');\r\n } else {\r\n newLayer.feature = geojson;\r\n\r\n // bubble events from individual layers to the feature layer\r\n newLayer.addEventParent(this);\r\n\r\n if (this.options.onEachFeature) {\r\n this.options.onEachFeature(newLayer.feature, newLayer);\r\n }\r\n\r\n // cache the layer\r\n this._layers[newLayer.feature.id] = newLayer;\r\n\r\n // style the layer\r\n this.setFeatureStyle(newLayer.feature.id, this.options.style);\r\n\r\n this.fire(\r\n 'createfeature',\r\n {\r\n feature: newLayer.feature\r\n },\r\n true\r\n );\r\n\r\n // add the layer if the current zoom level is inside the range defined for the layer, it is within the current time bounds or our layer is not time enabled\r\n if (\r\n this._visibleZoom() &&\r\n (!this.options.timeField ||\r\n (this.options.timeField && this._featureWithinTimeRange(geojson)))\r\n ) {\r\n this._map.addLayer(newLayer);\r\n }\r\n }\r\n }\r\n }\r\n },\r\n\r\n addLayers: function (ids) {\r\n for (var i = ids.length - 1; i >= 0; i--) {\r\n var layer = this._layers[ids[i]];\r\n if (\r\n layer &&\r\n (!this.options.timeField || this._featureWithinTimeRange(layer.feature))\r\n ) {\r\n this._map.addLayer(layer);\r\n this.fire(\r\n 'addfeature',\r\n {\r\n feature: layer.feature\r\n },\r\n true\r\n );\r\n }\r\n }\r\n },\r\n\r\n removeLayers: function (ids, permanent) {\r\n for (var i = ids.length - 1; i >= 0; i--) {\r\n var id = ids[i];\r\n var layer = this._layers[id];\r\n if (layer) {\r\n this.fire(\r\n 'removefeature',\r\n {\r\n feature: layer.feature,\r\n permanent: permanent\r\n },\r\n true\r\n );\r\n this._map.removeLayer(layer);\r\n }\r\n if (layer && permanent) {\r\n delete this._layers[id];\r\n }\r\n }\r\n },\r\n\r\n cellEnter: function (bounds, coords) {\r\n if (this._visibleZoom() && !this._zooming && this._map) {\r\n Util.requestAnimFrame(\r\n Util.bind(function () {\r\n var cacheKey = this._cacheKey(coords);\r\n var cellKey = this._cellCoordsToKey(coords);\r\n var layers = this._cache[cacheKey];\r\n if (this._activeCells[cellKey] && layers) {\r\n this.addLayers(layers);\r\n }\r\n }, this)\r\n );\r\n }\r\n },\r\n\r\n cellLeave: function (bounds, coords) {\r\n if (!this._zooming) {\r\n Util.requestAnimFrame(\r\n Util.bind(function () {\r\n if (this._map) {\r\n var cacheKey = this._cacheKey(coords);\r\n var cellKey = this._cellCoordsToKey(coords);\r\n var layers = this._cache[cacheKey];\r\n var mapBounds = this._map.getBounds();\r\n if (!this._activeCells[cellKey] && layers) {\r\n var removable = true;\r\n\r\n for (var i = 0; i < layers.length; i++) {\r\n var layer = this._layers[layers[i]];\r\n if (\r\n layer &&\r\n layer.getBounds &&\r\n mapBounds.intersects(layer.getBounds())\r\n ) {\r\n removable = false;\r\n }\r\n }\r\n\r\n if (removable) {\r\n this.removeLayers(layers, !this.options.cacheLayers);\r\n }\r\n\r\n if (!this.options.cacheLayers && removable) {\r\n delete this._cache[cacheKey];\r\n delete this._cells[cellKey];\r\n delete this._activeCells[cellKey];\r\n }\r\n }\r\n }\r\n }, this)\r\n );\r\n }\r\n },\r\n\r\n /**\r\n * Styling Methods\r\n */\r\n\r\n resetStyle: function () {\r\n this.options.style = this._originalStyle;\r\n this.eachFeature(function (layer) {\r\n this.resetFeatureStyle(layer.feature.id);\r\n }, this);\r\n return this;\r\n },\r\n\r\n setStyle: function (style) {\r\n this.options.style = style;\r\n this.eachFeature(function (layer) {\r\n this.setFeatureStyle(layer.feature.id, style);\r\n }, this);\r\n return this;\r\n },\r\n\r\n resetFeatureStyle: function (id) {\r\n var layer = this._layers[id];\r\n var style = this._originalStyle || Path.prototype.options;\r\n if (layer) {\r\n Util.extend(layer.options, layer.defaultOptions);\r\n this.setFeatureStyle(id, style);\r\n }\r\n return this;\r\n },\r\n\r\n setFeatureStyle: function (id, style) {\r\n var layer = this._layers[id];\r\n if (typeof style === 'function') {\r\n style = style(layer.feature);\r\n }\r\n if (layer.setStyle) {\r\n layer.setStyle(style);\r\n }\r\n return this;\r\n },\r\n\r\n /**\r\n * Utility Methods\r\n */\r\n\r\n eachActiveFeature: function (fn, context) {\r\n // figure out (roughly) which layers are in view\r\n if (this._map) {\r\n var activeBounds = this._map.getBounds();\r\n for (var i in this._layers) {\r\n if (this._currentSnapshot.indexOf(this._layers[i].feature.id) !== -1) {\r\n // a simple point in poly test for point geometries\r\n if (\r\n typeof this._layers[i].getLatLng === 'function' &&\r\n activeBounds.contains(this._layers[i].getLatLng())\r\n ) {\r\n fn.call(context, this._layers[i]);\r\n } else if (\r\n typeof this._layers[i].getBounds === 'function' &&\r\n activeBounds.intersects(this._layers[i].getBounds())\r\n ) {\r\n // intersecting bounds check for polyline and polygon geometries\r\n fn.call(context, this._layers[i]);\r\n }\r\n }\r\n }\r\n }\r\n return this;\r\n },\r\n\r\n eachFeature: function (fn, context) {\r\n for (var i in this._layers) {\r\n fn.call(context, this._layers[i]);\r\n }\r\n return this;\r\n },\r\n\r\n getFeature: function (id) {\r\n return this._layers[id];\r\n },\r\n\r\n bringToBack: function () {\r\n this.eachFeature(function (layer) {\r\n if (layer.bringToBack) {\r\n layer.bringToBack();\r\n }\r\n });\r\n },\r\n\r\n bringToFront: function () {\r\n this.eachFeature(function (layer) {\r\n if (layer.bringToFront) {\r\n layer.bringToFront();\r\n }\r\n });\r\n },\r\n\r\n redraw: function (id) {\r\n if (id) {\r\n this._redraw(id);\r\n }\r\n return this;\r\n },\r\n\r\n _redraw: function (id) {\r\n var layer = this._layers[id];\r\n var geojson = layer.feature;\r\n\r\n // if this looks like a marker\r\n if (layer && layer.setIcon && this.options.pointToLayer) {\r\n // update custom symbology, if necessary\r\n if (this.options.pointToLayer) {\r\n var getIcon = this.options.pointToLayer(\r\n geojson,\r\n latLng(\r\n geojson.geometry.coordinates[1],\r\n geojson.geometry.coordinates[0]\r\n )\r\n );\r\n var updatedIcon = getIcon.options.icon;\r\n layer.setIcon(updatedIcon);\r\n }\r\n }\r\n\r\n // looks like a vector marker (circleMarker)\r\n if (layer && layer.setStyle && this.options.pointToLayer) {\r\n var getStyle = this.options.pointToLayer(\r\n geojson,\r\n latLng(geojson.geometry.coordinates[1], geojson.geometry.coordinates[0])\r\n );\r\n var updatedStyle = getStyle.options;\r\n this.setFeatureStyle(geojson.id, updatedStyle);\r\n }\r\n\r\n // looks like a path (polygon/polyline)\r\n if (layer && layer.setStyle && this.options.style) {\r\n this.resetFeatureStyle(geojson.id);\r\n }\r\n },\r\n\r\n // This is the same as the Layer.openPopup method except it excludes the `FeatureGroup`\r\n // logic to work around https://github.com/Leaflet/Leaflet/issues/8761\r\n openPopup (latlng) {\r\n if (this._popup) {\r\n if (this._popup._prepareOpen(latlng || this._latlng)) {\r\n // open the popup on the map\r\n this._popup.openOn(this._map);\r\n }\r\n }\r\n return this;\r\n },\r\n\r\n // This is the same as the `Layer.openTooltip` method except it excludes the `FeatureGroup`\r\n // logic to work around https://github.com/Leaflet/Leaflet/issues/8761\r\n openTooltip (latlng) {\r\n if (this._tooltip) {\r\n if (this._tooltip._prepareOpen(latlng)) {\r\n // open the tooltip on the map\r\n this._tooltip.openOn(this._map);\r\n\r\n if (this.getElement) {\r\n this._setAriaDescribedByOnLayer(this);\r\n } else if (this.eachLayer) {\r\n this.eachLayer(this._setAriaDescribedByOnLayer, this);\r\n }\r\n }\r\n }\r\n return this;\r\n }\r\n});\r\n\r\nexport function featureLayer (options) {\r\n return new FeatureLayer(options);\r\n}\r\n\r\nexport default featureLayer;\r\n","// export version\r\nimport packageInfo from '../package.json';\r\nvar version = packageInfo.version;\r\nexport { version as VERSION };\r\n\r\n// import base\r\nexport { Support } from './Support';\r\nexport { options } from './Options';\r\nexport { EsriUtil as Util } from './Util';\r\nexport { get, post, request } from './Request';\r\n\r\n// export tasks\r\nexport { Task, task } from './Tasks/Task';\r\nexport { Query, query } from './Tasks/Query';\r\nexport { Find, find } from './Tasks/Find';\r\nexport { Identify, identify } from './Tasks/Identify';\r\nexport { IdentifyFeatures, identifyFeatures } from './Tasks/IdentifyFeatures';\r\nexport { IdentifyImage, identifyImage } from './Tasks/IdentifyImage';\r\n\r\n// export services\r\nexport { Service, service } from './Services/Service';\r\nexport { MapService, mapService } from './Services/MapService';\r\nexport { ImageService, imageService } from './Services/ImageService';\r\nexport { FeatureLayerService, featureLayerService } from './Services/FeatureLayerService';\r\n\r\n// export layers\r\nexport { BasemapLayer, basemapLayer } from './Layers/BasemapLayer';\r\nexport { TiledMapLayer, tiledMapLayer } from './Layers/TiledMapLayer';\r\nexport { RasterLayer } from './Layers/RasterLayer';\r\nexport { ImageMapLayer, imageMapLayer } from './Layers/ImageMapLayer';\r\nexport { DynamicMapLayer, dynamicMapLayer } from './Layers/DynamicMapLayer';\r\nexport { FeatureManager } from './Layers/FeatureLayer/FeatureManager';\r\nexport { FeatureLayer, featureLayer } from './Layers/FeatureLayer/FeatureLayer';\r\n"],"names":["Util","DomUtil","arcgisToGeoJSON","geojsonToArcGIS","g2a","a2g","latLng","latLngBounds","LatLngBounds","LatLng","GeoJSON","Class","point","Evented","TileLayer","DomEvent","CRS","ImageOverlay","Layer","popup","bounds","Browser","Point","Bounds","Path"],"m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,CAAC;EACtC,OAAO;EACP,KAAK;EACL,IAAI,OAAO,IAAI,CAAC;EAChB,GAAG;AACH;EACA;EACA;EACA,EAAE,WAAW,CAAC,CAAC,MAAM,EAAE;EACvB,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;EACvB,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;EAC9C;EACA,QAAQ,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxC;EACA,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE;EAC7B,UAAU,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAC;EAChD,SAAS,MAAM,IAAI,IAAI,CAAC,SAAS,EAAE;EACnC,UAAU,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAAC;EAChE,SAAS;EACT,OAAO;EACP,KAAK;EACL,IAAI,OAAO,IAAI,CAAC;EAChB,GAAG;EACH,CAAC,EAAE;AACH;EACO,SAAS,YAAY,EAAE,OAAO,EAAE;EACvC,EAAE,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;EACnC;;EC9bA;AAEG,MAAC,OAAO,GAAG,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/esri-leaflet.js b/dist/esri-leaflet.js new file mode 100644 index 000000000..fbb026282 --- /dev/null +++ b/dist/esri-leaflet.js @@ -0,0 +1,12 @@ +/* esri-leaflet - v3.0.12 - Mon Nov 27 2023 08:34:50 GMT-0600 (Central Standard Time) + * Copyright (c) 2023 Environmental Systems Research Institute, Inc. + * Apache-2.0 */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("leaflet")):"function"==typeof define&&define.amd?define(["exports","leaflet"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).L=t.L||{},t.L.esri={}),t.L)}(this,(function(t,e){"use strict";var i="3.0.12",s=window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest,r=""===document.documentElement.style.pointerEvents,o={cors:s,pointerEvents:r},n={attributionWidthOffset:55},a=0;function l(t){var e="";for(var i in t.f=t.f||"json",t)if(Object.prototype.hasOwnProperty.call(t,i)){var s,r=t[i],o=Object.prototype.toString.call(r);e.length&&(e+="&"),s="[object Array]"===o?"[object Object]"===Object.prototype.toString.call(r[0])?JSON.stringify(r):r.join(","):"[object Object]"===o?JSON.stringify(r):"[object Date]"===o?r.valueOf():r,e+=encodeURIComponent(i)+"="+encodeURIComponent(s)}return e.replaceAll("'","%27")}function u(t,i){var s=new window.XMLHttpRequest;return s.onerror=function(r){s.onreadystatechange=e.Util.falseFn,t.call(i,{error:{code:500,message:"XMLHttpRequest error"}},null)},s.onreadystatechange=function(){var r,o;if(4===s.readyState){try{r=JSON.parse(s.responseText)}catch(t){r=null,o={code:500,message:"Could not parse response as JSON. This could also be caused by a CORS or XMLHttpRequest error."}}!o&&r.error&&(o=r.error,r=null),s.onerror=e.Util.falseFn,t.call(i,o,r)}},s.ontimeout=function(){this.onerror()},s}function h(t,e,i,s){var r=u(i,s);return r.open("POST",t),null!=s&&void 0!==s.options&&(r.timeout=s.options.timeout),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),r.send(l(e)),r}function c(t,e,i,s){var r=u(i,s);return r.open("GET",t+"?"+l(e),!0),null!=s&&void 0!==s.options&&(r.timeout=s.options.timeout,s.options.withCredentials&&(r.withCredentials=!0)),r.send(null),r}function p(t,e,i,s){var r=l(e),n=u(i,s),a=(t+"?"+r).length;if(a<=2e3&&o.cors?n.open("GET",t+"?"+r):a>2e3&&o.cors&&(n.open("POST",t),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8")),null!=s&&void 0!==s.options&&(n.timeout=s.options.timeout,s.options.withCredentials&&(n.withCredentials=!0)),a<=2e3&&o.cors)n.send(null);else{if(!(a>2e3&&o.cors))return a<=2e3&&!o.cors?d(t,e,i,s):void f("a request to "+t+" was longer then 2000 characters and this browser cannot make a cross-domain post request. Please use a proxy https://developers.arcgis.com/esri-leaflet/api-reference/request/");n.send(r)}return n}function d(t,i,s,r){window._EsriLeafletCallbacks=window._EsriLeafletCallbacks||{};var o="c"+a;i.callback="window._EsriLeafletCallbacks."+o,window._EsriLeafletCallbacks[o]=function(t){if(!0!==window._EsriLeafletCallbacks[o]){var e,i=Object.prototype.toString.call(t);"[object Object]"!==i&&"[object Array]"!==i&&(e={error:{code:500,message:"Expected array or object as JSONP response"}},t=null),!e&&t.error&&(e=t,t=null),s.call(r,e,t),window._EsriLeafletCallbacks[o]=!0}};var n=e.DomUtil.create("script",null,document.body);return n.type="text/javascript",n.src=t+"?"+l(i),n.id=o,n.onerror=function(t){if(t&&!0!==window._EsriLeafletCallbacks[o]){s.call(r,{error:{code:500,message:"An unknown error occurred"}}),window._EsriLeafletCallbacks[o]=!0}},e.DomUtil.addClass(n,"esri-leaflet-jsonp"),a++,{id:o,url:n.src,abort:function(){window._EsriLeafletCallbacks._callback[o]({code:0,message:"Request aborted."})}}}var m=o.cors?c:d;function f(){console&&console.warn&&console.warn.apply(console,arguments)}m.CORS=c,m.JSONP=d;var y={request:p,get:m,post:h},g=function(t,e,i,s){var r=(s[0]-i[0])*(t[1]-i[1])-(s[1]-i[1])*(t[0]-i[0]),o=(e[0]-t[0])*(t[1]-i[1])-(e[1]-t[1])*(t[0]-i[0]),n=(s[1]-i[1])*(e[0]-t[0])-(s[0]-i[0])*(e[1]-t[1]);if(0!==n){var a=r/n,l=o/n;if(a>=0&&a<=1&&l>=0&&l<=1)return!0}return!1},_=function(t,e){for(var i=0;i=0},x=function(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},L=function(t,e){var i=_(t,e),s=function(t,e){for(var i=!1,s=-1,r=t.length,o=r-1;++s=0;e--)if(i=r[e][0],L(i,s)){r[e].push(s),h=!0;break}h||u.push(s)}for(;u.length;){s=u.pop();var c=!1;for(e=r.length-1;e>=0;e--)if(i=r[e][0],_(i,s)){r[e].push(s),c=!0;break}c||r.push([s.reverse()])}return 1===r.length?{type:"Polygon",coordinates:r[0]}:{type:"MultiPolygon",coordinates:r}}(e.rings.slice(0))),"number"==typeof e.xmin&&"number"==typeof e.ymin&&"number"==typeof e.xmax&&"number"==typeof e.ymax&&(s.type="Polygon",s.coordinates=[[[e.xmax,e.ymax],[e.xmin,e.ymax],[e.xmin,e.ymin],[e.xmax,e.ymin],[e.xmax,e.ymax]]]),(e.geometry||e.attributes)&&(s.type="Feature",s.geometry=e.geometry?t(e.geometry):null,s.properties=e.attributes?x(e.attributes):null,e.attributes))try{s.id=function(t,e){for(var i=e?[e,"OBJECTID","FID"]:["OBJECTID","FID"],s=0;s=4){b(s)||s.reverse(),e.push(s);for(var r=0;r=4&&(b(o)&&o.reverse(),e.push(o))}}return e},I=function t(e,i){i=i||"OBJECTID";var s,r={wkid:4326},o={};switch(e.type){case"Point":o.x=e.coordinates[0],o.y=e.coordinates[1],e.coordinates[2]&&(o.z=e.coordinates[2]),o.spatialReference=r;break;case"MultiPoint":o.points=e.coordinates.slice(0),e.coordinates[0][2]&&(o.hasZ=!0),o.spatialReference=r;break;case"LineString":o.paths=[e.coordinates.slice(0)],e.coordinates[0][2]&&(o.hasZ=!0),o.spatialReference=r;break;case"MultiLineString":o.paths=e.coordinates.slice(0),e.coordinates[0][0][2]&&(o.hasZ=!0),o.spatialReference=r;break;case"Polygon":o.rings=A(e.coordinates.slice(0)),e.coordinates[0][0][2]&&(o.hasZ=!0),o.spatialReference=r;break;case"MultiPolygon":o.rings=function(t){for(var e=[],i=0;i=0;r--){var o=s[r].slice(0);e.push(o)}return e}(e.coordinates.slice(0)),e.coordinates[0][0][0][2]&&(o.hasZ=!0),o.spatialReference=r;break;case"Feature":e.geometry&&(o.geometry=t(e.geometry,i)),o.attributes=e.properties?x(e.properties):{},e.id&&(o.attributes[i]=e.id);break;case"FeatureCollection":for(o=[],s=0;s=0;n--){var a=C(s[n],i||F(s[n]));o.features.push(a)}return o}function M(t){return"/"!==(t=e.Util.trim(t))[t.length-1]&&(t+="/"),t}function U(t){if(-1!==t.url.indexOf("?")){t.requestParams=t.requestParams||{};var e=t.url.substring(t.url.indexOf("?")+1);t.url=t.url.split("?")[0],t.requestParams=JSON.parse('{"'+decodeURI(e).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}')}return t.url=M(t.url.split("?")[0]),t}function G(t){return/^(?!.*utility\.arcgis\.com).*\.arcgis\.com.*FeatureServer/i.test(t)}function D(t){var e;switch(t){case"Point":e="esriGeometryPoint";break;case"MultiPoint":e="esriGeometryMultipoint";break;case"LineString":case"MultiLineString":e="esriGeometryPolyline";break;case"Polygon":case"MultiPolygon":e="esriGeometryPolygon"}return e}function E(t){return t.getSize().x-n.attributionWidthOffset+"px"}function q(t){if(t.attributionControl){if(t.attributionControl._esriAttributionLayerCount||(t.attributionControl._esriAttributionLayerCount=0),0===t.attributionControl._esriAttributionLayerCount){if(!t.attributionControl._esriAttributionAddedOnce){var i=document.createElement("style");i.type="text/css",i.innerHTML=".esri-truncated-attribution:hover {white-space: normal;}",document.getElementsByTagName("head")[0].appendChild(i);var s=document.createElement("style");s.type="text/css",s.innerHTML=".esri-truncated-attribution {vertical-align: -3px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;display: inline-block;transition: 0s white-space;transition-delay: 1s;max-width: "+E(t)+";}",document.getElementsByTagName("head")[0].appendChild(s),t.on("resize",(function(e){t.attributionControl&&(t.attributionControl._container.style.maxWidth=E(e.target))})),t.attributionControl._esriAttributionAddedOnce=!0}e.DomUtil.addClass(t.attributionControl._container,"esri-truncated-attribution:hover"),e.DomUtil.addClass(t.attributionControl._container,"esri-truncated-attribution")}t.attributionControl._esriAttributionLayerCount=t.attributionControl._esriAttributionLayerCount+1}}function B(t){t.attributionControl&&(t.attributionControl._esriAttributionLayerCount&&1===t.attributionControl._esriAttributionLayerCount&&(e.DomUtil.removeClass(t.attributionControl._container,"esri-truncated-attribution:hover"),e.DomUtil.removeClass(t.attributionControl._container,"esri-truncated-attribution")),t.attributionControl._esriAttributionLayerCount=t.attributionControl._esriAttributionLayerCount-1)}function z(t){var i={geometry:null,geometryType:null};return t instanceof e.LatLngBounds?(i.geometry=R(t),i.geometryType="esriGeometryEnvelope",i):(t.getLatLng&&(t=t.getLatLng()),t instanceof e.LatLng&&(t={type:"Point",coordinates:[t.lng,t.lat]}),t instanceof e.GeoJSON&&(t=t.getLayers()[0].feature.geometry,i.geometry=T(t),i.geometryType=D(t.type)),t.toGeoJSON&&(t=t.toGeoJSON()),"Feature"===t.type&&(t=t.geometry),"Point"===t.type||"LineString"===t.type||"Polygon"===t.type||"MultiPolygon"===t.type?(i.geometry=T(t),i.geometryType=D(t.type),i):void f("invalid geometry passed to spatial query. Should be L.LatLng, L.LatLngBounds, L.Marker or a GeoJSON Point, Line, Polygon or MultiPolygon object"))}function Z(t,i){o.cors&&p(t,{},e.Util.bind((function(t,s){if(!t){i._esriAttributions=[];for(var r=0;r=h.minZoom&&l<=h.maxZoom&&(o+=", "+c)}o='Powered by Esri | '+o.substr(2),r.innerHTML=o,r.style.maxWidth=E(i),i.fire("attributionupdated",{attribution:o})}}}var j={warn:f,cleanUrl:M,getUrlParams:U,isArcgisOnline:G,geojsonTypeToArcGIS:D,responseToFeatureCollection:k,geojsonToArcGIS:T,arcgisToGeoJSON:C,boundsToExtent:R,extentToBounds:w,calcAttributionWidth:E,setEsriAttribution:q,removeEsriAttribution:B,_setGeometry:z,_getAttributionData:Z,_updateMapAttribution:N,_findIdAttributeFromFeature:F,_findIdAttributeFromResponse:O},W=e.Class.extend({options:{proxy:!1,useCors:s},generateSetter:function(t,i){return e.Util.bind((function(e){return this.params[t]=e,this}),i)},initialize:function(t){if(t.request&&t.options?(this._service=t,e.Util.setOptions(this,t.options)):(e.Util.setOptions(this,t),this.options.url=M(t.url)),this.params=e.Util.extend({},this.params||{}),this.setters)for(var i in this.setters){var s=this.setters[i];this[i]=this.generateSetter(s,this)}},token:function(t){return this._service?this._service.authenticate(t):this.params.token=t,this},apikey:function(t){return this.token(t)},format:function(t){return this.params.returnUnformattedValues=!t,this},request:function(t,i){return this.options.requestParams&&e.Util.extend(this.params,this.options.requestParams),this._service?this._service.request(this.path,this.params,t,i):this._request("request",this.path,this.params,t,i)},_request:function(t,e,i,s,r){var o=this.options.proxy?this.options.proxy+"?"+this.options.url+e:this.options.url+e;return"get"!==t&&"request"!==t||this.options.useCors?y[t](o,i,s,r):y.get.JSONP(o,i,s,r)}});var J=W.extend({setters:{offset:"resultOffset",limit:"resultRecordCount",fields:"outFields",precision:"geometryPrecision",featureIds:"objectIds",returnGeometry:"returnGeometry",returnM:"returnM",transform:"datumTransformation",token:"token"},path:"query",params:{returnGeometry:!0,where:"1=1",outSR:4326,outFields:"*"},within:function(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelContains",this},intersects:function(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelIntersects",this},contains:function(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelWithin",this},crosses:function(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelCrosses",this},touches:function(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelTouches",this},overlaps:function(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelOverlaps",this},bboxIntersects:function(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelEnvelopeIntersects",this},indexIntersects:function(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelIndexIntersects",this},nearby:function(t,i){return t=e.latLng(t),this.params.geometry=[t.lng,t.lat],this.params.geometryType="esriGeometryPoint",this.params.spatialRel="esriSpatialRelIntersects",this.params.units="esriSRUnit_Meter",this.params.distance=i,this.params.inSR=4326,this},where:function(t){return this.params.where=t,this},between:function(t,e){return this.params.time=[t.valueOf(),e.valueOf()],this},simplify:function(t,e){var i=Math.abs(t.getBounds().getWest()-t.getBounds().getEast());return this.params.maxAllowableOffset=i/t.getSize().y*e,this},orderBy:function(t,e){return e=e||"ASC",this.params.orderByFields=this.params.orderByFields?this.params.orderByFields+",":"",this.params.orderByFields+=[t,e].join(" "),this},run:function(t,e){return this._cleanParams(),this.options.isModern||G(this.options.url)&&void 0===this.options.isModern?(this.params.f="geojson",this.request((function(i,s){this._trapSQLerrors(i),t.call(e,i,s,s)}),this)):this.request((function(i,s){this._trapSQLerrors(i),t.call(e,i,s&&k(s),s)}),this)},count:function(t,e){return this._cleanParams(),this.params.returnCountOnly=!0,this.request((function(e,i){t.call(this,e,i&&i.count,i)}),e)},ids:function(t,e){return this._cleanParams(),this.params.returnIdsOnly=!0,this.request((function(e,i){t.call(this,e,i&&i.objectIds,i)}),e)},bounds:function(t,e){return this._cleanParams(),this.params.returnExtentOnly=!0,this.request((function(i,s){s&&s.extent&&w(s.extent)?t.call(e,i,w(s.extent),s):(i={message:"Invalid Bounds"},t.call(e,i,null,s))}),e)},distinct:function(){return this.params.returnGeometry=!1,this.params.returnDistinctValues=!0,this},pixelSize:function(t){var i=e.point(t);return this.params.pixelSize=[i.x,i.y],this},layer:function(t){return this.path=t+"/query",this},_trapSQLerrors:function(t){t&&"400"===t.code&&f("one common syntax error in query requests is encasing string values in double quotes instead of single quotes")},_cleanParams:function(){delete this.params.returnIdsOnly,delete this.params.returnExtentOnly,delete this.params.returnCountOnly},_setGeometryParams:function(t){this.params.inSR=4326;var e=z(t);this.params.geometry=e.geometry,this.params.geometryType=e.geometryType}});function V(t){return new J(t)}var Q=W.extend({setters:{contains:"contains",text:"searchText",fields:"searchFields",spatialReference:"sr",sr:"sr",layers:"layers",returnGeometry:"returnGeometry",maxAllowableOffset:"maxAllowableOffset",precision:"geometryPrecision",dynamicLayers:"dynamicLayers",returnZ:"returnZ",returnM:"returnM",gdbVersion:"gdbVersion",token:"token"},path:"find",params:{sr:4326,contains:!0,returnGeometry:!0,returnZ:!0,returnM:!1},layerDefs:function(t,e){return this.params.layerDefs=this.params.layerDefs?this.params.layerDefs+";":"",this.params.layerDefs+=[t,e].join(":"),this},simplify:function(t,e){var i=Math.abs(t.getBounds().getWest()-t.getBounds().getEast());return this.params.maxAllowableOffset=i/t.getSize().y*e,this},run:function(t,e){return this.request((function(i,s){t.call(e,i,s&&k(s),s)}),e)}});function K(t){return new Q(t)}var H=W.extend({path:"identify",between:function(t,e){return this.params.time=[t.valueOf(),e.valueOf()],this}});var X=H.extend({setters:{layers:"layers",precision:"geometryPrecision",tolerance:"tolerance",returnGeometry:"returnGeometry"},params:{sr:4326,layers:"all",tolerance:3,returnGeometry:!0},on:function(t){var e=R(t.getBounds()),i=t.getSize();return this.params.imageDisplay=[i.x,i.y,96],this.params.mapExtent=[e.xmin,e.ymin,e.xmax,e.ymax],this},at:function(t){return 2===t.length&&(t=e.latLng(t)),this._setGeometryParams(t),this},layerDef:function(t,e){return this.params.layerDefs=this.params.layerDefs?this.params.layerDefs+";":"",this.params.layerDefs+=[t,e].join(":"),this},simplify:function(t,e){var i=Math.abs(t.getBounds().getWest()-t.getBounds().getEast());return this.params.maxAllowableOffset=i/t.getSize().y*e,this},run:function(t,e){return this.request((function(i,s){if(i)t.call(e,i,void 0,s);else{var r=k(s);s.results=s.results.reverse();for(var o=0;o=0;o--)r.catalogItems.features[o].properties.catalogItemVisibility=s[o];return r}});function tt(t){return new $(t)}var et=e.Evented.extend({options:{proxy:!1,useCors:s,timeout:0},initialize:function(t){t=t||{},this._requestQueue=[],this._authenticating=!1,e.Util.setOptions(this,t),this.options.url=M(this.options.url)},get:function(t,e,i,s){return this._request("get",t,e,i,s)},post:function(t,e,i,s){return this._request("post",t,e,i,s)},request:function(t,e,i,s){return this._request("request",t,e,i,s)},metadata:function(t,e){return this._request("get","",{},t,e)},authenticate:function(t){return this._authenticating=!1,this.options.token=t,this._runQueue(),this},getTimeout:function(){return this.options.timeout},setTimeout:function(t){this.options.timeout=t},_request:function(t,i,s,r,o){this.fire("requeststart",{url:this.options.url+i,params:s,method:t},!0);var n=this._createServiceCallback(t,i,s,r,o);if(this.options.token&&(s.token=this.options.token),this.options.requestParams&&e.Util.extend(s,this.options.requestParams),!this._authenticating){var a=this.options.proxy?this.options.proxy+"?"+this.options.url+i:this.options.url+i;return"get"!==t&&"request"!==t||this.options.useCors?y[t](a,s,n,o):y.get.JSONP(a,s,n,o)}this._requestQueue.push([t,i,s,r,o])},_createServiceCallback:function(t,i,s,r,o){return e.Util.bind((function(n,a){!n||499!==n.code&&498!==n.code||(this._authenticating=!0,this._requestQueue.push([t,i,s,r,o]),this.fire("authenticationrequired",{authenticate:e.Util.bind(this.authenticate,this)},!0),n.authenticate=e.Util.bind(this.authenticate,this)),r.call(o,n,a),n?this.fire("requesterror",{url:this.options.url+i,params:s,message:n.message,code:n.code,method:t},!0):this.fire("requestsuccess",{url:this.options.url+i,params:s,response:a,method:t},!0),this.fire("requestend",{url:this.options.url+i,params:s,method:t},!0)}),this)},_runQueue:function(){for(var t=this._requestQueue.length-1;t>=0;t--){var e=this._requestQueue[t];this[e.shift()].apply(this,e)}this._requestQueue=[]}});var it=et.extend({identify:function(){return Y(this)},find:function(){return K(this)},query:function(){return V(this)}});function st(t){return new it(t)}var rt=et.extend({query:function(){return V(this)},identify:function(){return tt(this)}});function ot(t){return new rt(t)}var nt=et.extend({options:{idAttribute:"OBJECTID"},query:function(){return V(this)},addFeature:function(t,e,i){this.addFeatures(t,e,i)},addFeatures:function(t,e,i){for(var s=t.features?t.features:[t],r=s.length-1;r>=0;r--)delete s[r].id;return t=T(t),t=s.length>1?t:[t],this.post("addFeatures",{features:t},(function(t,s){var r=s&&s.addResults?s.addResults.length>1?s.addResults:s.addResults[0]:void 0;e&&e.call(i,t||s.addResults[0].error,r)}),i)},updateFeature:function(t,e,i){this.updateFeatures(t,e,i)},updateFeatures:function(t,e,i){var s=t.features?t.features:[t];return t=T(t,this.options.idAttribute),t=s.length>1?t:[t],this.post("updateFeatures",{features:t},(function(t,s){var r=s&&s.updateResults?s.updateResults.length>1?s.updateResults:s.updateResults[0]:void 0;e&&e.call(i,t||s.updateResults[0].error,r)}),i)},deleteFeature:function(t,e,i){this.deleteFeatures(t,e,i)},deleteFeatures:function(t,e,i){return this.post("deleteFeatures",{objectIds:t},(function(t,s){var r=s&&s.deleteResults?s.deleteResults.length>1?s.deleteResults:s.deleteResults[0]:void 0;e&&e.call(i,t||s.deleteResults[0].error,r)}),i)}});function at(t){return new nt(t)}var lt="https:"!==window.location.protocol?"http:":"https:",ut=e.TileLayer.extend({statics:{TILES:{Streets:{urlTemplate:lt+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"USGS, NOAA",attributionUrl:"https://static.arcgis.com/attribution/World_Street_Map"}},Topographic:{urlTemplate:lt+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"USGS, NOAA",attributionUrl:"https://static.arcgis.com/attribution/World_Topo_Map"}},Oceans:{urlTemplate:lt+"//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"USGS, NOAA",attributionUrl:"https://static.arcgis.com/attribution/Ocean_Basemap"}},OceansLabels:{urlTemplate:lt+"//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],pane:r?"esri-labels":"tilePane",attribution:""}},NationalGeographic:{urlTemplate:lt+"//{s}.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"National Geographic, DeLorme, HERE, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, increment P Corp."}},DarkGray:{urlTemplate:lt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"HERE, DeLorme, MapmyIndia, © OpenStreetMap contributors"}},DarkGrayLabels:{urlTemplate:lt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Reference/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],pane:r?"esri-labels":"tilePane",attribution:""}},Gray:{urlTemplate:lt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"HERE, DeLorme, MapmyIndia, © OpenStreetMap contributors"}},GrayLabels:{urlTemplate:lt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],pane:r?"esri-labels":"tilePane",attribution:""}},Imagery:{urlTemplate:lt+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community",attributionUrl:"https://static.arcgis.com/attribution/World_Imagery"}},ImageryLabels:{urlTemplate:lt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],pane:r?"esri-labels":"tilePane",attribution:""}},ImageryTransportation:{urlTemplate:lt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],pane:r?"esri-labels":"tilePane",attribution:""}},ShadedRelief:{urlTemplate:lt+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:13,subdomains:["server","services"],attribution:"USGS"}},ShadedReliefLabels:{urlTemplate:lt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:12,subdomains:["server","services"],pane:r?"esri-labels":"tilePane",attribution:""}},Terrain:{urlTemplate:lt+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:13,subdomains:["server","services"],attribution:"USGS, NOAA"}},TerrainLabels:{urlTemplate:lt+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:13,subdomains:["server","services"],pane:r?"esri-labels":"tilePane",attribution:""}},USATopo:{urlTemplate:lt+"//{s}.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:15,subdomains:["server","services"],attribution:"USGS, National Geographic Society, i-cubed"}},ImageryClarity:{urlTemplate:lt+"//clarity.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,attribution:"Esri, DigitalGlobe, GeoEye, Earthstar Geographics, CNES/Airbus DS, USDA, USGS, AeroGRID, IGN, and the GIS User Community"}},Physical:{urlTemplate:lt+"//{s}.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:8,subdomains:["server","services"],attribution:"U.S. National Park Service"}},ImageryFirefly:{urlTemplate:lt+"//fly.maptiles.arcgis.com/arcgis/rest/services/World_Imagery_Firefly/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,attribution:"Esri, DigitalGlobe, GeoEye, Earthstar Geographics, CNES/Airbus DS, USDA, USGS, AeroGRID, IGN, and the GIS User Community",attributionUrl:"https://static.arcgis.com/attribution/World_Imagery"}}}},initialize:function(t,i){var s;if("object"==typeof t&&t.urlTemplate&&t.options)s=t;else{if("string"!=typeof t||!ut.TILES[t])throw new Error('L.esri.BasemapLayer: Invalid parameter. Use one of "Streets", "Topographic", "Oceans", "OceansLabels", "NationalGeographic", "Physical", "Gray", "GrayLabels", "DarkGray", "DarkGrayLabels", "Imagery", "ImageryLabels", "ImageryTransportation", "ImageryClarity", "ImageryFirefly", ShadedRelief", "ShadedReliefLabels", "Terrain", "TerrainLabels" or "USATopo"');s=ut.TILES[t]}var r=e.Util.extend(s.options,i);e.Util.setOptions(this,r),this.options.ignoreDeprecationWarning||console.warn("WARNING: L.esri.BasemapLayer uses data services that are in mature support and are not being updated. Please use L.esri.Vector.vectorBasemapLayer instead. More info: https://esriurl.com/esri-leaflet-basemap"),this.options.token&&-1===s.urlTemplate.indexOf("token=")&&(s.urlTemplate+="?token="+this.options.token),this.options.proxy&&(s.urlTemplate=this.options.proxy+"?"+s.urlTemplate),e.TileLayer.prototype.initialize.call(this,s.urlTemplate,r)},onAdd:function(t){q(t),"esri-labels"===this.options.pane&&this._initPane(),this.options.attributionUrl&&Z((this.options.proxy?this.options.proxy+"?":"")+this.options.attributionUrl,t),t.on("moveend",N),e.TileLayer.prototype.onAdd.call(this,t)},onRemove:function(t){B(t),t.off("moveend",N),e.TileLayer.prototype.onRemove.call(this,t)},_initPane:function(){if(!this._map.getPane(this.options.pane)){var t=this._map.createPane(this.options.pane);t.style.pointerEvents="none",t.style.zIndex=500}},getAttribution:function(){if(this.options.attribution)var t=''+this.options.attribution+"";return t}});var ht=e.TileLayer.extend({options:{zoomOffsetAllowance:.1,errorTileUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEABAMAAACuXLVVAAAAA1BMVEUzNDVszlHHAAAAAXRSTlMAQObYZgAAAAlwSFlzAAAAAAAAAAAB6mUWpAAAADZJREFUeJztwQEBAAAAgiD/r25IQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7waBAAABw08RwAAAAABJRU5ErkJggg=="},statics:{MercatorZoomLevels:{0:156543.033928,1:78271.5169639999,2:39135.7584820001,3:19567.8792409999,4:9783.93962049996,5:4891.96981024998,6:2445.98490512499,7:1222.99245256249,8:611.49622628138,9:305.748113140558,10:152.874056570411,11:76.4370282850732,12:38.2185141425366,13:19.1092570712683,14:9.55462853563415,15:4.77731426794937,16:2.38865713397468,17:1.19432856685505,18:.597164283559817,19:.298582141647617,20:.14929107082381,21:.07464553541191,22:.0373227677059525,23:.0186613838529763}},initialize:function(t){t=U(t=e.Util.setOptions(this,t)),this.tileUrl=(t.proxy?t.proxy+"?":"")+t.url+"tile/{z}/{y}/{x}"+(t.requestParams&&Object.keys(t.requestParams).length>0?e.Util.getParamString(t.requestParams):""),-1!==t.url.indexOf("{s}")&&t.subdomains&&(t.url=t.url.replace("{s}",t.subdomains[0])),this.service=st(t),this.service.addEventParent(this),new RegExp(/tiles.arcgis(online)?\.com/g).test(t.url)&&(this.tileUrl=this.tileUrl.replace("://tiles","://tiles{s}"),t.subdomains=["1","2","3","4"]),this.options.token&&(this.tileUrl+="?token="+this.options.token),e.TileLayer.prototype.initialize.call(this,this.tileUrl,t)},getTileUrl:function(t){var i=this._getZoomForUrl();return e.Util.template(this.tileUrl,e.Util.extend({s:this._getSubdomain(t),x:t.x,y:t.y,z:this._lodMap&&void 0!==this._lodMap[i]?this._lodMap[i]:i},this.options))},createTile:function(t,i){var s=document.createElement("img");return e.DomEvent.on(s,"load",e.Util.bind(this._tileOnLoad,this,i,s)),e.DomEvent.on(s,"error",e.Util.bind(this._tileOnError,this,i,s)),this.options.crossOrigin&&(s.crossOrigin=""),s.alt="",!this._lodMap||this._lodMap&&void 0!==this._lodMap[this._getZoomForUrl()]?s.src=this.getTileUrl(t):this.once("lodmap",(function(){s.src=this.getTileUrl(t)}),this),s},onAdd:function(t){q(t),this._lodMap||this.metadata((function(i,s){if(!i&&s.spatialReference){var r=s.spatialReference.latestWkid||s.spatialReference.wkid;if(!this.options.attribution&&t.attributionControl&&s.copyrightText&&(this.options.attribution=s.copyrightText,t.attributionControl.addAttribution(this.getAttribution())),t.options.crs!==e.CRS.EPSG3857||102100!==r&&3857!==r)t.options.crs&&t.options.crs.code&&t.options.crs.code.indexOf(r)>-1||f("L.esri.TiledMapLayer is using a non-mercator spatial reference. Support may be available through Proj4Leaflet https://developers.arcgis.com/esri-leaflet/samples/non-mercator-projection/");else{this._lodMap={};for(var o=s.tileInfo.lods,n=ht.MercatorZoomLevels,a=0;athis.options.maxZoom||t0||or&&this._retainParent(o,n,a,r))},_retainChildren:function(t,i,s,r){for(var o=2*t;o<2*t+2;o++)for(var n=2*i;n<2*i+2;n++){var a=new e.Point(o,n);a.z=s+1;var l=this._cellCoordsToKey(a),u=this._cells[l];u&&u.active?u.retain=!0:(u&&u.loaded&&(u.retain=!0),s+11)this._setView(t,s);else{for(var p=o.min.y;p<=o.max.y;p++)for(var d=o.min.x;d<=o.max.x;d++){var m=new e.Point(d,p);if(m.z=this._cellZoom,this._isValidCell(m)){var f=this._cells[this._cellCoordsToKey(m)];f?f.current=!0:a.push(m)}}if(a.sort((function(t,e){return t.distanceTo(n)-e.distanceTo(n)})),0!==a.length)for(this._loading||(this._loading=!0),d=0;ds.max.x)||!i.wrapLat&&(t.ys.max.y))return!1}if(!this.options.bounds)return!0;var r=this._cellCoordsToBounds(t);return e.toLatLngBounds(this.options.bounds).overlaps(r)},_keyToBounds:function(t){return this._cellCoordsToBounds(this._keyToCellCoords(t))},_cellCoordsToNwSe:function(t){var e=this._map,i=this.getCellSize(),s=t.scaleBy(i),r=s.add(i);return[e.unproject(s,t.z),e.unproject(r,t.z)]},_cellCoordsToBounds:function(t){var i=this._cellCoordsToNwSe(t),s=new e.LatLngBounds(i[0],i[1]);return this.options.noWrap||(s=this._map.wrapLatLngBounds(s)),s},_cellCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToCellCoords:function(t){var i=t.split(":"),s=new e.Point(+i[0],+i[1]);return s.z=+i[2],s},_removeCell:function(t){var e=this._cells[t];if(e){var i=this._keyToCellCoords(t),s=this._wrapCoords(i),r=this._cellCoordsToBounds(this._wrapCoords(i));e.current=!1,delete this._cells[t],this._activeCells[t]=e,this.cellLeave(r,s,t),this.fire("cellleave",{key:t,coords:s,bounds:r})}},_reuseCell:function(t){var e=this._cellCoordsToKey(t);this._cells[e]=this._activeCells[e],this._cells[e].current=!0;var i=this._wrapCoords(t),s=this._cellCoordsToBounds(this._wrapCoords(t));this.cellEnter(s,i,e),this.fire("cellenter",{key:e,coords:i,bounds:s})},_createCell:function(t){var i=this._cellCoordsToKey(t),s=this._wrapCoords(t),r=this._cellCoordsToBounds(this._wrapCoords(t));this.createCell(r,s,i),this.fire("cellcreate",{key:i,coords:s,bounds:r}),this._cells[i]={coords:t,current:!0},e.Util.requestAnimFrame(this._pruneCells,this)},_cellReady:function(t,e,i){var s=this._cellCoordsToKey(t);(i=this._cells[s])&&(i.loaded=+new Date,i.active=!0)},_getCellPos:function(t){return t.scaleBy(this.getCellSize())},_wrapCoords:function(t){var i=new e.Point(this._wrapX?e.Util.wrapNum(t.x,this._wrapX):t.x,this._wrapY?e.Util.wrapNum(t.y,this._wrapY):t.y);return i.z=t.z,i},_pxBoundsToCellRange:function(t){var i=this.getCellSize();return new e.Bounds(t.min.unscaleBy(i).floor(),t.max.unscaleBy(i).ceil().subtract([1,1]))}});function yt(t){this.values=[].concat(t||[])}yt.prototype.query=function(t){var e=this.getIndex(t);return this.values[e]},yt.prototype.getIndex=function(t){this.dirty&&this.sort();for(var e,i,s=0,r=this.values.length-1;s<=r;)if(e=(s+r)/2|0,+(i=this.values[Math.round(e)]).value<+t)s=e+1;else{if(!(+i.value>+t))return e;r=e-1}return Math.abs(~r)},yt.prototype.between=function(t,e){var i=this.getIndex(t),s=this.getIndex(e);if(0===i&&0===s)return[];for(;this.values[i-1]&&this.values[i-1].value===t;)i--;for(;this.values[s+1]&&this.values[s+1].value===e;)s++;return this.values[s]&&this.values[s].value===e&&this.values[s+1]&&s++,this.values.slice(i,s)},yt.prototype.insert=function(t){return this.values.splice(this.getIndex(t.value),0,t),this},yt.prototype.bulkAdd=function(t,e){return this.values=this.values.concat([].concat(t||[])),e?this.sort():this.dirty=!0,this},yt.prototype.sort=function(){return this.values.sort((function(t,e){return+e.value-+t.value})).reverse(),this.dirty=!1,this};var gt=ft.extend({options:{attribution:null,where:"1=1",fields:["*"],from:!1,to:!1,timeField:!1,timeFilterMode:"server",simplifyFactor:0,precision:6,fetchAllFeatures:!1},initialize:function(t){if(ft.prototype.initialize.call(this,t),t=U(t),t=e.Util.setOptions(this,t),this.service=at(t),this.service.addEventParent(this),"*"!==this.options.fields[0]){for(var i=!1,s=0;s=0;s--){var r=t[s].id;-1===this._currentSnapshot.indexOf(r)&&this._currentSnapshot.push(r),void 0!==i&&-1===this._cache[i].indexOf(r)&&this._cache[i].push(r)}this.options.timeField&&this._buildTimeIndexes(t),this.createLayers(t)},_buildQuery:function(t,i){var s=this.service.query().intersects(t).where(this.options.where).fields(this.options.fields).precision(this.options.precision);return this.options.fetchAllFeatures&&!isNaN(parseInt(i))&&(s=s.offset(i)),s.params.resultType="tile",this.options.requestParams&&e.Util.extend(s.params,this.options.requestParams),this.options.simplifyFactor&&s.simplify(this._map,this.options.simplifyFactor),"server"===this.options.timeFilterMode&&this.options.from&&this.options.to&&s.between(this.options.from,this.options.to),s},setWhere:function(t,i,s){this.options.where=t&&t.length?t:"1=1";for(var r=[],o=[],n=0,a=null,l=e.Util.bind((function(l,u){if(l&&(a=l),u)for(var h=u.features.length-1;h>=0;h--)o.push(u.features[h].id);--n<=0&&this._visibleZoom()&&t===this.options.where&&(this._currentSnapshot=o,e.Util.requestAnimFrame(e.Util.bind((function(){this.removeLayers(r),this.addLayers(o),i&&i.call(s,a)}),this)))}),this),u=this._currentSnapshot.length-1;u>=0;u--)r.push(this._currentSnapshot[u]);for(var h in this._cache={},this._cells){n++;var c=this._keyToCellCoords(h),p=this._cellCoordsToBounds(c);this._requestFeatures(p,c,l)}return this},getWhere:function(){return this.options.where},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(t,i,s,r){var o=this.options.from,n=this.options.to,a=0,l=null,u=e.Util.bind((function(e){e&&(l=e),this._filterExistingFeatures(o,n,t,i),a--,s&&a<=0&&s.call(r,l)}),this);if(this.options.from=t,this.options.to=i,this._filterExistingFeatures(o,n,t,i),"server"===this.options.timeFilterMode)for(var h in this._cells){a++;var c=this._keyToCellCoords(h),p=this._cellCoordsToBounds(c);this._requestFeatures(p,c,u)}return this},refresh:function(){this.setWhere(this.options.where)},_filterExistingFeatures:function(t,i,s,r){var o=t&&i?this._getFeaturesInTimeRange(t,i):this._currentSnapshot,n=this._getFeaturesInTimeRange(s,r);if(n.indexOf)for(var a=0;a=0&&o.splice(l,1)}e.Util.requestAnimFrame(e.Util.bind((function(){this.removeLayers(o),this.addLayers(n)}),this))},_getFeaturesInTimeRange:function(t,e){var i,s=[];if(this.options.timeField.start&&this.options.timeField.end){var r=this._startTimeIndex.between(t,e),o=this._endTimeIndex.between(t,e);i=r.concat(o)}else{if(!this._timeIndex)return f("You must set timeField in the layer constructor in order to manipulate the start and end time filter."),[];i=this._timeIndex.between(t,e)}for(var n=i.length-1;n>=0;n--)s.push(i[n].id);return s},_buildTimeIndexes:function(t){var e,i;if(this.options.timeField.start&&this.options.timeField.end){var s=[],r=[];for(e=t.length-1;e>=0;e--)i=t[e],s.push({id:i.id,value:new Date(i.properties[this.options.timeField.start])}),r.push({id:i.id,value:new Date(i.properties[this.options.timeField.end])});this._startTimeIndex.bulkAdd(s),this._endTimeIndex.bulkAdd(r)}else{var o=[];for(e=t.length-1;e>=0;e--)i=t[e],o.push({id:i.id,value:new Date(i.properties[this.options.timeField])});this._timeIndex.bulkAdd(o)}},_featureWithinTimeRange:function(t){if(!this.options.from||!this.options.to)return!0;var e=+this.options.from.valueOf(),i=+this.options.to.valueOf();if("string"==typeof this.options.timeField){var s=+t.properties[this.options.timeField];return s>=e&&s<=i}if(this.options.timeField.start&&this.options.timeField.end){var r=+t.properties[this.options.timeField.start],o=+t.properties[this.options.timeField.end];return r>=e&&r<=i||o>=e&&o<=i||r<=e&&o>=i}},_visibleZoom:function(){if(!this._map)return!1;var t=this._map.getZoom();return!(t>this.options.maxZoom||t=0;r--)n[r].properties[o.objectIdField]=n.length>1?e[r].objectId:e.objectId,n[r].id=n.length>1?e[r].objectId:e.objectId;this._addFeatures(n)}i&&i.call(s,t,e)}),this))}}),this))},updateFeature:function(t,e,i){this.updateFeatures(t,e,i)},updateFeatures:function(t,e,i){var s=t.features?t.features:[t];this.service.updateFeatures(t,(function(t,r){if(!t){for(var o=s.length-1;o>=0;o--)this.removeLayers([s[o].id],!0);this._addFeatures(s)}e&&e.call(i,t,r)}),this)},deleteFeature:function(t,e,i){this.deleteFeatures(t,e,i)},deleteFeatures:function(t,e,i){return this.service.deleteFeatures(t,(function(t,s){var r=s.length?s:[s];if(!t&&r.length>0)for(var o=r.length-1;o>=0;o--)this.removeLayers([r[o].objectId],!0);e&&e.call(i,t,s)}),this)}}),_t=gt.extend({options:{cacheLayers:!0},initialize:function(t){t.apikey&&(t.token=t.apikey),gt.prototype.initialize.call(this,t),this._originalStyle=this.options.style,this._layers={}},onRemove:function(t){for(var e in this._layers)t.removeLayer(this._layers[e]),this.fire("removefeature",{feature:this._layers[e].feature,permanent:!1},!0);return gt.prototype.onRemove.call(this,t)},createNewLayer:function(t){var i=e.GeoJSON.geometryToLayer(t,this.options);return i&&(i.defaultOptions=i.options),i},_updateLayer:function(t,i){var s=[],r=this.options.coordsToLatLng||e.GeoJSON.coordsToLatLng;switch(i.properties&&(t.feature.properties=i.properties),i.geometry.type){case"Point":s=e.GeoJSON.coordsToLatLng(i.geometry.coordinates),t.setLatLng(s);break;case"LineString":s=e.GeoJSON.coordsToLatLngs(i.geometry.coordinates,0,r),t.setLatLngs(s);break;case"MultiLineString":case"Polygon":s=e.GeoJSON.coordsToLatLngs(i.geometry.coordinates,1,r),t.setLatLngs(s);break;case"MultiPolygon":s=e.GeoJSON.coordsToLatLngs(i.geometry.coordinates,2,r),t.setLatLngs(s)}this.redraw(t.feature.id)},createLayers:function(t){for(var e=t.length-1;e>=0;e--){var i,s=t[e],r=this._layers[s.id];!this._visibleZoom()||!r||this._map.hasLayer(r)||this.options.timeField&&!this._featureWithinTimeRange(s)||(this._map.addLayer(r),this.fire("addfeature",{feature:r.feature},!0)),r&&(r.setLatLngs||r.setLatLng)&&this._updateLayer(r,s),r||((i=this.createNewLayer(s))?(i.feature=s,i.addEventParent(this),this.options.onEachFeature&&this.options.onEachFeature(i.feature,i),this._layers[i.feature.id]=i,this.setFeatureStyle(i.feature.id,this.options.style),this.fire("createfeature",{feature:i.feature},!0),this._visibleZoom()&&(!this.options.timeField||this.options.timeField&&this._featureWithinTimeRange(s))&&this._map.addLayer(i)):f("invalid GeoJSON encountered"))}},addLayers:function(t){for(var e=t.length-1;e>=0;e--){var i=this._layers[t[e]];!i||this.options.timeField&&!this._featureWithinTimeRange(i.feature)||(this._map.addLayer(i),this.fire("addfeature",{feature:i.feature},!0))}},removeLayers:function(t,e){for(var i=t.length-1;i>=0;i--){var s=t[i],r=this._layers[s];r&&(this.fire("removefeature",{feature:r.feature,permanent:e},!0),this._map.removeLayer(r)),r&&e&&delete this._layers[s]}},cellEnter:function(t,i){this._visibleZoom()&&!this._zooming&&this._map&&e.Util.requestAnimFrame(e.Util.bind((function(){var t=this._cacheKey(i),e=this._cellCoordsToKey(i),s=this._cache[t];this._activeCells[e]&&s&&this.addLayers(s)}),this))},cellLeave:function(t,i){this._zooming||e.Util.requestAnimFrame(e.Util.bind((function(){if(this._map){var t=this._cacheKey(i),e=this._cellCoordsToKey(i),s=this._cache[t],r=this._map.getBounds();if(!this._activeCells[e]&&s){for(var o=!0,n=0;n 2000 && Support.cors) {\r\n httpRequest.open('POST', url);\r\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');\r\n }\r\n\r\n if (typeof context !== 'undefined' && context !== null) {\r\n if (typeof context.options !== 'undefined') {\r\n httpRequest.timeout = context.options.timeout;\r\n if (context.options.withCredentials) {\r\n httpRequest.withCredentials = true;\r\n }\r\n }\r\n }\r\n\r\n // request is less than 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest\r\n if (requestLength <= 2000 && Support.cors) {\r\n httpRequest.send(null);\r\n\r\n // request is more than 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest\r\n } else if (requestLength > 2000 && Support.cors) {\r\n httpRequest.send(paramString);\r\n\r\n // request is less than 2000 characters and the browser does not support CORS, make a JSONP request\r\n } else if (requestLength <= 2000 && !Support.cors) {\r\n return jsonp(url, params, callback, context);\r\n\r\n // request is longer then 2000 characters and the browser does not support CORS, log a warning\r\n } else {\r\n warn('a request to ' + url + ' was longer then 2000 characters and this browser cannot make a cross-domain post request. Please use a proxy https://developers.arcgis.com/esri-leaflet/api-reference/request/');\r\n return;\r\n }\r\n\r\n return httpRequest;\r\n}\r\n\r\nexport function jsonp (url, params, callback, context) {\r\n window._EsriLeafletCallbacks = window._EsriLeafletCallbacks || {};\r\n var callbackId = 'c' + callbacks;\r\n params.callback = 'window._EsriLeafletCallbacks.' + callbackId;\r\n\r\n window._EsriLeafletCallbacks[callbackId] = function (response) {\r\n if (window._EsriLeafletCallbacks[callbackId] !== true) {\r\n var error;\r\n var responseType = Object.prototype.toString.call(response);\r\n\r\n if (!(responseType === '[object Object]' || responseType === '[object Array]')) {\r\n error = {\r\n error: {\r\n code: 500,\r\n message: 'Expected array or object as JSONP response'\r\n }\r\n };\r\n response = null;\r\n }\r\n\r\n if (!error && response.error) {\r\n error = response;\r\n response = null;\r\n }\r\n\r\n callback.call(context, error, response);\r\n window._EsriLeafletCallbacks[callbackId] = true;\r\n }\r\n };\r\n\r\n var script = DomUtil.create('script', null, document.body);\r\n script.type = 'text/javascript';\r\n script.src = url + '?' + serialize(params);\r\n script.id = callbackId;\r\n script.onerror = function (error) {\r\n if (error && window._EsriLeafletCallbacks[callbackId] !== true) {\r\n // Can't get true error code: it can be 404, or 401, or 500\r\n var err = {\r\n error: {\r\n code: 500,\r\n message: 'An unknown error occurred'\r\n }\r\n };\r\n\r\n callback.call(context, err);\r\n window._EsriLeafletCallbacks[callbackId] = true;\r\n }\r\n };\r\n DomUtil.addClass(script, 'esri-leaflet-jsonp');\r\n\r\n callbacks++;\r\n\r\n return {\r\n id: callbackId,\r\n url: script.src,\r\n abort: function () {\r\n window._EsriLeafletCallbacks._callback[callbackId]({\r\n code: 0,\r\n message: 'Request aborted.'\r\n });\r\n }\r\n };\r\n}\r\n\r\nvar get = ((Support.cors) ? xmlHttpGet : jsonp);\r\nget.CORS = xmlHttpGet;\r\nget.JSONP = jsonp;\r\n\r\nexport function warn () {\r\n if (console && console.warn) {\r\n console.warn.apply(console, arguments);\r\n }\r\n}\r\n\r\n// choose the correct AJAX handler depending on CORS support\r\nexport { get };\r\n\r\n// always use XMLHttpRequest for posts\r\nexport { xmlHttpPost as post };\r\n\r\n// export the Request object to call the different handlers for debugging\r\nexport var Request = {\r\n request: request,\r\n get: get,\r\n post: xmlHttpPost\r\n};\r\n\r\nexport default Request;\r\n","/* @preserve\n* @terraformer/arcgis - v2.0.7 - MIT\n* Copyright (c) 2012-2021 Environmental Systems Research Institute, Inc.\n* Thu Jul 22 2021 13:58:30 GMT-0700 (Pacific Daylight Time)\n*/\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nvar edgeIntersectsEdge = function edgeIntersectsEdge(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 (ua >= 0 && ua <= 1 && ub >= 0 && ub <= 1) {\n return true;\n }\n }\n\n return false;\n};\nvar coordinatesContainPoint = function coordinatesContainPoint(coordinates, point) {\n var contains = false;\n\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] || 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]) {\n contains = !contains;\n }\n }\n\n return contains;\n};\nvar pointsEqual = 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\n return true;\n};\nvar arrayIntersectsArray = 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 (edgeIntersectsEdge(a[i], a[i + 1], b[j], b[j + 1])) {\n return true;\n }\n }\n }\n\n return false;\n};\n\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nvar closeRing = function closeRing(coordinates) {\n if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) {\n coordinates.push(coordinates[0]);\n }\n\n return coordinates;\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\nvar ringIsClockwise = function ringIsClockwise(ringToTest) {\n var total = 0;\n var i = 0;\n var rLength = ringToTest.length;\n var pt1 = ringToTest[i];\n var pt2;\n\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\n return total >= 0;\n}; // This function ensures that rings are oriented in the right directions\n// from http://jsperf.com/cloning-an-object/2\n\nvar shallowClone = function shallowClone(obj) {\n var target = {};\n\n for (var i in obj) {\n // both arcgis attributes and geojson props are just hardcoded keys\n if (obj.hasOwnProperty(i)) {\n // eslint-disable-line no-prototype-builtins\n target[i] = obj[i];\n }\n }\n\n return target;\n};\n\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nvar coordinatesContainCoordinates = function coordinatesContainCoordinates(outer, inner) {\n var intersects = arrayIntersectsArray(outer, inner);\n var contains = coordinatesContainPoint(outer, inner[0]);\n\n if (!intersects && contains) {\n return true;\n }\n\n return false;\n}; // do any polygons in this array contain any other polygons in this array?\n// used for checking for holes in arcgis rings\n\n\nvar convertRingsToGeoJSON = function convertRingsToGeoJSON(rings) {\n var outerRings = [];\n var holes = [];\n var x; // iterator\n\n var outerRing; // current outer ring being evaluated\n\n var hole; // current hole being evaluated\n // for each ring\n\n for (var r = 0; r < rings.length; r++) {\n var ring = closeRing(rings[r].slice(0));\n\n if (ring.length < 4) {\n continue;\n } // is this ring an outer ring? is it clockwise?\n\n\n if (ringIsClockwise(ring)) {\n var polygon = [ring.slice().reverse()]; // wind outer rings counterclockwise for RFC 7946 compliance\n\n outerRings.push(polygon); // push to outer rings\n } else {\n holes.push(ring.slice().reverse()); // wind inner rings clockwise for RFC 7946 compliance\n }\n }\n\n var uncontainedHoles = []; // while there are holes left...\n\n while (holes.length) {\n // pop a hole off out stack\n hole = holes.pop(); // loop over all outer rings and see if they contain our hole.\n\n var contained = false;\n\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n\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 } // ring is not contained in any outer ring\n // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320\n\n\n if (!contained) {\n uncontainedHoles.push(hole);\n }\n } // if we couldn't match any holes using contains we can try intersects...\n\n\n while (uncontainedHoles.length) {\n // pop a hole off out stack\n hole = uncontainedHoles.pop(); // loop over all outer rings and see if any intersect our hole.\n\n var intersects = false;\n\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n\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\nvar getId = function getId(attributes, idAttribute) {\n var keys = idAttribute ? [idAttribute, 'OBJECTID', 'FID'] : ['OBJECTID', 'FID'];\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n\n if (key in attributes && (typeof attributes[key] === 'string' || typeof attributes[key] === 'number')) {\n return attributes[key];\n }\n }\n\n throw Error('No valid id attribute found');\n};\n\nvar arcgisToGeoJSON = function arcgisToGeoJSON(arcgis, idAttribute) {\n var geojson = {};\n\n if (arcgis.features) {\n geojson.type = 'FeatureCollection';\n geojson.features = [];\n\n for (var i = 0; i < arcgis.features.length; i++) {\n geojson.features.push(arcgisToGeoJSON(arcgis.features[i], idAttribute));\n }\n }\n\n if (typeof arcgis.x === 'number' && typeof arcgis.y === 'number') {\n geojson.type = 'Point';\n geojson.coordinates = [arcgis.x, arcgis.y];\n\n if (typeof arcgis.z === 'number') {\n geojson.coordinates.push(arcgis.z);\n }\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 (typeof arcgis.xmin === 'number' && typeof arcgis.ymin === 'number' && typeof arcgis.xmax === 'number' && typeof arcgis.ymax === 'number') {\n geojson.type = 'Polygon';\n geojson.coordinates = [[[arcgis.xmax, arcgis.ymax], [arcgis.xmin, arcgis.ymax], [arcgis.xmin, arcgis.ymin], [arcgis.xmax, arcgis.ymin], [arcgis.xmax, arcgis.ymax]]];\n }\n\n if (arcgis.geometry || arcgis.attributes) {\n geojson.type = 'Feature';\n geojson.geometry = arcgis.geometry ? arcgisToGeoJSON(arcgis.geometry) : null;\n geojson.properties = arcgis.attributes ? shallowClone(arcgis.attributes) : null;\n\n if (arcgis.attributes) {\n try {\n geojson.id = getId(arcgis.attributes, idAttribute);\n } catch (err) {// don't set an id\n }\n }\n } // if no valid geometry was encountered\n\n\n if (JSON.stringify(geojson.geometry) === JSON.stringify({})) {\n geojson.geometry = null;\n }\n\n if (arcgis.spatialReference && arcgis.spatialReference.wkid && arcgis.spatialReference.wkid !== 4326) {\n console.warn('Object converted in non-standard crs - ' + JSON.stringify(arcgis.spatialReference));\n }\n\n return geojson;\n};\n\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n// outer rings are clockwise, holes are counterclockwise\n// used for converting GeoJSON Polygons to ArcGIS Polygons\n\nvar orientRings = function orientRings(poly) {\n var output = [];\n var polygon = poly.slice(0);\n var outerRing = closeRing(polygon.shift().slice(0));\n\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\n if (hole.length >= 4) {\n if (ringIsClockwise(hole)) {\n hole.reverse();\n }\n\n output.push(hole);\n }\n }\n }\n\n return output;\n}; // This function flattens holes in multipolygons to one array of polygons\n// used for converting GeoJSON Polygons to ArcGIS Polygons\n\n\nvar flattenMultiPolygonRings = function flattenMultiPolygonRings(rings) {\n var output = [];\n\n for (var i = 0; i < rings.length; i++) {\n var polygon = orientRings(rings[i]);\n\n for (var x = polygon.length - 1; x >= 0; x--) {\n var ring = polygon[x].slice(0);\n output.push(ring);\n }\n }\n\n return output;\n};\n\nvar geojsonToArcGIS = function geojsonToArcGIS(geojson, idAttribute) {\n idAttribute = idAttribute || 'OBJECTID';\n var spatialReference = {\n wkid: 4326\n };\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\n if (geojson.coordinates[2]) {\n result.z = geojson.coordinates[2];\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiPoint':\n result.points = geojson.coordinates.slice(0);\n\n if (geojson.coordinates[0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'LineString':\n result.paths = [geojson.coordinates.slice(0)];\n\n if (geojson.coordinates[0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiLineString':\n result.paths = geojson.coordinates.slice(0);\n\n if (geojson.coordinates[0][0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'Polygon':\n result.rings = orientRings(geojson.coordinates.slice(0));\n\n if (geojson.coordinates[0][0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiPolygon':\n result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));\n\n if (geojson.coordinates[0][0][0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'Feature':\n if (geojson.geometry) {\n result.geometry = geojsonToArcGIS(geojson.geometry, idAttribute);\n }\n\n result.attributes = geojson.properties ? shallowClone(geojson.properties) : {};\n\n if (geojson.id) {\n result.attributes[idAttribute] = geojson.id;\n }\n\n break;\n\n case 'FeatureCollection':\n result = [];\n\n for (i = 0; i < geojson.features.length; i++) {\n result.push(geojsonToArcGIS(geojson.features[i], idAttribute));\n }\n\n break;\n\n case 'GeometryCollection':\n result = [];\n\n for (i = 0; i < geojson.geometries.length; i++) {\n result.push(geojsonToArcGIS(geojson.geometries[i], idAttribute));\n }\n\n break;\n }\n\n return result;\n};\n\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nexport { arcgisToGeoJSON, geojsonToArcGIS };\n","import { latLng, latLngBounds, LatLng, LatLngBounds, Util, DomUtil, GeoJSON } from 'leaflet';\r\nimport { request, warn } from './Request';\r\nimport { options } from './Options';\r\nimport { Support } from './Support';\r\n\r\nimport {\r\n geojsonToArcGIS as g2a,\r\n arcgisToGeoJSON as a2g\r\n} from '@terraformer/arcgis';\r\n\r\nvar POWERED_BY_ESRI_ATTRIBUTION_STRING = 'Powered by Esri';\r\n\r\nexport function geojsonToArcGIS (geojson, idAttr) {\r\n return g2a(geojson, idAttr);\r\n}\r\n\r\nexport function arcgisToGeoJSON (arcgis, idAttr) {\r\n return a2g(arcgis, idAttr);\r\n}\r\n\r\n// convert an extent (ArcGIS) to LatLngBounds (Leaflet)\r\nexport function extentToBounds (extent) {\r\n // \"NaN\" coordinates from ArcGIS Server indicate a null geometry\r\n if (extent.xmin !== 'NaN' && extent.ymin !== 'NaN' && extent.xmax !== 'NaN' && extent.ymax !== 'NaN') {\r\n var sw = latLng(extent.ymin, extent.xmin);\r\n var ne = latLng(extent.ymax, extent.xmax);\r\n return latLngBounds(sw, ne);\r\n } else {\r\n return null;\r\n }\r\n}\r\n\r\n// convert an LatLngBounds (Leaflet) to extent (ArcGIS)\r\nexport function boundsToExtent (bounds) {\r\n bounds = latLngBounds(bounds);\r\n return {\r\n xmin: bounds.getSouthWest().lng,\r\n ymin: bounds.getSouthWest().lat,\r\n xmax: bounds.getNorthEast().lng,\r\n ymax: bounds.getNorthEast().lat,\r\n spatialReference: {\r\n wkid: 4326\r\n }\r\n };\r\n}\r\n\r\nvar knownFieldNames = /^(OBJECTID|FID|OID|ID)$/i;\r\n\r\n// Attempts to find the ID Field from response\r\nexport function _findIdAttributeFromResponse (response) {\r\n var result;\r\n\r\n if (response.objectIdFieldName) {\r\n // Find Id Field directly\r\n result = response.objectIdFieldName;\r\n } else if (response.fields) {\r\n // Find ID Field based on field type\r\n for (var j = 0; j <= response.fields.length - 1; j++) {\r\n if (response.fields[j].type === 'esriFieldTypeOID') {\r\n result = response.fields[j].name;\r\n break;\r\n }\r\n }\r\n if (!result) {\r\n // If no field was marked as being the esriFieldTypeOID try well known field names\r\n for (j = 0; j <= response.fields.length - 1; j++) {\r\n if (response.fields[j].name.match(knownFieldNames)) {\r\n result = response.fields[j].name;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return result;\r\n}\r\n\r\n// This is the 'last' resort, find the Id field from the specified feature\r\nexport function _findIdAttributeFromFeature (feature) {\r\n for (var key in feature.attributes) {\r\n if (key.match(knownFieldNames)) {\r\n return key;\r\n }\r\n }\r\n}\r\n\r\nexport function responseToFeatureCollection (response, idAttribute) {\r\n var objectIdField;\r\n var features = response.features || response.results;\r\n var count = features && features.length;\r\n\r\n if (idAttribute) {\r\n objectIdField = idAttribute;\r\n } else {\r\n objectIdField = _findIdAttributeFromResponse(response);\r\n }\r\n\r\n var featureCollection = {\r\n type: 'FeatureCollection',\r\n features: []\r\n };\r\n\r\n if (count) {\r\n for (var i = features.length - 1; i >= 0; i--) {\r\n var feature = arcgisToGeoJSON(features[i], objectIdField || _findIdAttributeFromFeature(features[i]));\r\n featureCollection.features.push(feature);\r\n }\r\n }\r\n\r\n return featureCollection;\r\n}\r\n\r\n// trim url whitespace and add a trailing slash if needed\r\nexport function cleanUrl (url) {\r\n // trim leading and trailing spaces, but not spaces inside the url\r\n url = Util.trim(url);\r\n\r\n // add a trailing slash to the url if the user omitted it\r\n if (url[url.length - 1] !== '/') {\r\n url += '/';\r\n }\r\n\r\n return url;\r\n}\r\n\r\n/* Extract url params if any and store them in requestParams attribute.\r\n Return the options params updated */\r\nexport function getUrlParams (options) {\r\n if (options.url.indexOf('?') !== -1) {\r\n options.requestParams = options.requestParams || {};\r\n var queryString = options.url.substring(options.url.indexOf('?') + 1);\r\n options.url = options.url.split('?')[0];\r\n options.requestParams = JSON.parse('{\"' + decodeURI(queryString).replace(/\"/g, '\\\\\"').replace(/&/g, '\",\"').replace(/=/g, '\":\"') + '\"}');\r\n }\r\n options.url = cleanUrl(options.url.split('?')[0]);\r\n return options;\r\n}\r\n\r\nexport function isArcgisOnline (url) {\r\n /* hosted feature services support geojson as an output format\r\n utility.arcgis.com services are proxied from a variety of ArcGIS Server vintages, and may not */\r\n return (/^(?!.*utility\\.arcgis\\.com).*\\.arcgis\\.com.*FeatureServer/i).test(url);\r\n}\r\n\r\nexport function geojsonTypeToArcGIS (geoJsonType) {\r\n var arcgisGeometryType;\r\n switch (geoJsonType) {\r\n case 'Point':\r\n arcgisGeometryType = 'esriGeometryPoint';\r\n break;\r\n case 'MultiPoint':\r\n arcgisGeometryType = 'esriGeometryMultipoint';\r\n break;\r\n case 'LineString':\r\n arcgisGeometryType = 'esriGeometryPolyline';\r\n break;\r\n case 'MultiLineString':\r\n arcgisGeometryType = 'esriGeometryPolyline';\r\n break;\r\n case 'Polygon':\r\n arcgisGeometryType = 'esriGeometryPolygon';\r\n break;\r\n case 'MultiPolygon':\r\n arcgisGeometryType = 'esriGeometryPolygon';\r\n break;\r\n }\r\n\r\n return arcgisGeometryType;\r\n}\r\n\r\nexport function calcAttributionWidth (map) {\r\n // either crop at 55px or user defined buffer\r\n return (map.getSize().x - options.attributionWidthOffset) + 'px';\r\n}\r\n\r\nexport function setEsriAttribution (map) {\r\n if (!map.attributionControl) {\r\n return;\r\n }\r\n\r\n if (!map.attributionControl._esriAttributionLayerCount) {\r\n map.attributionControl._esriAttributionLayerCount = 0;\r\n }\r\n\r\n if (map.attributionControl._esriAttributionLayerCount === 0) {\r\n // Dynamically creating the CSS rules, only run this once per page load:\r\n if (!map.attributionControl._esriAttributionAddedOnce) {\r\n var hoverAttributionStyle = document.createElement('style');\r\n hoverAttributionStyle.type = 'text/css';\r\n hoverAttributionStyle.innerHTML = '.esri-truncated-attribution:hover {' +\r\n 'white-space: normal;' +\r\n '}';\r\n document.getElementsByTagName('head')[0].appendChild(hoverAttributionStyle);\r\n\r\n // define a new css class in JS to trim attribution into a single line\r\n var attributionStyle = document.createElement('style');\r\n attributionStyle.type = 'text/css';\r\n attributionStyle.innerHTML = '.esri-truncated-attribution {' +\r\n 'vertical-align: -3px;' +\r\n 'white-space: nowrap;' +\r\n 'overflow: hidden;' +\r\n 'text-overflow: ellipsis;' +\r\n 'display: inline-block;' +\r\n 'transition: 0s white-space;' +\r\n 'transition-delay: 1s;' +\r\n 'max-width: ' + calcAttributionWidth(map) + ';' +\r\n '}';\r\n document.getElementsByTagName('head')[0].appendChild(attributionStyle);\r\n\r\n // update the width used to truncate when the map itself is resized\r\n map.on('resize', function (e) {\r\n if (map.attributionControl) {\r\n map.attributionControl._container.style.maxWidth = calcAttributionWidth(e.target);\r\n }\r\n });\r\n\r\n map.attributionControl._esriAttributionAddedOnce = true;\r\n }\r\n\r\n DomUtil.addClass(map.attributionControl._container, 'esri-truncated-attribution:hover');\r\n DomUtil.addClass(map.attributionControl._container, 'esri-truncated-attribution');\r\n }\r\n\r\n // Track the number of esri-leaflet layers that are on the map so we can know when we can remove the attribution (below in removeEsriAttribution)\r\n map.attributionControl._esriAttributionLayerCount = map.attributionControl._esriAttributionLayerCount + 1;\r\n}\r\n\r\nexport function removeEsriAttribution (map) {\r\n if (!map.attributionControl) {\r\n return;\r\n }\r\n\r\n // Only remove the attribution if we're about to remove the LAST esri-leaflet layer (_esriAttributionLayerCount)\r\n if (map.attributionControl._esriAttributionLayerCount && map.attributionControl._esriAttributionLayerCount === 1) {\r\n DomUtil.removeClass(map.attributionControl._container, 'esri-truncated-attribution:hover');\r\n DomUtil.removeClass(map.attributionControl._container, 'esri-truncated-attribution');\r\n }\r\n map.attributionControl._esriAttributionLayerCount = map.attributionControl._esriAttributionLayerCount - 1;\r\n}\r\n\r\nexport function _setGeometry (geometry) {\r\n var params = {\r\n geometry: null,\r\n geometryType: null\r\n };\r\n\r\n // convert bounds to extent and finish\r\n if (geometry instanceof LatLngBounds) {\r\n // set geometry + geometryType\r\n params.geometry = boundsToExtent(geometry);\r\n params.geometryType = 'esriGeometryEnvelope';\r\n return params;\r\n }\r\n\r\n // convert L.Marker > L.LatLng\r\n if (geometry.getLatLng) {\r\n geometry = geometry.getLatLng();\r\n }\r\n\r\n // convert L.LatLng to a geojson point and continue;\r\n if (geometry instanceof LatLng) {\r\n geometry = {\r\n type: 'Point',\r\n coordinates: [geometry.lng, geometry.lat]\r\n };\r\n }\r\n\r\n // handle L.GeoJSON, pull out the first geometry\r\n if (geometry instanceof GeoJSON) {\r\n // reassign geometry to the GeoJSON value (we are assuming that only one feature is present)\r\n geometry = geometry.getLayers()[0].feature.geometry;\r\n params.geometry = geojsonToArcGIS(geometry);\r\n params.geometryType = geojsonTypeToArcGIS(geometry.type);\r\n }\r\n\r\n // Handle L.Polyline and L.Polygon\r\n if (geometry.toGeoJSON) {\r\n geometry = geometry.toGeoJSON();\r\n }\r\n\r\n // handle GeoJSON feature by pulling out the geometry\r\n if (geometry.type === 'Feature') {\r\n // get the geometry of the geojson feature\r\n geometry = geometry.geometry;\r\n }\r\n\r\n // confirm that our GeoJSON is a point, line or polygon\r\n if (geometry.type === 'Point' || geometry.type === 'LineString' || geometry.type === 'Polygon' || geometry.type === 'MultiPolygon') {\r\n params.geometry = geojsonToArcGIS(geometry);\r\n params.geometryType = geojsonTypeToArcGIS(geometry.type);\r\n return params;\r\n }\r\n\r\n // warn the user if we havn't found an appropriate object\r\n warn('invalid geometry passed to spatial query. Should be L.LatLng, L.LatLngBounds, L.Marker or a GeoJSON Point, Line, Polygon or MultiPolygon object');\r\n}\r\n\r\nexport function _getAttributionData (url, map) {\r\n if (Support.cors) {\r\n request(url, {}, Util.bind(function (error, attributions) {\r\n if (error) { return; }\r\n map._esriAttributions = [];\r\n for (var c = 0; c < attributions.contributors.length; c++) {\r\n var contributor = attributions.contributors[c];\r\n\r\n for (var i = 0; i < contributor.coverageAreas.length; i++) {\r\n var coverageArea = contributor.coverageAreas[i];\r\n var southWest = latLng(coverageArea.bbox[0], coverageArea.bbox[1]);\r\n var northEast = latLng(coverageArea.bbox[2], coverageArea.bbox[3]);\r\n map._esriAttributions.push({\r\n attribution: contributor.attribution,\r\n score: coverageArea.score,\r\n bounds: latLngBounds(southWest, northEast),\r\n minZoom: coverageArea.zoomMin,\r\n maxZoom: coverageArea.zoomMax\r\n });\r\n }\r\n }\r\n\r\n map._esriAttributions.sort(function (a, b) {\r\n return b.score - a.score;\r\n });\r\n\r\n // pass the same argument as the map's 'moveend' event\r\n var obj = { target: map };\r\n _updateMapAttribution(obj);\r\n }, this));\r\n }\r\n}\r\n\r\nexport function _updateMapAttribution (evt) {\r\n var map = evt.target;\r\n var oldAttributions = map._esriAttributions;\r\n\r\n if (!map || !map.attributionControl) return;\r\n\r\n var attributionElement = map.attributionControl._container.querySelector('.esri-dynamic-attribution');\r\n\r\n if (attributionElement && oldAttributions) {\r\n var newAttributions = '';\r\n var bounds = map.getBounds();\r\n var wrappedBounds = latLngBounds(\r\n bounds.getSouthWest().wrap(),\r\n bounds.getNorthEast().wrap()\r\n );\r\n var zoom = map.getZoom();\r\n\r\n for (var i = 0; i < oldAttributions.length; i++) {\r\n var attribution = oldAttributions[i];\r\n var text = attribution.attribution;\r\n\r\n if (!newAttributions.match(text) && attribution.bounds.intersects(wrappedBounds) && zoom >= attribution.minZoom && zoom <= attribution.maxZoom) {\r\n newAttributions += (', ' + text);\r\n }\r\n }\r\n\r\n newAttributions = POWERED_BY_ESRI_ATTRIBUTION_STRING + ' | ' + newAttributions.substr(2);\r\n attributionElement.innerHTML = newAttributions;\r\n attributionElement.style.maxWidth = calcAttributionWidth(map);\r\n\r\n map.fire('attributionupdated', {\r\n attribution: newAttributions\r\n });\r\n }\r\n}\r\n\r\n// for backwards compatibility\r\nexport { warn };\r\n\r\nexport var EsriUtil = {\r\n warn: warn,\r\n cleanUrl: cleanUrl,\r\n getUrlParams: getUrlParams,\r\n isArcgisOnline: isArcgisOnline,\r\n geojsonTypeToArcGIS: geojsonTypeToArcGIS,\r\n responseToFeatureCollection: responseToFeatureCollection,\r\n geojsonToArcGIS: geojsonToArcGIS,\r\n arcgisToGeoJSON: arcgisToGeoJSON,\r\n boundsToExtent: boundsToExtent,\r\n extentToBounds: extentToBounds,\r\n calcAttributionWidth: calcAttributionWidth,\r\n setEsriAttribution: setEsriAttribution,\r\n removeEsriAttribution: removeEsriAttribution,\r\n _setGeometry: _setGeometry,\r\n _getAttributionData: _getAttributionData,\r\n _updateMapAttribution: _updateMapAttribution,\r\n _findIdAttributeFromFeature: _findIdAttributeFromFeature,\r\n _findIdAttributeFromResponse: _findIdAttributeFromResponse\r\n};\r\n\r\nexport default EsriUtil;\r\n","import { Class, Util } from 'leaflet';\r\nimport { cors } from '../Support';\r\nimport { cleanUrl, getUrlParams } from '../Util';\r\nimport Request from '../Request';\r\n\r\nexport var Task = Class.extend({\r\n\r\n options: {\r\n proxy: false,\r\n useCors: cors\r\n },\r\n\r\n // Generate a method for each methodName:paramName in the setters for this task.\r\n generateSetter: function (param, context) {\r\n return Util.bind(function (value) {\r\n this.params[param] = value;\r\n return this;\r\n }, context);\r\n },\r\n\r\n initialize: function (endpoint) {\r\n // endpoint can be either a url (and options) for an ArcGIS Rest Service or an instance of EsriLeaflet.Service\r\n if (endpoint.request && endpoint.options) {\r\n this._service = endpoint;\r\n Util.setOptions(this, endpoint.options);\r\n } else {\r\n Util.setOptions(this, endpoint);\r\n this.options.url = cleanUrl(endpoint.url);\r\n }\r\n\r\n // clone default params into this object\r\n this.params = Util.extend({}, this.params || {});\r\n\r\n // generate setter methods based on the setters object implimented a child class\r\n if (this.setters) {\r\n for (var setter in this.setters) {\r\n var param = this.setters[setter];\r\n this[setter] = this.generateSetter(param, this);\r\n }\r\n }\r\n },\r\n\r\n token: function (token) {\r\n if (this._service) {\r\n this._service.authenticate(token);\r\n } else {\r\n this.params.token = token;\r\n }\r\n return this;\r\n },\r\n\r\n apikey: function (apikey) {\r\n return this.token(apikey);\r\n },\r\n\r\n // ArcGIS Server Find/Identify 10.5+\r\n format: function (boolean) {\r\n // use double negative to expose a more intuitive positive method name\r\n this.params.returnUnformattedValues = !boolean;\r\n return this;\r\n },\r\n\r\n request: function (callback, context) {\r\n if (this.options.requestParams) {\r\n Util.extend(this.params, this.options.requestParams);\r\n }\r\n if (this._service) {\r\n return this._service.request(this.path, this.params, callback, context);\r\n }\r\n\r\n return this._request('request', this.path, this.params, callback, context);\r\n },\r\n\r\n _request: function (method, path, params, callback, context) {\r\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.options.url + path : this.options.url + path;\r\n\r\n if ((method === 'get' || method === 'request') && !this.options.useCors) {\r\n return Request.get.JSONP(url, params, callback, context);\r\n }\r\n\r\n return Request[method](url, params, callback, context);\r\n }\r\n});\r\n\r\nexport function task (options) {\r\n options = getUrlParams(options);\r\n return new Task(options);\r\n}\r\n\r\nexport default task;\r\n","import { point, latLng } from 'leaflet';\r\nimport { Task } from './Task';\r\nimport {\r\n warn,\r\n responseToFeatureCollection,\r\n isArcgisOnline,\r\n extentToBounds,\r\n _setGeometry\r\n} from '../Util';\r\n\r\nexport var Query = Task.extend({\r\n setters: {\r\n offset: 'resultOffset',\r\n limit: 'resultRecordCount',\r\n fields: 'outFields',\r\n precision: 'geometryPrecision',\r\n featureIds: 'objectIds',\r\n returnGeometry: 'returnGeometry',\r\n returnM: 'returnM',\r\n transform: 'datumTransformation',\r\n token: 'token'\r\n },\r\n\r\n path: 'query',\r\n\r\n params: {\r\n returnGeometry: true,\r\n where: '1=1',\r\n outSR: 4326,\r\n outFields: '*'\r\n },\r\n\r\n // Returns a feature if its shape is wholly contained within the search geometry. Valid for all shape type combinations.\r\n within: function (geometry) {\r\n this._setGeometryParams(geometry);\r\n this.params.spatialRel = 'esriSpatialRelContains'; // to the REST api this reads geometry **contains** layer\r\n return this;\r\n },\r\n\r\n // Returns a feature if any spatial relationship is found. Applies to all shape type combinations.\r\n intersects: function (geometry) {\r\n this._setGeometryParams(geometry);\r\n this.params.spatialRel = 'esriSpatialRelIntersects';\r\n return this;\r\n },\r\n\r\n // Returns a feature if its shape wholly contains the search geometry. Valid for all shape type combinations.\r\n contains: function (geometry) {\r\n this._setGeometryParams(geometry);\r\n this.params.spatialRel = 'esriSpatialRelWithin'; // to the REST api this reads geometry **within** layer\r\n return this;\r\n },\r\n\r\n // Returns a feature if the intersection of the interiors of the two shapes is not empty and has a lower dimension than the maximum dimension of the two shapes. Two lines that share an endpoint in common do not cross. Valid for Line/Line, Line/Area, Multi-point/Area, and Multi-point/Line shape type combinations.\r\n crosses: function (geometry) {\r\n this._setGeometryParams(geometry);\r\n this.params.spatialRel = 'esriSpatialRelCrosses';\r\n return this;\r\n },\r\n\r\n // Returns a feature if the two shapes share a common boundary. However, the intersection of the interiors of the two shapes must be empty. In the Point/Line case, the point may touch an endpoint only of the line. Applies to all combinations except Point/Point.\r\n touches: function (geometry) {\r\n this._setGeometryParams(geometry);\r\n this.params.spatialRel = 'esriSpatialRelTouches';\r\n return this;\r\n },\r\n\r\n // Returns a feature if the intersection of the two shapes results in an object of the same dimension, but different from both of the shapes. Applies to Area/Area, Line/Line, and Multi-point/Multi-point shape type combinations.\r\n overlaps: function (geometry) {\r\n this._setGeometryParams(geometry);\r\n this.params.spatialRel = 'esriSpatialRelOverlaps';\r\n return this;\r\n },\r\n\r\n // Returns a feature if the envelope of the two shapes intersects.\r\n bboxIntersects: function (geometry) {\r\n this._setGeometryParams(geometry);\r\n this.params.spatialRel = 'esriSpatialRelEnvelopeIntersects';\r\n return this;\r\n },\r\n\r\n // if someone can help decipher the ArcObjects explanation and translate to plain speak, we should mention this method in the doc\r\n indexIntersects: function (geometry) {\r\n this._setGeometryParams(geometry);\r\n this.params.spatialRel = 'esriSpatialRelIndexIntersects'; // Returns a feature if the envelope of the query geometry intersects the index entry for the target geometry\r\n return this;\r\n },\r\n\r\n // only valid for Feature Services running on ArcGIS Server 10.3+ or ArcGIS Online\r\n nearby: function (latlng, radius) {\r\n latlng = latLng(latlng);\r\n this.params.geometry = [latlng.lng, latlng.lat];\r\n this.params.geometryType = 'esriGeometryPoint';\r\n this.params.spatialRel = 'esriSpatialRelIntersects';\r\n this.params.units = 'esriSRUnit_Meter';\r\n this.params.distance = radius;\r\n this.params.inSR = 4326;\r\n return this;\r\n },\r\n\r\n where: function (string) {\r\n // instead of converting double-quotes to single quotes, pass as is, and provide a more informative message if a 400 is encountered\r\n this.params.where = string;\r\n return this;\r\n },\r\n\r\n between: function (start, end) {\r\n this.params.time = [start.valueOf(), end.valueOf()];\r\n return this;\r\n },\r\n\r\n simplify: function (map, factor) {\r\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\r\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\r\n return this;\r\n },\r\n\r\n orderBy: function (fieldName, order) {\r\n order = order || 'ASC';\r\n this.params.orderByFields = (this.params.orderByFields) ? this.params.orderByFields + ',' : '';\r\n this.params.orderByFields += ([fieldName, order]).join(' ');\r\n return this;\r\n },\r\n\r\n run: function (callback, context) {\r\n this._cleanParams();\r\n\r\n // services hosted on ArcGIS Online and ArcGIS Server 10.3.1+ support requesting geojson directly\r\n if (this.options.isModern || (isArcgisOnline(this.options.url) && this.options.isModern === undefined)) {\r\n this.params.f = 'geojson';\r\n\r\n return this.request(function (error, response) {\r\n this._trapSQLerrors(error);\r\n callback.call(context, error, response, response);\r\n }, this);\r\n\r\n // otherwise convert it in the callback then pass it on\r\n } else {\r\n return this.request(function (error, response) {\r\n this._trapSQLerrors(error);\r\n callback.call(context, error, (response && responseToFeatureCollection(response)), response);\r\n }, this);\r\n }\r\n },\r\n\r\n count: function (callback, context) {\r\n this._cleanParams();\r\n this.params.returnCountOnly = true;\r\n return this.request(function (error, response) {\r\n callback.call(this, error, (response && response.count), response);\r\n }, context);\r\n },\r\n\r\n ids: function (callback, context) {\r\n this._cleanParams();\r\n this.params.returnIdsOnly = true;\r\n return this.request(function (error, response) {\r\n callback.call(this, error, (response && response.objectIds), response);\r\n }, context);\r\n },\r\n\r\n // only valid for Feature Services running on ArcGIS Server 10.3+ or ArcGIS Online\r\n bounds: function (callback, context) {\r\n this._cleanParams();\r\n this.params.returnExtentOnly = true;\r\n return this.request(function (error, response) {\r\n if (response && response.extent && extentToBounds(response.extent)) {\r\n callback.call(context, error, extentToBounds(response.extent), response);\r\n } else {\r\n error = {\r\n message: 'Invalid Bounds'\r\n };\r\n callback.call(context, error, null, response);\r\n }\r\n }, context);\r\n },\r\n\r\n distinct: function () {\r\n // geometry must be omitted for queries requesting distinct values\r\n this.params.returnGeometry = false;\r\n this.params.returnDistinctValues = true;\r\n return this;\r\n },\r\n\r\n // only valid for image services\r\n pixelSize: function (rawPoint) {\r\n var castPoint = point(rawPoint);\r\n this.params.pixelSize = [castPoint.x, castPoint.y];\r\n return this;\r\n },\r\n\r\n // only valid for map services\r\n layer: function (layer) {\r\n this.path = layer + '/query';\r\n return this;\r\n },\r\n\r\n _trapSQLerrors: function (error) {\r\n if (error) {\r\n if (error.code === '400') {\r\n warn('one common syntax error in query requests is encasing string values in double quotes instead of single quotes');\r\n }\r\n }\r\n },\r\n\r\n _cleanParams: function () {\r\n delete this.params.returnIdsOnly;\r\n delete this.params.returnExtentOnly;\r\n delete this.params.returnCountOnly;\r\n },\r\n\r\n _setGeometryParams: function (geometry) {\r\n this.params.inSR = 4326;\r\n var converted = _setGeometry(geometry);\r\n this.params.geometry = converted.geometry;\r\n this.params.geometryType = converted.geometryType;\r\n }\r\n\r\n});\r\n\r\nexport function query (options) {\r\n return new Query(options);\r\n}\r\n\r\nexport default query;\r\n","import { Task } from './Task';\r\nimport { responseToFeatureCollection } from '../Util';\r\n\r\nexport var Find = Task.extend({\r\n setters: {\r\n // method name > param name\r\n contains: 'contains',\r\n text: 'searchText',\r\n fields: 'searchFields', // denote an array or single string\r\n spatialReference: 'sr',\r\n sr: 'sr',\r\n layers: 'layers',\r\n returnGeometry: 'returnGeometry',\r\n maxAllowableOffset: 'maxAllowableOffset',\r\n precision: 'geometryPrecision',\r\n dynamicLayers: 'dynamicLayers',\r\n returnZ: 'returnZ',\r\n returnM: 'returnM',\r\n gdbVersion: 'gdbVersion',\r\n // skipped implementing this (for now) because the REST service implementation isnt consistent between operations\r\n // 'transform': 'datumTransformations',\r\n token: 'token'\r\n },\r\n\r\n path: 'find',\r\n\r\n params: {\r\n sr: 4326,\r\n contains: true,\r\n returnGeometry: true,\r\n returnZ: true,\r\n returnM: false\r\n },\r\n\r\n layerDefs: function (id, where) {\r\n this.params.layerDefs = (this.params.layerDefs) ? this.params.layerDefs + ';' : '';\r\n this.params.layerDefs += ([id, where]).join(':');\r\n return this;\r\n },\r\n\r\n simplify: function (map, factor) {\r\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\r\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\r\n return this;\r\n },\r\n\r\n run: function (callback, context) {\r\n return this.request(function (error, response) {\r\n callback.call(context, error, (response && responseToFeatureCollection(response)), response);\r\n }, context);\r\n }\r\n});\r\n\r\nexport function find (options) {\r\n return new Find(options);\r\n}\r\n\r\nexport default find;\r\n","import { Task } from './Task';\r\n\r\nexport var Identify = Task.extend({\r\n path: 'identify',\r\n\r\n between: function (start, end) {\r\n this.params.time = [start.valueOf(), end.valueOf()];\r\n return this;\r\n }\r\n});\r\n\r\nexport function identify (options) {\r\n return new Identify(options);\r\n}\r\n\r\nexport default identify;\r\n","import { latLng } from 'leaflet';\r\nimport { Identify } from './Identify';\r\nimport { responseToFeatureCollection,\r\n boundsToExtent,\r\n _setGeometry\r\n} from '../Util';\r\n\r\nexport var IdentifyFeatures = Identify.extend({\r\n setters: {\r\n layers: 'layers',\r\n precision: 'geometryPrecision',\r\n tolerance: 'tolerance',\r\n // skipped implementing this (for now) because the REST service implementation isnt consistent between operations.\r\n // 'transform': 'datumTransformations'\r\n returnGeometry: 'returnGeometry'\r\n },\r\n\r\n params: {\r\n sr: 4326,\r\n layers: 'all',\r\n tolerance: 3,\r\n returnGeometry: true\r\n },\r\n\r\n on: function (map) {\r\n var extent = boundsToExtent(map.getBounds());\r\n var size = map.getSize();\r\n this.params.imageDisplay = [size.x, size.y, 96];\r\n this.params.mapExtent = [extent.xmin, extent.ymin, extent.xmax, extent.ymax];\r\n return this;\r\n },\r\n\r\n at: function (geometry) {\r\n // cast lat, long pairs in raw array form manually\r\n if (geometry.length === 2) {\r\n geometry = latLng(geometry);\r\n }\r\n this._setGeometryParams(geometry);\r\n return this;\r\n },\r\n\r\n layerDef: function (id, where) {\r\n this.params.layerDefs = (this.params.layerDefs) ? this.params.layerDefs + ';' : '';\r\n this.params.layerDefs += ([id, where]).join(':');\r\n return this;\r\n },\r\n\r\n simplify: function (map, factor) {\r\n var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast());\r\n this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\r\n return this;\r\n },\r\n\r\n run: function (callback, context) {\r\n return this.request(function (error, response) {\r\n // immediately invoke with an error\r\n if (error) {\r\n callback.call(context, error, undefined, response);\r\n\r\n // ok no error lets just assume we have features...\r\n } else {\r\n var featureCollection = responseToFeatureCollection(response);\r\n response.results = response.results.reverse();\r\n for (var i = 0; i < featureCollection.features.length; i++) {\r\n var feature = featureCollection.features[i];\r\n feature.layerId = response.results[i].layerId;\r\n }\r\n callback.call(context, undefined, featureCollection, response);\r\n }\r\n });\r\n },\r\n\r\n _setGeometryParams: function (geometry) {\r\n var converted = _setGeometry(geometry);\r\n this.params.geometry = converted.geometry;\r\n this.params.geometryType = converted.geometryType;\r\n }\r\n});\r\n\r\nexport function identifyFeatures (options) {\r\n return new IdentifyFeatures(options);\r\n}\r\n\r\nexport default identifyFeatures;\r\n","import { latLng } from 'leaflet';\r\nimport { Identify } from './Identify';\r\nimport { responseToFeatureCollection } from '../Util';\r\n\r\nexport var IdentifyImage = Identify.extend({\r\n setters: {\r\n setMosaicRule: 'mosaicRule',\r\n setRenderingRule: 'renderingRule',\r\n setPixelSize: 'pixelSize',\r\n returnCatalogItems: 'returnCatalogItems',\r\n returnGeometry: 'returnGeometry'\r\n },\r\n\r\n params: {\r\n returnGeometry: false\r\n },\r\n\r\n at: function (latlng) {\r\n latlng = latLng(latlng);\r\n this.params.geometry = JSON.stringify({\r\n x: latlng.lng,\r\n y: latlng.lat,\r\n spatialReference: {\r\n wkid: 4326\r\n }\r\n });\r\n this.params.geometryType = 'esriGeometryPoint';\r\n return this;\r\n },\r\n\r\n getMosaicRule: function () {\r\n return this.params.mosaicRule;\r\n },\r\n\r\n getRenderingRule: function () {\r\n return this.params.renderingRule;\r\n },\r\n\r\n getPixelSize: function () {\r\n return this.params.pixelSize;\r\n },\r\n\r\n run: function (callback, context) {\r\n return this.request(function (error, response) {\r\n callback.call(context, error, (response && this._responseToGeoJSON(response)), response);\r\n }, this);\r\n },\r\n\r\n // get pixel data and return as geoJSON point\r\n // populate catalog items (if any)\r\n // merging in any catalogItemVisibilities as a propery of each feature\r\n _responseToGeoJSON: function (response) {\r\n var location = response.location;\r\n var catalogItems = response.catalogItems;\r\n var catalogItemVisibilities = response.catalogItemVisibilities;\r\n var geoJSON = {\r\n pixel: {\r\n type: 'Feature',\r\n geometry: {\r\n type: 'Point',\r\n coordinates: [location.x, location.y]\r\n },\r\n crs: {\r\n type: 'EPSG',\r\n properties: {\r\n code: location.spatialReference.wkid\r\n }\r\n },\r\n properties: {\r\n OBJECTID: response.objectId,\r\n name: response.name,\r\n value: response.value\r\n },\r\n id: response.objectId\r\n }\r\n };\r\n\r\n if (response.properties && response.properties.Values) {\r\n geoJSON.pixel.properties.values = response.properties.Values;\r\n }\r\n\r\n if (catalogItems && catalogItems.features) {\r\n geoJSON.catalogItems = responseToFeatureCollection(catalogItems);\r\n if (catalogItemVisibilities && catalogItemVisibilities.length === geoJSON.catalogItems.features.length) {\r\n for (var i = catalogItemVisibilities.length - 1; i >= 0; i--) {\r\n geoJSON.catalogItems.features[i].properties.catalogItemVisibility = catalogItemVisibilities[i];\r\n }\r\n }\r\n }\r\n return geoJSON;\r\n }\r\n\r\n});\r\n\r\nexport function identifyImage (params) {\r\n return new IdentifyImage(params);\r\n}\r\n\r\nexport default identifyImage;\r\n","import { Util, Evented } from 'leaflet';\r\nimport { cors } from '../Support';\r\nimport { cleanUrl, getUrlParams } from '../Util';\r\nimport Request from '../Request';\r\n\r\nexport var Service = Evented.extend({\r\n\r\n options: {\r\n proxy: false,\r\n useCors: cors,\r\n timeout: 0\r\n },\r\n\r\n initialize: function (options) {\r\n options = options || {};\r\n this._requestQueue = [];\r\n this._authenticating = false;\r\n Util.setOptions(this, options);\r\n this.options.url = cleanUrl(this.options.url);\r\n },\r\n\r\n get: function (path, params, callback, context) {\r\n return this._request('get', path, params, callback, context);\r\n },\r\n\r\n post: function (path, params, callback, context) {\r\n return this._request('post', path, params, callback, context);\r\n },\r\n\r\n request: function (path, params, callback, context) {\r\n return this._request('request', path, params, callback, context);\r\n },\r\n\r\n metadata: function (callback, context) {\r\n return this._request('get', '', {}, callback, context);\r\n },\r\n\r\n authenticate: function (token) {\r\n this._authenticating = false;\r\n this.options.token = token;\r\n this._runQueue();\r\n return this;\r\n },\r\n\r\n getTimeout: function () {\r\n return this.options.timeout;\r\n },\r\n\r\n setTimeout: function (timeout) {\r\n this.options.timeout = timeout;\r\n },\r\n\r\n _request: function (method, path, params, callback, context) {\r\n this.fire('requeststart', {\r\n url: this.options.url + path,\r\n params: params,\r\n method: method\r\n }, true);\r\n\r\n var wrappedCallback = this._createServiceCallback(method, path, params, callback, context);\r\n\r\n if (this.options.token) {\r\n params.token = this.options.token;\r\n }\r\n if (this.options.requestParams) {\r\n Util.extend(params, this.options.requestParams);\r\n }\r\n if (this._authenticating) {\r\n this._requestQueue.push([method, path, params, callback, context]);\r\n } else {\r\n var url = (this.options.proxy) ? this.options.proxy + '?' + this.options.url + path : this.options.url + path;\r\n\r\n if ((method === 'get' || method === 'request') && !this.options.useCors) {\r\n return Request.get.JSONP(url, params, wrappedCallback, context);\r\n } else {\r\n return Request[method](url, params, wrappedCallback, context);\r\n }\r\n }\r\n },\r\n\r\n _createServiceCallback: function (method, path, params, callback, context) {\r\n return Util.bind(function (error, response) {\r\n if (error && (error.code === 499 || error.code === 498)) {\r\n this._authenticating = true;\r\n\r\n this._requestQueue.push([method, path, params, callback, context]);\r\n\r\n // fire an event for users to handle and re-authenticate\r\n this.fire('authenticationrequired', {\r\n authenticate: Util.bind(this.authenticate, this)\r\n }, true);\r\n\r\n // if the user has access to a callback they can handle the auth error\r\n error.authenticate = Util.bind(this.authenticate, this);\r\n }\r\n\r\n callback.call(context, error, response);\r\n\r\n if (error) {\r\n this.fire('requesterror', {\r\n url: this.options.url + path,\r\n params: params,\r\n message: error.message,\r\n code: error.code,\r\n method: method\r\n }, true);\r\n } else {\r\n this.fire('requestsuccess', {\r\n url: this.options.url + path,\r\n params: params,\r\n response: response,\r\n method: method\r\n }, true);\r\n }\r\n\r\n this.fire('requestend', {\r\n url: this.options.url + path,\r\n params: params,\r\n method: method\r\n }, true);\r\n }, this);\r\n },\r\n\r\n _runQueue: function () {\r\n for (var i = this._requestQueue.length - 1; i >= 0; i--) {\r\n var request = this._requestQueue[i];\r\n var method = request.shift();\r\n this[method].apply(this, request);\r\n }\r\n this._requestQueue = [];\r\n }\r\n});\r\n\r\nexport function service (options) {\r\n options = getUrlParams(options);\r\n return new Service(options);\r\n}\r\n\r\nexport default service;\r\n","import { Service } from './Service';\r\nimport identifyFeatures from '../Tasks/IdentifyFeatures';\r\nimport query from '../Tasks/Query';\r\nimport find from '../Tasks/Find';\r\n\r\nexport var MapService = Service.extend({\r\n\r\n identify: function () {\r\n return identifyFeatures(this);\r\n },\r\n\r\n find: function () {\r\n return find(this);\r\n },\r\n\r\n query: function () {\r\n return query(this);\r\n }\r\n\r\n});\r\n\r\nexport function mapService (options) {\r\n return new MapService(options);\r\n}\r\n\r\nexport default mapService;\r\n","import { Service } from './Service';\r\nimport identifyImage from '../Tasks/IdentifyImage';\r\nimport query from '../Tasks/Query';\r\n\r\nexport var ImageService = Service.extend({\r\n\r\n query: function () {\r\n return query(this);\r\n },\r\n\r\n identify: function () {\r\n return identifyImage(this);\r\n }\r\n});\r\n\r\nexport function imageService (options) {\r\n return new ImageService(options);\r\n}\r\n\r\nexport default imageService;\r\n","import { Service } from './Service';\r\nimport query from '../Tasks/Query';\r\nimport { geojsonToArcGIS } from '../Util';\r\n\r\nexport var FeatureLayerService = Service.extend({\r\n\r\n options: {\r\n idAttribute: 'OBJECTID'\r\n },\r\n\r\n query: function () {\r\n return query(this);\r\n },\r\n\r\n addFeature: function (feature, callback, context) {\r\n this.addFeatures(feature, callback, context);\r\n },\r\n\r\n addFeatures: function (features, callback, context) {\r\n var featuresArray = features.features ? features.features : [features];\r\n for (var i = featuresArray.length - 1; i >= 0; i--) {\r\n delete featuresArray[i].id;\r\n }\r\n features = geojsonToArcGIS(features);\r\n features = featuresArray.length > 1 ? features : [features];\r\n return this.post('addFeatures', {\r\n features: features\r\n }, function (error, response) {\r\n // For compatibility reason with former addFeature function,\r\n // we return the object in the array and not the array itself\r\n var result = (response && response.addResults) ? response.addResults.length > 1 ? response.addResults : response.addResults[0] : undefined;\r\n if (callback) {\r\n callback.call(context, error || response.addResults[0].error, result);\r\n }\r\n }, context);\r\n },\r\n\r\n updateFeature: function (feature, callback, context) {\r\n this.updateFeatures(feature, callback, context);\r\n },\r\n\r\n updateFeatures: function (features, callback, context) {\r\n var featuresArray = features.features ? features.features : [features];\r\n features = geojsonToArcGIS(features, this.options.idAttribute);\r\n features = featuresArray.length > 1 ? features : [features];\r\n\r\n return this.post('updateFeatures', {\r\n features: features\r\n }, function (error, response) {\r\n // For compatibility reason with former updateFeature function,\r\n // we return the object in the array and not the array itself\r\n var result = (response && response.updateResults) ? response.updateResults.length > 1 ? response.updateResults : response.updateResults[0] : undefined;\r\n if (callback) {\r\n callback.call(context, error || response.updateResults[0].error, result);\r\n }\r\n }, context);\r\n },\r\n\r\n deleteFeature: function (id, callback, context) {\r\n this.deleteFeatures(id, callback, context);\r\n },\r\n\r\n deleteFeatures: function (ids, callback, context) {\r\n return this.post('deleteFeatures', {\r\n objectIds: ids\r\n }, function (error, response) {\r\n // For compatibility reason with former deleteFeature function,\r\n // we return the object in the array and not the array itself\r\n var result = (response && response.deleteResults) ? response.deleteResults.length > 1 ? response.deleteResults : response.deleteResults[0] : undefined;\r\n if (callback) {\r\n callback.call(context, error || response.deleteResults[0].error, result);\r\n }\r\n }, context);\r\n }\r\n});\r\n\r\nexport function featureLayerService (options) {\r\n return new FeatureLayerService(options);\r\n}\r\n\r\nexport default featureLayerService;\r\n","import { TileLayer, Util } from 'leaflet';\r\nimport { pointerEvents } from '../Support';\r\nimport {\r\n setEsriAttribution,\r\n removeEsriAttribution,\r\n _getAttributionData,\r\n _updateMapAttribution\r\n} from '../Util';\r\n\r\nvar tileProtocol = (window.location.protocol !== 'https:') ? 'http:' : 'https:';\r\n\r\nexport var BasemapLayer = TileLayer.extend({\r\n statics: {\r\n TILES: {\r\n Streets: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 19,\r\n subdomains: ['server', 'services'],\r\n attribution: 'USGS, NOAA',\r\n attributionUrl: 'https://static.arcgis.com/attribution/World_Street_Map'\r\n }\r\n },\r\n Topographic: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 19,\r\n subdomains: ['server', 'services'],\r\n attribution: 'USGS, NOAA',\r\n attributionUrl: 'https://static.arcgis.com/attribution/World_Topo_Map'\r\n }\r\n },\r\n Oceans: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 16,\r\n subdomains: ['server', 'services'],\r\n attribution: 'USGS, NOAA',\r\n attributionUrl: 'https://static.arcgis.com/attribution/Ocean_Basemap'\r\n }\r\n },\r\n OceansLabels: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 16,\r\n subdomains: ['server', 'services'],\r\n pane: (pointerEvents) ? 'esri-labels' : 'tilePane',\r\n attribution: ''\r\n }\r\n },\r\n NationalGeographic: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 16,\r\n subdomains: ['server', 'services'],\r\n attribution: 'National Geographic, DeLorme, HERE, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, increment P Corp.'\r\n }\r\n },\r\n DarkGray: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 16,\r\n subdomains: ['server', 'services'],\r\n attribution: 'HERE, DeLorme, MapmyIndia, © OpenStreetMap contributors'\r\n }\r\n },\r\n DarkGrayLabels: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Reference/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 16,\r\n subdomains: ['server', 'services'],\r\n pane: (pointerEvents) ? 'esri-labels' : 'tilePane',\r\n attribution: ''\r\n\r\n }\r\n },\r\n Gray: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 16,\r\n subdomains: ['server', 'services'],\r\n attribution: 'HERE, DeLorme, MapmyIndia, © OpenStreetMap contributors'\r\n }\r\n },\r\n GrayLabels: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 16,\r\n subdomains: ['server', 'services'],\r\n pane: (pointerEvents) ? 'esri-labels' : 'tilePane',\r\n attribution: ''\r\n }\r\n },\r\n Imagery: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 19,\r\n subdomains: ['server', 'services'],\r\n attribution: 'DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community',\r\n attributionUrl: 'https://static.arcgis.com/attribution/World_Imagery'\r\n }\r\n },\r\n ImageryLabels: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 19,\r\n subdomains: ['server', 'services'],\r\n pane: (pointerEvents) ? 'esri-labels' : 'tilePane',\r\n attribution: ''\r\n }\r\n },\r\n ImageryTransportation: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 19,\r\n subdomains: ['server', 'services'],\r\n pane: (pointerEvents) ? 'esri-labels' : 'tilePane',\r\n attribution: ''\r\n }\r\n },\r\n ShadedRelief: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 13,\r\n subdomains: ['server', 'services'],\r\n attribution: 'USGS'\r\n }\r\n },\r\n ShadedReliefLabels: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 12,\r\n subdomains: ['server', 'services'],\r\n pane: (pointerEvents) ? 'esri-labels' : 'tilePane',\r\n attribution: ''\r\n }\r\n },\r\n Terrain: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 13,\r\n subdomains: ['server', 'services'],\r\n attribution: 'USGS, NOAA'\r\n }\r\n },\r\n TerrainLabels: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 13,\r\n subdomains: ['server', 'services'],\r\n pane: (pointerEvents) ? 'esri-labels' : 'tilePane',\r\n attribution: ''\r\n }\r\n },\r\n USATopo: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 15,\r\n subdomains: ['server', 'services'],\r\n attribution: 'USGS, National Geographic Society, i-cubed'\r\n }\r\n },\r\n ImageryClarity: {\r\n urlTemplate: tileProtocol + '//clarity.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 19,\r\n attribution: 'Esri, DigitalGlobe, GeoEye, Earthstar Geographics, CNES/Airbus DS, USDA, USGS, AeroGRID, IGN, and the GIS User Community'\r\n }\r\n },\r\n Physical: {\r\n urlTemplate: tileProtocol + '//{s}.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 8,\r\n subdomains: ['server', 'services'],\r\n attribution: 'U.S. National Park Service'\r\n }\r\n },\r\n ImageryFirefly: {\r\n urlTemplate: tileProtocol + '//fly.maptiles.arcgis.com/arcgis/rest/services/World_Imagery_Firefly/MapServer/tile/{z}/{y}/{x}',\r\n options: {\r\n minZoom: 1,\r\n maxZoom: 19,\r\n attribution: 'Esri, DigitalGlobe, GeoEye, Earthstar Geographics, CNES/Airbus DS, USDA, USGS, AeroGRID, IGN, and the GIS User Community',\r\n attributionUrl: 'https://static.arcgis.com/attribution/World_Imagery'\r\n }\r\n }\r\n }\r\n },\r\n\r\n initialize: function (key, options) {\r\n var config;\r\n\r\n // set the config variable with the appropriate config object\r\n if (typeof key === 'object' && key.urlTemplate && key.options) {\r\n config = key;\r\n } else if (typeof key === 'string' && BasemapLayer.TILES[key]) {\r\n config = BasemapLayer.TILES[key];\r\n } else {\r\n throw new Error('L.esri.BasemapLayer: Invalid parameter. Use one of \"Streets\", \"Topographic\", \"Oceans\", \"OceansLabels\", \"NationalGeographic\", \"Physical\", \"Gray\", \"GrayLabels\", \"DarkGray\", \"DarkGrayLabels\", \"Imagery\", \"ImageryLabels\", \"ImageryTransportation\", \"ImageryClarity\", \"ImageryFirefly\", ShadedRelief\", \"ShadedReliefLabels\", \"Terrain\", \"TerrainLabels\" or \"USATopo\"');\r\n }\r\n\r\n // merge passed options into the config options\r\n var tileOptions = Util.extend(config.options, options);\r\n\r\n Util.setOptions(this, tileOptions);\r\n\r\n // Deprecation notice:\r\n if (!this.options.ignoreDeprecationWarning) {\r\n console.warn('WARNING: L.esri.BasemapLayer uses data services that are in mature support and are not being updated. Please use L.esri.Vector.vectorBasemapLayer instead. More info: https://esriurl.com/esri-leaflet-basemap');\r\n }\r\n\r\n if (this.options.token && config.urlTemplate.indexOf('token=') === -1) {\r\n config.urlTemplate += ('?token=' + this.options.token);\r\n }\r\n if (this.options.proxy) {\r\n config.urlTemplate = this.options.proxy + '?' + config.urlTemplate;\r\n }\r\n\r\n // call the initialize method on L.TileLayer to set everything up\r\n TileLayer.prototype.initialize.call(this, config.urlTemplate, tileOptions);\r\n },\r\n\r\n onAdd: function (map) {\r\n // include 'Powered by Esri' in map attribution\r\n setEsriAttribution(map);\r\n\r\n if (this.options.pane === 'esri-labels') {\r\n this._initPane();\r\n }\r\n // some basemaps can supply dynamic attribution\r\n if (this.options.attributionUrl) {\r\n _getAttributionData((this.options.proxy ? this.options.proxy + '?' : '') + this.options.attributionUrl, map);\r\n }\r\n\r\n map.on('moveend', _updateMapAttribution);\r\n\r\n TileLayer.prototype.onAdd.call(this, map);\r\n },\r\n\r\n onRemove: function (map) {\r\n removeEsriAttribution(map);\r\n\r\n map.off('moveend', _updateMapAttribution);\r\n\r\n TileLayer.prototype.onRemove.call(this, map);\r\n },\r\n\r\n _initPane: function () {\r\n if (!this._map.getPane(this.options.pane)) {\r\n var pane = this._map.createPane(this.options.pane);\r\n pane.style.pointerEvents = 'none';\r\n pane.style.zIndex = 500;\r\n }\r\n },\r\n\r\n getAttribution: function () {\r\n if (this.options.attribution) {\r\n var attribution = '' + this.options.attribution + '';\r\n }\r\n return attribution;\r\n }\r\n});\r\n\r\nexport function basemapLayer (key, options) {\r\n return new BasemapLayer(key, options);\r\n}\r\n\r\nexport default basemapLayer;\r\n","import { CRS, DomEvent, TileLayer, Util } from 'leaflet';\r\nimport { warn, getUrlParams, setEsriAttribution, removeEsriAttribution } from '../Util';\r\nimport mapService from '../Services/MapService';\r\n\r\nexport var TiledMapLayer = TileLayer.extend({\r\n options: {\r\n zoomOffsetAllowance: 0.1,\r\n errorTileUrl: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEABAMAAACuXLVVAAAAA1BMVEUzNDVszlHHAAAAAXRSTlMAQObYZgAAAAlwSFlzAAAAAAAAAAAB6mUWpAAAADZJREFUeJztwQEBAAAAgiD/r25IQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7waBAAABw08RwAAAAABJRU5ErkJggg=='\r\n },\r\n\r\n statics: {\r\n MercatorZoomLevels: {\r\n 0: 156543.03392799999,\r\n 1: 78271.516963999893,\r\n 2: 39135.758482000099,\r\n 3: 19567.879240999901,\r\n 4: 9783.9396204999593,\r\n 5: 4891.9698102499797,\r\n 6: 2445.9849051249898,\r\n 7: 1222.9924525624899,\r\n 8: 611.49622628138002,\r\n 9: 305.74811314055802,\r\n 10: 152.874056570411,\r\n 11: 76.437028285073197,\r\n 12: 38.218514142536598,\r\n 13: 19.109257071268299,\r\n 14: 9.5546285356341496,\r\n 15: 4.7773142679493699,\r\n 16: 2.38865713397468,\r\n 17: 1.1943285668550501,\r\n 18: 0.59716428355981699,\r\n 19: 0.29858214164761698,\r\n 20: 0.14929107082381,\r\n 21: 0.07464553541191,\r\n 22: 0.0373227677059525,\r\n 23: 0.0186613838529763\r\n }\r\n },\r\n\r\n initialize: function (options) {\r\n options = Util.setOptions(this, options);\r\n\r\n // set the urls\r\n options = getUrlParams(options);\r\n this.tileUrl = (options.proxy ? options.proxy + '?' : '') + options.url + 'tile/{z}/{y}/{x}' + (options.requestParams && Object.keys(options.requestParams).length > 0 ? Util.getParamString(options.requestParams) : '');\r\n // Remove subdomain in url\r\n // https://github.com/Esri/esri-leaflet/issues/991\r\n if (options.url.indexOf('{s}') !== -1 && options.subdomains) {\r\n options.url = options.url.replace('{s}', options.subdomains[0]);\r\n }\r\n this.service = mapService(options);\r\n this.service.addEventParent(this);\r\n\r\n var arcgisonline = new RegExp(/tiles.arcgis(online)?\\.com/g);\r\n if (arcgisonline.test(options.url)) {\r\n this.tileUrl = this.tileUrl.replace('://tiles', '://tiles{s}');\r\n options.subdomains = ['1', '2', '3', '4'];\r\n }\r\n\r\n if (this.options.token) {\r\n this.tileUrl += ('?token=' + this.options.token);\r\n }\r\n\r\n // init layer by calling TileLayers initialize method\r\n TileLayer.prototype.initialize.call(this, this.tileUrl, options);\r\n },\r\n\r\n getTileUrl: function (tilePoint) {\r\n var zoom = this._getZoomForUrl();\r\n\r\n return Util.template(this.tileUrl, Util.extend({\r\n s: this._getSubdomain(tilePoint),\r\n x: tilePoint.x,\r\n y: tilePoint.y,\r\n // try lod map first, then just default to zoom level\r\n z: (this._lodMap && this._lodMap[zoom] !== undefined) ? this._lodMap[zoom] : zoom\r\n }, this.options));\r\n },\r\n\r\n createTile: function (coords, done) {\r\n var tile = document.createElement('img');\r\n\r\n DomEvent.on(tile, 'load', Util.bind(this._tileOnLoad, this, done, tile));\r\n DomEvent.on(tile, 'error', Util.bind(this._tileOnError, this, done, tile));\r\n\r\n if (this.options.crossOrigin) {\r\n tile.crossOrigin = '';\r\n }\r\n\r\n /*\r\n Alt tag is set to empty string to keep screen readers from reading URL and for compliance reasons\r\n http://www.w3.org/TR/WCAG20-TECHS/H67\r\n */\r\n tile.alt = '';\r\n\r\n // if there is no lod map or an lod map with a proper zoom load the tile\r\n // otherwise wait for the lod map to become available\r\n if (!this._lodMap || (this._lodMap && this._lodMap[this._getZoomForUrl()] !== undefined)) {\r\n tile.src = this.getTileUrl(coords);\r\n } else {\r\n this.once('lodmap', function () {\r\n tile.src = this.getTileUrl(coords);\r\n }, this);\r\n }\r\n\r\n return tile;\r\n },\r\n\r\n onAdd: function (map) {\r\n // include 'Powered by Esri' in map attribution\r\n setEsriAttribution(map);\r\n\r\n if (!this._lodMap) {\r\n this.metadata(function (error, metadata) {\r\n if (!error && metadata.spatialReference) {\r\n var sr = metadata.spatialReference.latestWkid || metadata.spatialReference.wkid;\r\n // display the copyright text from the service using leaflet's attribution control\r\n if (!this.options.attribution && map.attributionControl && metadata.copyrightText) {\r\n this.options.attribution = metadata.copyrightText;\r\n map.attributionControl.addAttribution(this.getAttribution());\r\n }\r\n\r\n // if the service tiles were published in web mercator using conventional LODs but missing levels, we can try and remap them\r\n if (map.options.crs === CRS.EPSG3857 && (sr === 102100 || sr === 3857)) {\r\n this._lodMap = {};\r\n // create the zoom level data\r\n var arcgisLODs = metadata.tileInfo.lods;\r\n var correctResolutions = TiledMapLayer.MercatorZoomLevels;\r\n\r\n for (var i = 0; i < arcgisLODs.length; i++) {\r\n var arcgisLOD = arcgisLODs[i];\r\n for (var ci in correctResolutions) {\r\n var correctRes = correctResolutions[ci];\r\n\r\n if (this._withinPercentage(arcgisLOD.resolution, correctRes, this.options.zoomOffsetAllowance)) {\r\n this._lodMap[ci] = arcgisLOD.level;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n this.fire('lodmap');\r\n } else if (map.options.crs && map.options.crs.code && (map.options.crs.code.indexOf(sr) > -1)) {\r\n // if the projection is WGS84, or the developer is using Proj4 to define a custom CRS, no action is required\r\n } else {\r\n // if the service was cached in a custom projection and an appropriate LOD hasn't been defined in the map, guide the developer to our Proj4 sample\r\n warn('L.esri.TiledMapLayer is using a non-mercator spatial reference. Support may be available through Proj4Leaflet https://developers.arcgis.com/esri-leaflet/samples/non-mercator-projection/');\r\n }\r\n }\r\n }, this);\r\n }\r\n\r\n TileLayer.prototype.onAdd.call(this, map);\r\n },\r\n\r\n onRemove: function (map) {\r\n removeEsriAttribution(map);\r\n\r\n TileLayer.prototype.onRemove.call(this, map);\r\n },\r\n\r\n metadata: function (callback, context) {\r\n this.service.metadata(callback, context);\r\n return this;\r\n },\r\n\r\n identify: function () {\r\n return this.service.identify();\r\n },\r\n\r\n find: function () {\r\n return this.service.find();\r\n },\r\n\r\n query: function () {\r\n return this.service.query();\r\n },\r\n\r\n authenticate: function (token) {\r\n var tokenQs = '?token=' + token;\r\n this.tileUrl = (this.options.token) ? this.tileUrl.replace(/\\?token=(.+)/g, tokenQs) : this.tileUrl + tokenQs;\r\n this.options.token = token;\r\n this.service.authenticate(token);\r\n return this;\r\n },\r\n\r\n _withinPercentage: function (a, b, percentage) {\r\n var diff = Math.abs((a / b) - 1);\r\n return diff < percentage;\r\n }\r\n});\r\n\r\nexport function tiledMapLayer (url, options) {\r\n return new TiledMapLayer(url, options);\r\n}\r\n\r\nexport default tiledMapLayer;\r\n","import { ImageOverlay, CRS, DomUtil, Util, Layer, popup, latLng, bounds } from 'leaflet';\r\nimport { cors } from '../Support';\r\nimport { setEsriAttribution, removeEsriAttribution } from '../Util';\r\n\r\nvar Overlay = ImageOverlay.extend({\r\n onAdd: function (map) {\r\n this._topLeft = map.getPixelBounds().min;\r\n ImageOverlay.prototype.onAdd.call(this, map);\r\n },\r\n _reset: function () {\r\n if (this._map.options.crs === CRS.EPSG3857) {\r\n ImageOverlay.prototype._reset.call(this);\r\n } else {\r\n DomUtil.setPosition(this._image, this._topLeft.subtract(this._map.getPixelOrigin()));\r\n }\r\n }\r\n});\r\n\r\nexport var RasterLayer = Layer.extend({\r\n options: {\r\n opacity: 1,\r\n position: 'front',\r\n f: 'image',\r\n useCors: cors,\r\n attribution: null,\r\n interactive: false,\r\n alt: ''\r\n },\r\n\r\n onAdd: function (map) {\r\n // include 'Powered by Esri' in map attribution\r\n setEsriAttribution(map);\r\n\r\n if (this.options.zIndex) {\r\n this.options.position = null;\r\n }\r\n\r\n this._update = Util.throttle(this._update, this.options.updateInterval, this);\r\n\r\n map.on('moveend', this._update, this);\r\n\r\n // if we had an image loaded and it matches the\r\n // current bounds show the image otherwise remove it\r\n if (this._currentImage && this._currentImage._bounds.equals(this._map.getBounds())) {\r\n map.addLayer(this._currentImage);\r\n } else if (this._currentImage) {\r\n this._map.removeLayer(this._currentImage);\r\n this._currentImage = null;\r\n }\r\n\r\n this._update();\r\n\r\n if (this._popup) {\r\n this._map.on('click', this._getPopupData, this);\r\n this._map.on('dblclick', this._resetPopupState, this);\r\n }\r\n\r\n // add copyright text listed in service metadata\r\n this.metadata(function (err, metadata) {\r\n if (!err && !this.options.attribution && map.attributionControl && metadata.copyrightText) {\r\n this.options.attribution = metadata.copyrightText;\r\n map.attributionControl.addAttribution(this.getAttribution());\r\n }\r\n }, this);\r\n },\r\n\r\n onRemove: function (map) {\r\n removeEsriAttribution(map);\r\n\r\n if (this._currentImage) {\r\n this._map.removeLayer(this._currentImage);\r\n }\r\n\r\n if (this._popup) {\r\n this._map.off('click', this._getPopupData, this);\r\n this._map.off('dblclick', this._resetPopupState, this);\r\n }\r\n\r\n this._map.off('moveend', this._update, this);\r\n },\r\n\r\n bindPopup: function (fn, popupOptions) {\r\n this._shouldRenderPopup = false;\r\n this._lastClick = false;\r\n this._popup = popup(popupOptions);\r\n this._popupFunction = fn;\r\n if (this._map) {\r\n this._map.on('click', this._getPopupData, this);\r\n this._map.on('dblclick', this._resetPopupState, this);\r\n }\r\n return this;\r\n },\r\n\r\n unbindPopup: function () {\r\n if (this._map) {\r\n this._map.closePopup(this._popup);\r\n this._map.off('click', this._getPopupData, this);\r\n this._map.off('dblclick', this._resetPopupState, this);\r\n }\r\n this._popup = false;\r\n return this;\r\n },\r\n\r\n bringToFront: function () {\r\n this.options.position = 'front';\r\n if (this._currentImage) {\r\n this._currentImage.bringToFront();\r\n this._setAutoZIndex(Math.max);\r\n }\r\n return this;\r\n },\r\n\r\n bringToBack: function () {\r\n this.options.position = 'back';\r\n if (this._currentImage) {\r\n this._currentImage.bringToBack();\r\n this._setAutoZIndex(Math.min);\r\n }\r\n return this;\r\n },\r\n\r\n setZIndex: function (value) {\r\n this.options.zIndex = value;\r\n if (this._currentImage) {\r\n this._currentImage.setZIndex(value);\r\n }\r\n return this;\r\n },\r\n\r\n _setAutoZIndex: function (compare) {\r\n // go through all other layers of the same pane, set zIndex to max + 1 (front) or min - 1 (back)\r\n if (!this._currentImage) {\r\n return;\r\n }\r\n var layers = this._currentImage.getPane().children;\r\n var edgeZIndex = -compare(-Infinity, Infinity); // -Infinity for max, Infinity for min\r\n for (var i = 0, len = layers.length, zIndex; i < len; i++) {\r\n zIndex = layers[i].style.zIndex;\r\n if (layers[i] !== this._currentImage._image && zIndex) {\r\n edgeZIndex = compare(edgeZIndex, +zIndex);\r\n }\r\n }\r\n\r\n if (isFinite(edgeZIndex)) {\r\n this.options.zIndex = edgeZIndex + compare(-1, 1);\r\n this.setZIndex(this.options.zIndex);\r\n }\r\n },\r\n\r\n getAttribution: function () {\r\n return this.options.attribution;\r\n },\r\n\r\n getOpacity: function () {\r\n return this.options.opacity;\r\n },\r\n\r\n setOpacity: function (opacity) {\r\n this.options.opacity = opacity;\r\n if (this._currentImage) {\r\n this._currentImage.setOpacity(opacity);\r\n }\r\n return this;\r\n },\r\n\r\n getTimeRange: function () {\r\n return [this.options.from, this.options.to];\r\n },\r\n\r\n setTimeRange: function (from, to) {\r\n this.options.from = from;\r\n this.options.to = to;\r\n this._update();\r\n return this;\r\n },\r\n\r\n metadata: function (callback, context) {\r\n this.service.metadata(callback, context);\r\n return this;\r\n },\r\n\r\n authenticate: function (token) {\r\n this.service.authenticate(token);\r\n return this;\r\n },\r\n\r\n redraw: function () {\r\n this._update();\r\n },\r\n\r\n _renderImage: function (url, bounds, contentType) {\r\n if (this._map) {\r\n // if no output directory has been specified for a service, MIME data will be returned\r\n if (contentType) {\r\n url = 'data:' + contentType + ';base64,' + url;\r\n }\r\n\r\n // if server returns an inappropriate response, abort.\r\n if (!url) return;\r\n\r\n // create a new image overlay and add it to the map\r\n // to start loading the image\r\n // opacity is 0 while the image is loading\r\n var image = new Overlay(url, bounds, {\r\n opacity: 0,\r\n crossOrigin: this.options.withCredentials ? 'use-credentials' : this.options.useCors,\r\n alt: this.options.alt,\r\n pane: this.options.pane || this.getPane(),\r\n interactive: this.options.interactive\r\n }).addTo(this._map);\r\n\r\n var onOverlayError = function () {\r\n this._map.removeLayer(image);\r\n this.fire('error');\r\n image.off('load', onOverlayLoad, this);\r\n };\r\n\r\n var onOverlayLoad = function (e) {\r\n image.off('error', onOverlayError, this);\r\n if (this._map) {\r\n var newImage = e.target;\r\n var oldImage = this._currentImage;\r\n\r\n // if the bounds of this image matches the bounds that\r\n // _renderImage was called with and we have a map with the same bounds\r\n // hide the old image if there is one and set the opacity\r\n // of the new image otherwise remove the new image\r\n if (newImage._bounds.equals(bounds) && newImage._bounds.equals(this._map.getBounds())) {\r\n this._currentImage = newImage;\r\n\r\n if (this.options.position === 'front') {\r\n this.bringToFront();\r\n } else if (this.options.position === 'back') {\r\n this.bringToBack();\r\n }\r\n\r\n if (this.options.zIndex) {\r\n this.setZIndex(this.options.zIndex);\r\n }\r\n\r\n if (this._map && this._currentImage._map) {\r\n this._currentImage.setOpacity(this.options.opacity);\r\n } else {\r\n this._currentImage._map.removeLayer(this._currentImage);\r\n }\r\n\r\n if (oldImage && this._map) {\r\n this._map.removeLayer(oldImage);\r\n }\r\n\r\n if (oldImage && oldImage._map) {\r\n oldImage._map.removeLayer(oldImage);\r\n }\r\n } else {\r\n this._map.removeLayer(newImage);\r\n }\r\n }\r\n\r\n this.fire('load', {\r\n bounds: bounds\r\n });\r\n };\r\n\r\n // If loading the image fails\r\n image.once('error', onOverlayError, this);\r\n\r\n // once the image loads\r\n image.once('load', onOverlayLoad, this);\r\n }\r\n },\r\n\r\n _update: function () {\r\n if (!this._map) {\r\n return;\r\n }\r\n\r\n var zoom = this._map.getZoom();\r\n var bounds = this._map.getBounds();\r\n\r\n if (this._animatingZoom) {\r\n return;\r\n }\r\n\r\n if (this._map._panTransition && this._map._panTransition._inProgress) {\r\n return;\r\n }\r\n\r\n if (zoom > this.options.maxZoom || zoom < this.options.minZoom) {\r\n if (this._currentImage) {\r\n this._currentImage._map.removeLayer(this._currentImage);\r\n this._currentImage = null;\r\n }\r\n return;\r\n }\r\n\r\n var params = this._buildExportParams();\r\n Util.extend(params, this.options.requestParams);\r\n\r\n if (params) {\r\n this._requestExport(params, bounds);\r\n\r\n this.fire('loading', {\r\n bounds: bounds\r\n });\r\n } else if (this._currentImage) {\r\n this._currentImage._map.removeLayer(this._currentImage);\r\n this._currentImage = null;\r\n }\r\n },\r\n\r\n _renderPopup: function (latlng, error, results, response) {\r\n latlng = latLng(latlng);\r\n if (this._shouldRenderPopup && this._lastClick.equals(latlng)) {\r\n // add the popup to the map where the mouse was clicked at\r\n var content = this._popupFunction(error, results, response);\r\n if (content) {\r\n this._popup.setLatLng(latlng).setContent(content).openOn(this._map);\r\n }\r\n }\r\n },\r\n\r\n _resetPopupState: function (e) {\r\n this._shouldRenderPopup = false;\r\n this._lastClick = e.latlng;\r\n },\r\n\r\n _calculateBbox: function () {\r\n var pixelBounds = this._map.getPixelBounds();\r\n\r\n var sw = this._map.unproject(pixelBounds.getBottomLeft());\r\n var ne = this._map.unproject(pixelBounds.getTopRight());\r\n\r\n var neProjected = this._map.options.crs.project(ne);\r\n var swProjected = this._map.options.crs.project(sw);\r\n\r\n // this ensures ne/sw are switched in polar maps where north/top bottom/south is inverted\r\n var boundsProjected = bounds(neProjected, swProjected);\r\n\r\n return [boundsProjected.getBottomLeft().x, boundsProjected.getBottomLeft().y, boundsProjected.getTopRight().x, boundsProjected.getTopRight().y].join(',');\r\n },\r\n\r\n _calculateImageSize: function () {\r\n // ensure that we don't ask ArcGIS Server for a taller image than we have actual map displaying within the div\r\n var bounds = this._map.getPixelBounds();\r\n var size = this._map.getSize();\r\n\r\n var sw = this._map.unproject(bounds.getBottomLeft());\r\n var ne = this._map.unproject(bounds.getTopRight());\r\n\r\n var top = this._map.latLngToLayerPoint(ne).y;\r\n var bottom = this._map.latLngToLayerPoint(sw).y;\r\n\r\n if (top > 0 || bottom < size.y) {\r\n size.y = bottom - top;\r\n }\r\n\r\n return size.x + ',' + size.y;\r\n }\r\n});\r\n","import { Util } from 'leaflet';\r\nimport { RasterLayer } from './RasterLayer';\r\nimport { getUrlParams } from '../Util';\r\nimport imageService from '../Services/ImageService';\r\n\r\nexport var ImageMapLayer = RasterLayer.extend({\r\n\r\n options: {\r\n updateInterval: 150,\r\n format: 'jpgpng',\r\n transparent: true,\r\n f: 'image'\r\n },\r\n\r\n query: function () {\r\n return this.service.query();\r\n },\r\n\r\n identify: function () {\r\n return this.service.identify();\r\n },\r\n\r\n initialize: function (options) {\r\n options = getUrlParams(options);\r\n this.service = imageService(options);\r\n this.service.addEventParent(this);\r\n\r\n Util.setOptions(this, options);\r\n },\r\n\r\n setPixelType: function (pixelType) {\r\n this.options.pixelType = pixelType;\r\n this._update();\r\n return this;\r\n },\r\n\r\n getPixelType: function () {\r\n return this.options.pixelType;\r\n },\r\n\r\n setBandIds: function (bandIds) {\r\n if (Util.isArray(bandIds)) {\r\n this.options.bandIds = bandIds.join(',');\r\n } else {\r\n this.options.bandIds = bandIds.toString();\r\n }\r\n this._update();\r\n return this;\r\n },\r\n\r\n getBandIds: function () {\r\n return this.options.bandIds;\r\n },\r\n\r\n setNoData: function (noData, noDataInterpretation) {\r\n if (Util.isArray(noData)) {\r\n this.options.noData = noData.join(',');\r\n } else {\r\n this.options.noData = noData.toString();\r\n }\r\n if (noDataInterpretation) {\r\n this.options.noDataInterpretation = noDataInterpretation;\r\n }\r\n this._update();\r\n return this;\r\n },\r\n\r\n getNoData: function () {\r\n return this.options.noData;\r\n },\r\n\r\n getNoDataInterpretation: function () {\r\n return this.options.noDataInterpretation;\r\n },\r\n\r\n setRenderingRule: function (renderingRule) {\r\n this.options.renderingRule = renderingRule;\r\n this._update();\r\n },\r\n\r\n getRenderingRule: function () {\r\n return this.options.renderingRule;\r\n },\r\n\r\n setMosaicRule: function (mosaicRule) {\r\n this.options.mosaicRule = mosaicRule;\r\n this._update();\r\n },\r\n\r\n getMosaicRule: function () {\r\n return this.options.mosaicRule;\r\n },\r\n\r\n _getPopupData: function (e) {\r\n var callback = Util.bind(function (error, results, response) {\r\n if (error) { return; } // we really can't do anything here but authenticate or requesterror will fire\r\n setTimeout(Util.bind(function () {\r\n this._renderPopup(e.latlng, error, results, response);\r\n }, this), 300);\r\n }, this);\r\n\r\n var identifyRequest = this.identify().at(e.latlng);\r\n\r\n // set mosaic rule for identify task if it is set for layer\r\n if (this.options.mosaicRule) {\r\n identifyRequest.setMosaicRule(this.options.mosaicRule);\r\n // @TODO: force return catalog items too?\r\n }\r\n\r\n // @TODO: set rendering rule? Not sure,\r\n // sometimes you want raw pixel values\r\n // if (this.options.renderingRule) {\r\n // identifyRequest.setRenderingRule(this.options.renderingRule);\r\n // }\r\n\r\n identifyRequest.run(callback);\r\n\r\n // set the flags to show the popup\r\n this._shouldRenderPopup = true;\r\n this._lastClick = e.latlng;\r\n },\r\n\r\n _buildExportParams: function () {\r\n var sr = parseInt(this._map.options.crs.code.split(':')[1], 10);\r\n\r\n var params = {\r\n bbox: this._calculateBbox(),\r\n size: this._calculateImageSize(),\r\n format: this.options.format,\r\n transparent: this.options.transparent,\r\n bboxSR: sr,\r\n imageSR: sr\r\n };\r\n\r\n if (this.options.from && this.options.to) {\r\n params.time = this.options.from.valueOf() + ',' + this.options.to.valueOf();\r\n }\r\n\r\n if (this.options.pixelType) {\r\n params.pixelType = this.options.pixelType;\r\n }\r\n\r\n if (this.options.interpolation) {\r\n params.interpolation = this.options.interpolation;\r\n }\r\n\r\n if (this.options.compressionQuality) {\r\n params.compressionQuality = this.options.compressionQuality;\r\n }\r\n\r\n if (this.options.bandIds) {\r\n params.bandIds = this.options.bandIds;\r\n }\r\n\r\n // 0 is falsy *and* a valid input parameter\r\n if (this.options.noData === 0 || this.options.noData) {\r\n params.noData = this.options.noData;\r\n }\r\n\r\n if (this.options.noDataInterpretation) {\r\n params.noDataInterpretation = this.options.noDataInterpretation;\r\n }\r\n\r\n if (this.service.options.token) {\r\n params.token = this.service.options.token;\r\n }\r\n\r\n if (this.options.renderingRule) {\r\n params.renderingRule = JSON.stringify(this.options.renderingRule);\r\n }\r\n\r\n if (this.options.mosaicRule) {\r\n params.mosaicRule = JSON.stringify(this.options.mosaicRule);\r\n }\r\n\r\n return params;\r\n },\r\n\r\n _requestExport: function (params, bounds) {\r\n if (this.options.f === 'json') {\r\n this.service.request('exportImage', params, function (error, response) {\r\n if (error) { return; } // we really can't do anything here but authenticate or requesterror will fire\r\n if (this.options.token) {\r\n response.href += ('?token=' + this.options.token);\r\n }\r\n if (this.options.proxy) {\r\n response.href = this.options.proxy + '?' + response.href;\r\n }\r\n this._renderImage(response.href, bounds);\r\n }, this);\r\n } else {\r\n params.f = 'image';\r\n var fullUrl = this.options.url + 'exportImage' + Util.getParamString(params);\r\n if (this.options.proxy) {\r\n fullUrl = this.options.proxy + '?' + fullUrl;\r\n }\r\n this._renderImage(fullUrl, bounds);\r\n }\r\n }\r\n});\r\n\r\nexport function imageMapLayer (url, options) {\r\n return new ImageMapLayer(url, options);\r\n}\r\n\r\nexport default imageMapLayer;\r\n","import { Util } from 'leaflet';\r\nimport { RasterLayer } from './RasterLayer';\r\nimport { getUrlParams } from '../Util';\r\nimport mapService from '../Services/MapService';\r\n\r\nexport var DynamicMapLayer = RasterLayer.extend({\r\n\r\n options: {\r\n updateInterval: 150,\r\n layers: false,\r\n layerDefs: false,\r\n timeOptions: false,\r\n format: 'png32',\r\n transparent: true,\r\n f: 'json'\r\n },\r\n\r\n initialize: function (options) {\r\n options = getUrlParams(options);\r\n this.service = mapService(options);\r\n this.service.addEventParent(this);\r\n\r\n Util.setOptions(this, options);\r\n },\r\n\r\n getDynamicLayers: function () {\r\n return this.options.dynamicLayers;\r\n },\r\n\r\n setDynamicLayers: function (dynamicLayers) {\r\n this.options.dynamicLayers = dynamicLayers;\r\n this._update();\r\n return this;\r\n },\r\n\r\n getLayers: function () {\r\n return this.options.layers;\r\n },\r\n\r\n setLayers: function (layers) {\r\n this.options.layers = layers;\r\n this._update();\r\n return this;\r\n },\r\n\r\n getLayerDefs: function () {\r\n return this.options.layerDefs;\r\n },\r\n\r\n setLayerDefs: function (layerDefs) {\r\n this.options.layerDefs = layerDefs;\r\n this._update();\r\n return this;\r\n },\r\n\r\n getTimeOptions: function () {\r\n return this.options.timeOptions;\r\n },\r\n\r\n setTimeOptions: function (timeOptions) {\r\n this.options.timeOptions = timeOptions;\r\n this._update();\r\n return this;\r\n },\r\n\r\n query: function () {\r\n return this.service.query();\r\n },\r\n\r\n identify: function () {\r\n return this.service.identify();\r\n },\r\n\r\n find: function () {\r\n return this.service.find();\r\n },\r\n\r\n _getPopupData: function (e) {\r\n var callback = Util.bind(function (error, featureCollection, response) {\r\n if (error) { return; } // we really can't do anything here but authenticate or requesterror will fire\r\n setTimeout(Util.bind(function () {\r\n this._renderPopup(e.latlng, error, featureCollection, response);\r\n }, this), 300);\r\n }, this);\r\n\r\n var identifyRequest;\r\n if (this.options.popup) {\r\n identifyRequest = this.options.popup.on(this._map).at(e.latlng);\r\n } else {\r\n identifyRequest = this.identify().on(this._map).at(e.latlng);\r\n }\r\n\r\n // remove extraneous vertices from response features if it has not already been done\r\n if (!identifyRequest.params.maxAllowableOffset) {\r\n identifyRequest.simplify(this._map, 0.5);\r\n }\r\n\r\n if (!(this.options.popup && this.options.popup.params && this.options.popup.params.layers)) {\r\n if (this.options.layers) {\r\n identifyRequest.layers('visible:' + this.options.layers.join(','));\r\n } else {\r\n identifyRequest.layers('visible');\r\n }\r\n }\r\n\r\n // if present, pass layer ids and sql filters through to the identify task\r\n if (this.options.layerDefs && typeof this.options.layerDefs !== 'string' && !identifyRequest.params.layerDefs) {\r\n for (var id in this.options.layerDefs) {\r\n if (Object.prototype.hasOwnProperty.call(this.options.layerDefs, id)) {\r\n identifyRequest.layerDef(id, this.options.layerDefs[id]);\r\n }\r\n }\r\n }\r\n\r\n identifyRequest.run(callback);\r\n\r\n // set the flags to show the popup\r\n this._shouldRenderPopup = true;\r\n this._lastClick = e.latlng;\r\n },\r\n\r\n _buildExportParams: function () {\r\n var sr = parseInt(this._map.options.crs.code.split(':')[1], 10);\r\n\r\n var params = {\r\n bbox: this._calculateBbox(),\r\n size: this._calculateImageSize(),\r\n dpi: 96,\r\n format: this.options.format,\r\n transparent: this.options.transparent,\r\n bboxSR: sr,\r\n imageSR: sr\r\n };\r\n\r\n if (this.options.dynamicLayers) {\r\n params.dynamicLayers = this.options.dynamicLayers;\r\n }\r\n\r\n if (this.options.layers) {\r\n if (this.options.layers.length === 0) {\r\n return;\r\n } else {\r\n params.layers = 'show:' + this.options.layers.join(',');\r\n }\r\n }\r\n\r\n if (this.options.layerDefs) {\r\n params.layerDefs = typeof this.options.layerDefs === 'string' ? this.options.layerDefs : JSON.stringify(this.options.layerDefs);\r\n }\r\n\r\n if (this.options.timeOptions) {\r\n params.timeOptions = JSON.stringify(this.options.timeOptions);\r\n }\r\n\r\n if (this.options.from && this.options.to) {\r\n params.time = this.options.from.valueOf() + ',' + this.options.to.valueOf();\r\n }\r\n\r\n if (this.service.options.token) {\r\n params.token = this.service.options.token;\r\n }\r\n\r\n if (this.options.proxy) {\r\n params.proxy = this.options.proxy;\r\n }\r\n\r\n // use a timestamp to bust server cache\r\n if (this.options.disableCache) {\r\n params._ts = Date.now();\r\n }\r\n\r\n return params;\r\n },\r\n\r\n _requestExport: function (params, bounds) {\r\n if (this.options.f === 'json') {\r\n this.service.request('export', params, function (error, response) {\r\n if (error) { return; } // we really can't do anything here but authenticate or requesterror will fire\r\n\r\n if (this.options.token && response.href) {\r\n response.href += ('?token=' + this.options.token);\r\n }\r\n if (this.options.proxy && response.href) {\r\n response.href = this.options.proxy + '?' + response.href;\r\n }\r\n if (response.href) {\r\n this._renderImage(response.href, bounds);\r\n } else {\r\n this._renderImage(response.imageData, bounds, response.contentType);\r\n }\r\n }, this);\r\n } else {\r\n params.f = 'image';\r\n var fullUrl = this.options.url + 'export' + Util.getParamString(params);\r\n if (this.options.proxy) {\r\n fullUrl = this.options.proxy + '?' + fullUrl;\r\n }\r\n this._renderImage(fullUrl, bounds);\r\n }\r\n }\r\n});\r\n\r\nexport function dynamicMapLayer (url, options) {\r\n return new DynamicMapLayer(url, options);\r\n}\r\n\r\nexport default dynamicMapLayer;\r\n","import {\r\n LatLngBounds,\r\n toLatLngBounds as latLngBounds,\r\n Layer,\r\n Browser,\r\n Util,\r\n Point,\r\n Bounds\r\n} from 'leaflet';\r\n\r\nexport var FeatureGrid = Layer.extend({\r\n // @section\r\n // @aka GridLayer options\r\n options: {\r\n // @option cellSize: Number|Point = 256\r\n // Width and height of cells in the grid. Use a number if width and height are equal, or `L.point(width, height)` otherwise.\r\n cellSize: 512,\r\n\r\n // @option updateWhenIdle: Boolean = (depends)\r\n // Load new cells only when panning ends.\r\n // `true` by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.\r\n // `false` otherwise in order to display new cells _during_ panning, since it is easy to pan outside the\r\n // [`keepBuffer`](#gridlayer-keepbuffer) option in desktop browsers.\r\n updateWhenIdle: Browser.mobile,\r\n\r\n // @option updateInterval: Number = 150\r\n // Cells will not update more than once every `updateInterval` milliseconds when panning.\r\n updateInterval: 150,\r\n\r\n // @option noWrap: Boolean = false\r\n // Whether the layer is wrapped around the antimeridian. If `true`, the\r\n // GridLayer will only be displayed once at low zoom levels. Has no\r\n // effect when the [map CRS](#map-crs) doesn't wrap around. Can be used\r\n // in combination with [`bounds`](#gridlayer-bounds) to prevent requesting\r\n // cells outside the CRS limits.\r\n noWrap: false,\r\n\r\n // @option keepBuffer: Number = 1.5\r\n // When panning the map, keep this many rows and columns of cells before unloading them.\r\n keepBuffer: 1.5\r\n },\r\n\r\n initialize: function (options) {\r\n Util.setOptions(this, options);\r\n },\r\n\r\n onAdd: function (map) {\r\n this._cells = {};\r\n this._activeCells = {};\r\n this._resetView();\r\n this._update();\r\n },\r\n\r\n onRemove: function (map) {\r\n this._removeAllCells();\r\n this._cellZoom = undefined;\r\n },\r\n\r\n // @method isLoading: Boolean\r\n // Returns `true` if any cell in the grid layer has not finished loading.\r\n isLoading: function () {\r\n return this._loading;\r\n },\r\n\r\n // @method redraw: this\r\n // Causes the layer to clear all the cells and request them again.\r\n redraw: function () {\r\n if (this._map) {\r\n this._removeAllCells();\r\n this._update();\r\n }\r\n return this;\r\n },\r\n\r\n getEvents: function () {\r\n var events = {\r\n viewprereset: this._invalidateAll,\r\n viewreset: this._resetView,\r\n zoom: this._resetView,\r\n moveend: this._onMoveEnd\r\n };\r\n\r\n if (!this.options.updateWhenIdle) {\r\n // update cells on move, but not more often than once per given interval\r\n if (!this._onMove) {\r\n this._onMove = Util.throttle(\r\n this._onMoveEnd,\r\n this.options.updateInterval,\r\n this\r\n );\r\n }\r\n\r\n events.move = this._onMove;\r\n }\r\n\r\n return events;\r\n },\r\n\r\n // @section Extension methods\r\n // Layers extending `GridLayer` shall reimplement the following method.\r\n // @method createCell(coords: Object, done?: Function): HTMLElement\r\n // Called only internally, must be overridden by classes extending `GridLayer`.\r\n // Returns the `HTMLElement` corresponding to the given `coords`. If the `done` callback\r\n // is specified, it must be called when the cell has finished loading and drawing.\r\n createCell: function () {\r\n return document.createElement('div');\r\n },\r\n\r\n removeCell: function () {\r\n\r\n },\r\n\r\n reuseCell: function () {\r\n\r\n },\r\n\r\n cellLeave: function () {\r\n\r\n },\r\n\r\n cellEnter: function () {\r\n\r\n },\r\n // @section\r\n // @method getCellSize: Point\r\n // Normalizes the [cellSize option](#gridlayer-cellsize) into a point. Used by the `createCell()` method.\r\n getCellSize: function () {\r\n var s = this.options.cellSize;\r\n return s instanceof Point ? s : new Point(s, s);\r\n },\r\n\r\n _pruneCells: function () {\r\n if (!this._map) {\r\n return;\r\n }\r\n\r\n var key, cell;\r\n\r\n for (key in this._cells) {\r\n cell = this._cells[key];\r\n cell.retain = cell.current;\r\n }\r\n\r\n for (key in this._cells) {\r\n cell = this._cells[key];\r\n if (cell.current && !cell.active) {\r\n var coords = cell.coords;\r\n if (!this._retainParent(coords.x, coords.y, coords.z, coords.z - 5)) {\r\n this._retainChildren(coords.x, coords.y, coords.z, coords.z + 2);\r\n }\r\n }\r\n }\r\n\r\n for (key in this._cells) {\r\n if (!this._cells[key].retain) {\r\n this._removeCell(key);\r\n }\r\n }\r\n },\r\n\r\n _removeAllCells: function () {\r\n for (var key in this._cells) {\r\n this._removeCell(key);\r\n }\r\n },\r\n\r\n _invalidateAll: function () {\r\n this._removeAllCells();\r\n\r\n this._cellZoom = undefined;\r\n },\r\n\r\n _retainParent: function (x, y, z, minZoom) {\r\n var x2 = Math.floor(x / 2);\r\n var y2 = Math.floor(y / 2);\r\n var z2 = z - 1;\r\n var coords2 = new Point(+x2, +y2);\r\n coords2.z = +z2;\r\n\r\n var key = this._cellCoordsToKey(coords2);\r\n var cell = this._cells[key];\r\n\r\n if (cell && cell.active) {\r\n cell.retain = true;\r\n return true;\r\n } else if (cell && cell.loaded) {\r\n cell.retain = true;\r\n }\r\n\r\n if (z2 > minZoom) {\r\n return this._retainParent(x2, y2, z2, minZoom);\r\n }\r\n\r\n return false;\r\n },\r\n\r\n _retainChildren: function (x, y, z, maxZoom) {\r\n for (var i = 2 * x; i < 2 * x + 2; i++) {\r\n for (var j = 2 * y; j < 2 * y + 2; j++) {\r\n var coords = new Point(i, j);\r\n coords.z = z + 1;\r\n\r\n var key = this._cellCoordsToKey(coords);\r\n var cell = this._cells[key];\r\n\r\n if (cell && cell.active) {\r\n cell.retain = true;\r\n continue;\r\n } else if (cell && cell.loaded) {\r\n cell.retain = true;\r\n }\r\n\r\n if (z + 1 < maxZoom) {\r\n this._retainChildren(i, j, z + 1, maxZoom);\r\n }\r\n }\r\n }\r\n },\r\n\r\n _resetView: function (e) {\r\n var animating = e && (e.pinch || e.flyTo);\r\n\r\n if (animating) {\r\n return;\r\n }\r\n\r\n this._setView(\r\n this._map.getCenter(),\r\n this._map.getZoom(),\r\n animating,\r\n animating\r\n );\r\n },\r\n\r\n _setView: function (center, zoom, noPrune, noUpdate) {\r\n var cellZoom = Math.round(zoom);\r\n\r\n if (!noUpdate) {\r\n this._cellZoom = cellZoom;\r\n\r\n if (this._abortLoading) {\r\n this._abortLoading();\r\n }\r\n\r\n this._resetGrid();\r\n\r\n if (cellZoom !== undefined) {\r\n this._update(center);\r\n }\r\n\r\n if (!noPrune) {\r\n this._pruneCells();\r\n }\r\n\r\n // Flag to prevent _updateOpacity from pruning cells during\r\n // a zoom anim or a pinch gesture\r\n this._noPrune = !!noPrune;\r\n }\r\n },\r\n\r\n _resetGrid: function () {\r\n var map = this._map;\r\n var crs = map.options.crs;\r\n var cellSize = (this._cellSize = this.getCellSize());\r\n var cellZoom = this._cellZoom;\r\n\r\n var bounds = this._map.getPixelWorldBounds(this._cellZoom);\r\n if (bounds) {\r\n this._globalCellRange = this._pxBoundsToCellRange(bounds);\r\n }\r\n\r\n this._wrapX = crs.wrapLng &&\r\n !this.options.noWrap && [\r\n Math.floor(map.project([0, crs.wrapLng[0]], cellZoom).x / cellSize.x),\r\n Math.ceil(map.project([0, crs.wrapLng[1]], cellZoom).x / cellSize.y)\r\n ];\r\n this._wrapY = crs.wrapLat &&\r\n !this.options.noWrap && [\r\n Math.floor(map.project([crs.wrapLat[0], 0], cellZoom).y / cellSize.x),\r\n Math.ceil(map.project([crs.wrapLat[1], 0], cellZoom).y / cellSize.y)\r\n ];\r\n },\r\n\r\n _onMoveEnd: function (e) {\r\n var animating = e && (e.pinch || e.flyTo);\r\n\r\n if (animating || !this._map || this._map._animatingZoom) {\r\n return;\r\n }\r\n\r\n this._update();\r\n },\r\n\r\n _getCelldPixelBounds: function (center) {\r\n var map = this._map;\r\n var mapZoom = map._animatingZoom\r\n ? Math.max(map._animateToZoom, map.getZoom())\r\n : map.getZoom();\r\n var scale = map.getZoomScale(mapZoom, this._cellZoom);\r\n var pixelCenter = map.project(center, this._cellZoom).floor();\r\n var halfSize = map.getSize().divideBy(scale * 2);\r\n\r\n return new Bounds(\r\n pixelCenter.subtract(halfSize),\r\n pixelCenter.add(halfSize)\r\n );\r\n },\r\n\r\n // Private method to load cells in the grid's active zoom level according to map bounds\r\n _update: function (center) {\r\n var map = this._map;\r\n if (!map) {\r\n return;\r\n }\r\n var zoom = Math.round(map.getZoom());\r\n\r\n if (center === undefined) {\r\n center = map.getCenter();\r\n }\r\n\r\n var pixelBounds = this._getCelldPixelBounds(center);\r\n var cellRange = this._pxBoundsToCellRange(pixelBounds);\r\n var cellCenter = cellRange.getCenter();\r\n var queue = [];\r\n var margin = this.options.keepBuffer;\r\n var noPruneRange = new Bounds(\r\n cellRange.getBottomLeft().subtract([margin, -margin]),\r\n cellRange.getTopRight().add([margin, -margin])\r\n );\r\n\r\n // Sanity check: panic if the cell range contains Infinity somewhere.\r\n if (\r\n !(\r\n isFinite(cellRange.min.x) &&\r\n isFinite(cellRange.min.y) &&\r\n isFinite(cellRange.max.x) &&\r\n isFinite(cellRange.max.y)\r\n )\r\n ) {\r\n throw new Error('Attempted to load an infinite number of cells');\r\n }\r\n\r\n for (var key in this._cells) {\r\n var c = this._cells[key].coords;\r\n if (\r\n c.z !== this._cellZoom ||\r\n !noPruneRange.contains(new Point(c.x, c.y))\r\n ) {\r\n this._cells[key].current = false;\r\n }\r\n }\r\n\r\n // _update just loads more cells. If the cell zoom level differs too much\r\n // from the map's, let _setView reset levels and prune old cells.\r\n if (Math.abs(zoom - this._cellZoom) > 1) {\r\n this._setView(center, zoom);\r\n return;\r\n }\r\n\r\n // create a queue of coordinates to load cells from\r\n for (var j = cellRange.min.y; j <= cellRange.max.y; j++) {\r\n for (var i = cellRange.min.x; i <= cellRange.max.x; i++) {\r\n var coords = new Point(i, j);\r\n coords.z = this._cellZoom;\r\n\r\n if (!this._isValidCell(coords)) {\r\n continue;\r\n }\r\n\r\n var cell = this._cells[this._cellCoordsToKey(coords)];\r\n if (cell) {\r\n cell.current = true;\r\n } else {\r\n queue.push(coords);\r\n }\r\n }\r\n }\r\n\r\n // sort cell queue to load cells in order of their distance to center\r\n queue.sort(function (a, b) {\r\n return a.distanceTo(cellCenter) - b.distanceTo(cellCenter);\r\n });\r\n\r\n if (queue.length !== 0) {\r\n // if it's the first batch of cells to load\r\n if (!this._loading) {\r\n this._loading = true;\r\n }\r\n\r\n for (i = 0; i < queue.length; i++) {\r\n var _key = this._cellCoordsToKey(queue[i]);\r\n var _coords = this._keyToCellCoords(_key);\r\n if (this._activeCells[_coords]) {\r\n this._reuseCell(queue[i]);\r\n } else {\r\n this._createCell(queue[i]);\r\n }\r\n }\r\n }\r\n },\r\n\r\n _isValidCell: function (coords) {\r\n var crs = this._map.options.crs;\r\n\r\n if (!crs.infinite) {\r\n // don't load cell if it's out of bounds and not wrapped\r\n var bounds = this._globalCellRange;\r\n if (\r\n (!crs.wrapLng &&\r\n (coords.x < bounds.min.x || coords.x > bounds.max.x)) ||\r\n (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y))\r\n ) {\r\n return false;\r\n }\r\n }\r\n\r\n if (!this.options.bounds) {\r\n return true;\r\n }\r\n\r\n // don't load cell if it doesn't intersect the bounds in options\r\n var cellBounds = this._cellCoordsToBounds(coords);\r\n return latLngBounds(this.options.bounds).overlaps(cellBounds);\r\n },\r\n\r\n _keyToBounds: function (key) {\r\n return this._cellCoordsToBounds(this._keyToCellCoords(key));\r\n },\r\n\r\n _cellCoordsToNwSe: function (coords) {\r\n var map = this._map;\r\n var cellSize = this.getCellSize();\r\n var nwPoint = coords.scaleBy(cellSize);\r\n var sePoint = nwPoint.add(cellSize);\r\n var nw = map.unproject(nwPoint, coords.z);\r\n var se = map.unproject(sePoint, coords.z);\r\n\r\n return [nw, se];\r\n },\r\n\r\n // converts cell coordinates to its geographical bounds\r\n _cellCoordsToBounds: function (coords) {\r\n var bp = this._cellCoordsToNwSe(coords);\r\n var bounds = new LatLngBounds(bp[0], bp[1]);\r\n\r\n if (!this.options.noWrap) {\r\n bounds = this._map.wrapLatLngBounds(bounds);\r\n }\r\n return bounds;\r\n },\r\n // converts cell coordinates to key for the cell cache\r\n _cellCoordsToKey: function (coords) {\r\n return coords.x + ':' + coords.y + ':' + coords.z;\r\n },\r\n\r\n // converts cell cache key to coordinates\r\n _keyToCellCoords: function (key) {\r\n var k = key.split(':');\r\n var coords = new Point(+k[0], +k[1]);\r\n\r\n coords.z = +k[2];\r\n return coords;\r\n },\r\n\r\n _removeCell: function (key) {\r\n var cell = this._cells[key];\r\n\r\n if (!cell) {\r\n return;\r\n }\r\n\r\n var coords = this._keyToCellCoords(key);\r\n var wrappedCoords = this._wrapCoords(coords);\r\n var cellBounds = this._cellCoordsToBounds(this._wrapCoords(coords));\r\n\r\n cell.current = false;\r\n\r\n delete this._cells[key];\r\n this._activeCells[key] = cell;\r\n\r\n this.cellLeave(cellBounds, wrappedCoords, key);\r\n\r\n this.fire('cellleave', {\r\n key: key,\r\n coords: wrappedCoords,\r\n bounds: cellBounds\r\n });\r\n },\r\n\r\n _reuseCell: function (coords) {\r\n var key = this._cellCoordsToKey(coords);\r\n\r\n // save cell in cache\r\n this._cells[key] = this._activeCells[key];\r\n this._cells[key].current = true;\r\n\r\n var wrappedCoords = this._wrapCoords(coords);\r\n var cellBounds = this._cellCoordsToBounds(this._wrapCoords(coords));\r\n\r\n this.cellEnter(cellBounds, wrappedCoords, key);\r\n\r\n this.fire('cellenter', {\r\n key: key,\r\n coords: wrappedCoords,\r\n bounds: cellBounds\r\n });\r\n },\r\n\r\n _createCell: function (coords) {\r\n var key = this._cellCoordsToKey(coords);\r\n\r\n var wrappedCoords = this._wrapCoords(coords);\r\n var cellBounds = this._cellCoordsToBounds(this._wrapCoords(coords));\r\n\r\n this.createCell(cellBounds, wrappedCoords, key);\r\n\r\n this.fire('cellcreate', {\r\n key: key,\r\n coords: wrappedCoords,\r\n bounds: cellBounds\r\n });\r\n\r\n // save cell in cache\r\n this._cells[key] = {\r\n coords: coords,\r\n current: true\r\n };\r\n\r\n Util.requestAnimFrame(this._pruneCells, this);\r\n },\r\n\r\n _cellReady: function (coords, err, cell) {\r\n var key = this._cellCoordsToKey(coords);\r\n\r\n cell = this._cells[key];\r\n\r\n if (!cell) {\r\n return;\r\n }\r\n\r\n cell.loaded = +new Date();\r\n\r\n cell.active = true;\r\n },\r\n\r\n _getCellPos: function (coords) {\r\n return coords.scaleBy(this.getCellSize());\r\n },\r\n\r\n _wrapCoords: function (coords) {\r\n var newCoords = new Point(\r\n this._wrapX ? Util.wrapNum(coords.x, this._wrapX) : coords.x,\r\n this._wrapY ? Util.wrapNum(coords.y, this._wrapY) : coords.y\r\n );\r\n newCoords.z = coords.z;\r\n return newCoords;\r\n },\r\n\r\n _pxBoundsToCellRange: function (bounds) {\r\n var cellSize = this.getCellSize();\r\n return new Bounds(\r\n bounds.min.unscaleBy(cellSize).floor(),\r\n bounds.max.unscaleBy(cellSize).ceil().subtract([1, 1])\r\n );\r\n }\r\n});\r\n","function BinarySearchIndex (values) {\n this.values = [].concat(values || []);\n}\n\nBinarySearchIndex.prototype.query = function (value) {\n var index = this.getIndex(value);\n return this.values[index];\n};\n\nBinarySearchIndex.prototype.getIndex = function getIndex (value) {\n if (this.dirty) {\n this.sort();\n }\n\n var minIndex = 0;\n var maxIndex = this.values.length - 1;\n var currentIndex;\n var currentElement;\n\n while (minIndex <= maxIndex) {\n currentIndex = (minIndex + maxIndex) / 2 | 0;\n currentElement = this.values[Math.round(currentIndex)];\n if (+currentElement.value < +value) {\n minIndex = currentIndex + 1;\n } else if (+currentElement.value > +value) {\n maxIndex = currentIndex - 1;\n } else {\n return currentIndex;\n }\n }\n\n return Math.abs(~maxIndex);\n};\n\nBinarySearchIndex.prototype.between = function between (start, end) {\n var startIndex = this.getIndex(start);\n var endIndex = this.getIndex(end);\n\n if (startIndex === 0 && endIndex === 0) {\n return [];\n }\n\n while (this.values[startIndex - 1] && this.values[startIndex - 1].value === start) {\n startIndex--;\n }\n\n while (this.values[endIndex + 1] && this.values[endIndex + 1].value === end) {\n endIndex++;\n }\n\n if (this.values[endIndex] && this.values[endIndex].value === end && this.values[endIndex + 1]) {\n endIndex++;\n }\n\n return this.values.slice(startIndex, endIndex);\n};\n\nBinarySearchIndex.prototype.insert = function insert (item) {\n this.values.splice(this.getIndex(item.value), 0, item);\n return this;\n};\n\nBinarySearchIndex.prototype.bulkAdd = function bulkAdd (items, sort) {\n this.values = this.values.concat([].concat(items || []));\n\n if (sort) {\n this.sort();\n } else {\n this.dirty = true;\n }\n\n return this;\n};\n\nBinarySearchIndex.prototype.sort = function sort () {\n this.values.sort(function (a, b) {\n return +b.value - +a.value;\n }).reverse();\n this.dirty = false;\n return this;\n};\n\nexport default BinarySearchIndex;\n","import { Util } from 'leaflet';\r\nimport featureLayerService from '../../Services/FeatureLayerService';\r\nimport {\r\n getUrlParams,\r\n warn,\r\n setEsriAttribution,\r\n removeEsriAttribution\r\n} from '../../Util';\r\nimport { FeatureGrid } from './FeatureGrid';\r\nimport BinarySearchIndex from 'tiny-binary-search';\r\n\r\nexport var FeatureManager = FeatureGrid.extend({\r\n /**\r\n * Options\r\n */\r\n\r\n options: {\r\n attribution: null,\r\n where: '1=1',\r\n fields: ['*'],\r\n from: false,\r\n to: false,\r\n timeField: false,\r\n timeFilterMode: 'server',\r\n simplifyFactor: 0,\r\n precision: 6,\r\n fetchAllFeatures: false\r\n },\r\n\r\n /**\r\n * Constructor\r\n */\r\n\r\n initialize: function (options) {\r\n FeatureGrid.prototype.initialize.call(this, options);\r\n\r\n options = getUrlParams(options);\r\n options = Util.setOptions(this, options);\r\n\r\n this.service = featureLayerService(options);\r\n this.service.addEventParent(this);\r\n\r\n // use case insensitive regex to look for common fieldnames used for indexing\r\n if (this.options.fields[0] !== '*') {\r\n var oidCheck = false;\r\n for (var i = 0; i < this.options.fields.length; i++) {\r\n if (this.options.fields[i].match(/^(OBJECTID|FID|OID|ID)$/i)) {\r\n oidCheck = true;\r\n }\r\n }\r\n if (oidCheck === false) {\r\n warn(\r\n 'no known esriFieldTypeOID field detected in fields Array. Please add an attribute field containing unique IDs to ensure the layer can be drawn correctly.'\r\n );\r\n }\r\n }\r\n\r\n if (this.options.timeField.start && this.options.timeField.end) {\r\n this._startTimeIndex = new BinarySearchIndex();\r\n this._endTimeIndex = new BinarySearchIndex();\r\n } else if (this.options.timeField) {\r\n this._timeIndex = new BinarySearchIndex();\r\n }\r\n\r\n this._cache = {};\r\n this._currentSnapshot = []; // cache of what layers should be active\r\n this._activeRequests = 0;\r\n },\r\n\r\n /**\r\n * Layer Interface\r\n */\r\n\r\n onAdd: function (map) {\r\n // include 'Powered by Esri' in map attribution\r\n setEsriAttribution(map);\r\n\r\n this.service.metadata(function (err, metadata) {\r\n if (!err) {\r\n var supportedFormats = metadata.supportedQueryFormats;\r\n\r\n // Check if someone has requested that we don't use geoJSON, even if it's available\r\n var forceJsonFormat = false;\r\n if (\r\n this.service.options.isModern === false ||\r\n this.options.fetchAllFeatures\r\n ) {\r\n forceJsonFormat = true;\r\n }\r\n\r\n // Unless we've been told otherwise, check to see whether service can emit GeoJSON natively\r\n if (\r\n !forceJsonFormat &&\r\n supportedFormats &&\r\n supportedFormats.indexOf('geoJSON') !== -1\r\n ) {\r\n this.service.options.isModern = true;\r\n }\r\n\r\n if (metadata.objectIdField) {\r\n this.service.options.idAttribute = metadata.objectIdField;\r\n }\r\n\r\n // add copyright text listed in service metadata\r\n if (\r\n !this.options.attribution &&\r\n map.attributionControl &&\r\n metadata.copyrightText\r\n ) {\r\n this.options.attribution = metadata.copyrightText;\r\n map.attributionControl.addAttribution(this.getAttribution());\r\n }\r\n }\r\n }, this);\r\n\r\n map.on('zoomend', this._handleZoomChange, this);\r\n\r\n return FeatureGrid.prototype.onAdd.call(this, map);\r\n },\r\n\r\n onRemove: function (map) {\r\n removeEsriAttribution(map);\r\n map.off('zoomend', this._handleZoomChange, this);\r\n\r\n return FeatureGrid.prototype.onRemove.call(this, map);\r\n },\r\n\r\n getAttribution: function () {\r\n return this.options.attribution;\r\n },\r\n\r\n /**\r\n * Feature Management\r\n */\r\n\r\n createCell: function (bounds, coords) {\r\n // dont fetch features outside the scale range defined for the layer\r\n if (this._visibleZoom()) {\r\n this._requestFeatures(bounds, coords);\r\n }\r\n },\r\n\r\n _requestFeatures: function (bounds, coords, callback, offset) {\r\n this._activeRequests++;\r\n\r\n // default param\r\n offset = offset || 0;\r\n\r\n var originalWhere = this.options.where;\r\n\r\n // our first active request fires loading\r\n if (this._activeRequests === 1) {\r\n this.fire(\r\n 'loading',\r\n {\r\n bounds: bounds\r\n },\r\n true\r\n );\r\n }\r\n\r\n return this._buildQuery(bounds, offset).run(function (\r\n error,\r\n featureCollection,\r\n response\r\n ) {\r\n if (response && response.exceededTransferLimit) {\r\n this.fire('drawlimitexceeded');\r\n }\r\n\r\n // the where changed while this request was being run so don't it.\r\n if (this.options.where !== originalWhere) {\r\n return;\r\n }\r\n\r\n // no error, features\r\n if (!error && featureCollection && featureCollection.features.length) {\r\n // schedule adding features until the next animation frame\r\n Util.requestAnimFrame(\r\n Util.bind(function () {\r\n this._addFeatures(featureCollection.features, coords);\r\n this._postProcessFeatures(bounds);\r\n }, this)\r\n );\r\n }\r\n\r\n // no error, no features\r\n if (!error && featureCollection && !featureCollection.features.length) {\r\n this._postProcessFeatures(bounds);\r\n }\r\n\r\n if (error) {\r\n this._postProcessFeatures(bounds);\r\n }\r\n\r\n if (callback) {\r\n callback.call(this, error, featureCollection);\r\n }\r\n if (\r\n response &&\r\n (response.exceededTransferLimit ||\r\n (response.properties && response.properties.exceededTransferLimit)) &&\r\n this.options.fetchAllFeatures\r\n ) {\r\n this._requestFeatures(\r\n bounds,\r\n coords,\r\n callback,\r\n offset + featureCollection.features.length\r\n );\r\n }\r\n },\r\n this);\r\n },\r\n\r\n _postProcessFeatures: function (bounds) {\r\n // deincrement the request counter now that we have processed features\r\n this._activeRequests--;\r\n\r\n // if there are no more active requests fire a load event for this view\r\n if (this._activeRequests <= 0) {\r\n this.fire('load', {\r\n bounds: bounds\r\n });\r\n }\r\n },\r\n\r\n _cacheKey: function (coords) {\r\n return coords.z + ':' + coords.x + ':' + coords.y;\r\n },\r\n\r\n _addFeatures: function (features, coords) {\r\n // coords is optional - will be false if coming from addFeatures() function\r\n if (coords) {\r\n var key = this._cacheKey(coords);\r\n this._cache[key] = this._cache[key] || [];\r\n }\r\n\r\n for (var i = features.length - 1; i >= 0; i--) {\r\n var id = features[i].id;\r\n\r\n if (this._currentSnapshot.indexOf(id) === -1) {\r\n this._currentSnapshot.push(id);\r\n }\r\n if (typeof key !== 'undefined' && this._cache[key].indexOf(id) === -1) {\r\n this._cache[key].push(id);\r\n }\r\n }\r\n\r\n if (this.options.timeField) {\r\n this._buildTimeIndexes(features);\r\n }\r\n\r\n this.createLayers(features);\r\n },\r\n\r\n _buildQuery: function (bounds, offset) {\r\n var query = this.service\r\n .query()\r\n .intersects(bounds)\r\n .where(this.options.where)\r\n .fields(this.options.fields)\r\n .precision(this.options.precision);\r\n\r\n if (this.options.fetchAllFeatures && !isNaN(parseInt(offset))) {\r\n query = query.offset(offset);\r\n }\r\n\r\n query.params['resultType'] = 'tile';\r\n\r\n if (this.options.requestParams) {\r\n Util.extend(query.params, this.options.requestParams);\r\n }\r\n\r\n if (this.options.simplifyFactor) {\r\n query.simplify(this._map, this.options.simplifyFactor);\r\n }\r\n\r\n if (\r\n this.options.timeFilterMode === 'server' &&\r\n this.options.from &&\r\n this.options.to\r\n ) {\r\n query.between(this.options.from, this.options.to);\r\n }\r\n\r\n return query;\r\n },\r\n\r\n /**\r\n * Where Methods\r\n */\r\n\r\n setWhere: function (where, callback, context) {\r\n this.options.where = where && where.length ? where : '1=1';\r\n\r\n var oldSnapshot = [];\r\n var newSnapshot = [];\r\n var pendingRequests = 0;\r\n var requestError = null;\r\n var requestCallback = Util.bind(function (error, featureCollection) {\r\n if (error) {\r\n requestError = error;\r\n }\r\n\r\n if (featureCollection) {\r\n for (var i = featureCollection.features.length - 1; i >= 0; i--) {\r\n newSnapshot.push(featureCollection.features[i].id);\r\n }\r\n }\r\n\r\n pendingRequests--;\r\n\r\n if (\r\n pendingRequests <= 0 &&\r\n this._visibleZoom() &&\r\n where === this.options.where // the where is still the same so use this one\r\n ) {\r\n this._currentSnapshot = newSnapshot;\r\n // schedule adding features for the next animation frame\r\n Util.requestAnimFrame(\r\n Util.bind(function () {\r\n this.removeLayers(oldSnapshot);\r\n this.addLayers(newSnapshot);\r\n if (callback) {\r\n callback.call(context, requestError);\r\n }\r\n }, this)\r\n );\r\n }\r\n }, this);\r\n\r\n for (var i = this._currentSnapshot.length - 1; i >= 0; i--) {\r\n oldSnapshot.push(this._currentSnapshot[i]);\r\n }\r\n\r\n this._cache = {};\r\n\r\n for (var key in this._cells) {\r\n pendingRequests++;\r\n var coords = this._keyToCellCoords(key);\r\n var bounds = this._cellCoordsToBounds(coords);\r\n this._requestFeatures(bounds, coords, requestCallback);\r\n }\r\n\r\n return this;\r\n },\r\n\r\n getWhere: function () {\r\n return this.options.where;\r\n },\r\n\r\n /**\r\n * Time Range Methods\r\n */\r\n\r\n getTimeRange: function () {\r\n return [this.options.from, this.options.to];\r\n },\r\n\r\n setTimeRange: function (from, to, callback, context) {\r\n var oldFrom = this.options.from;\r\n var oldTo = this.options.to;\r\n var pendingRequests = 0;\r\n var requestError = null;\r\n var requestCallback = Util.bind(function (error) {\r\n if (error) {\r\n requestError = error;\r\n }\r\n this._filterExistingFeatures(oldFrom, oldTo, from, to);\r\n\r\n pendingRequests--;\r\n\r\n if (callback && pendingRequests <= 0) {\r\n callback.call(context, requestError);\r\n }\r\n }, this);\r\n\r\n this.options.from = from;\r\n this.options.to = to;\r\n\r\n this._filterExistingFeatures(oldFrom, oldTo, from, to);\r\n\r\n if (this.options.timeFilterMode === 'server') {\r\n for (var key in this._cells) {\r\n pendingRequests++;\r\n var coords = this._keyToCellCoords(key);\r\n var bounds = this._cellCoordsToBounds(coords);\r\n this._requestFeatures(bounds, coords, requestCallback);\r\n }\r\n }\r\n\r\n return this;\r\n },\r\n\r\n refresh: function () {\r\n this.setWhere(this.options.where);\r\n },\r\n\r\n _filterExistingFeatures: function (oldFrom, oldTo, newFrom, newTo) {\r\n var layersToRemove =\r\n oldFrom && oldTo\r\n ? this._getFeaturesInTimeRange(oldFrom, oldTo)\r\n : this._currentSnapshot;\r\n var layersToAdd = this._getFeaturesInTimeRange(newFrom, newTo);\r\n\r\n if (layersToAdd.indexOf) {\r\n for (var i = 0; i < layersToAdd.length; i++) {\r\n var shouldRemoveLayer = layersToRemove.indexOf(layersToAdd[i]);\r\n if (shouldRemoveLayer >= 0) {\r\n layersToRemove.splice(shouldRemoveLayer, 1);\r\n }\r\n }\r\n }\r\n\r\n // schedule adding features until the next animation frame\r\n Util.requestAnimFrame(\r\n Util.bind(function () {\r\n this.removeLayers(layersToRemove);\r\n this.addLayers(layersToAdd);\r\n }, this)\r\n );\r\n },\r\n\r\n _getFeaturesInTimeRange: function (start, end) {\r\n var ids = [];\r\n var search;\r\n\r\n if (this.options.timeField.start && this.options.timeField.end) {\r\n var startTimes = this._startTimeIndex.between(start, end);\r\n var endTimes = this._endTimeIndex.between(start, end);\r\n search = startTimes.concat(endTimes);\r\n } else if (this._timeIndex) {\r\n search = this._timeIndex.between(start, end);\r\n } else {\r\n warn(\r\n 'You must set timeField in the layer constructor in order to manipulate the start and end time filter.'\r\n );\r\n return [];\r\n }\r\n\r\n for (var i = search.length - 1; i >= 0; i--) {\r\n ids.push(search[i].id);\r\n }\r\n\r\n return ids;\r\n },\r\n\r\n _buildTimeIndexes: function (geojson) {\r\n var i;\r\n var feature;\r\n if (this.options.timeField.start && this.options.timeField.end) {\r\n var startTimeEntries = [];\r\n var endTimeEntries = [];\r\n for (i = geojson.length - 1; i >= 0; i--) {\r\n feature = geojson[i];\r\n startTimeEntries.push({\r\n id: feature.id,\r\n value: new Date(feature.properties[this.options.timeField.start])\r\n });\r\n endTimeEntries.push({\r\n id: feature.id,\r\n value: new Date(feature.properties[this.options.timeField.end])\r\n });\r\n }\r\n this._startTimeIndex.bulkAdd(startTimeEntries);\r\n this._endTimeIndex.bulkAdd(endTimeEntries);\r\n } else {\r\n var timeEntries = [];\r\n for (i = geojson.length - 1; i >= 0; i--) {\r\n feature = geojson[i];\r\n timeEntries.push({\r\n id: feature.id,\r\n value: new Date(feature.properties[this.options.timeField])\r\n });\r\n }\r\n\r\n this._timeIndex.bulkAdd(timeEntries);\r\n }\r\n },\r\n\r\n _featureWithinTimeRange: function (feature) {\r\n if (!this.options.from || !this.options.to) {\r\n return true;\r\n }\r\n\r\n var from = +this.options.from.valueOf();\r\n var to = +this.options.to.valueOf();\r\n\r\n if (typeof this.options.timeField === 'string') {\r\n var date = +feature.properties[this.options.timeField];\r\n return date >= from && date <= to;\r\n }\r\n\r\n if (this.options.timeField.start && this.options.timeField.end) {\r\n var startDate = +feature.properties[this.options.timeField.start];\r\n var endDate = +feature.properties[this.options.timeField.end];\r\n return (\r\n (startDate >= from && startDate <= to) ||\r\n (endDate >= from && endDate <= to) ||\r\n (startDate <= from && endDate >= to)\r\n );\r\n }\r\n },\r\n\r\n _visibleZoom: function () {\r\n // check to see whether the current zoom level of the map is within the optional limit defined for the FeatureLayer\r\n if (!this._map) {\r\n return false;\r\n }\r\n var zoom = this._map.getZoom();\r\n if (zoom > this.options.maxZoom || zoom < this.options.minZoom) {\r\n return false;\r\n } else {\r\n return true;\r\n }\r\n },\r\n\r\n _handleZoomChange: function () {\r\n if (!this._visibleZoom()) {\r\n // if we have moved outside the visible zoom range clear the current snapshot, no layers should be active\r\n this.removeLayers(this._currentSnapshot);\r\n this._currentSnapshot = [];\r\n } else {\r\n /*\r\n for every cell in this._cells\r\n 1. Get the cache key for the coords of the cell\r\n 2. If this._cache[key] exists it will be an array of feature IDs.\r\n 3. Call this.addLayers(this._cache[key]) to instruct the feature layer to add the layers back.\r\n */\r\n for (var i in this._cells) {\r\n var coords = this._cells[i].coords;\r\n var key = this._cacheKey(coords);\r\n if (this._cache[key]) {\r\n this.addLayers(this._cache[key]);\r\n }\r\n }\r\n }\r\n },\r\n\r\n /**\r\n * Service Methods\r\n */\r\n\r\n authenticate: function (token) {\r\n this.service.authenticate(token);\r\n return this;\r\n },\r\n\r\n metadata: function (callback, context) {\r\n this.service.metadata(callback, context);\r\n return this;\r\n },\r\n\r\n query: function () {\r\n return this.service.query();\r\n },\r\n\r\n _getMetadata: function (callback) {\r\n if (this._metadata) {\r\n var error;\r\n callback(error, this._metadata);\r\n } else {\r\n this.metadata(\r\n Util.bind(function (error, response) {\r\n this._metadata = response;\r\n callback(error, this._metadata);\r\n }, this)\r\n );\r\n }\r\n },\r\n\r\n addFeature: function (feature, callback, context) {\r\n this.addFeatures(feature, callback, context);\r\n },\r\n\r\n addFeatures: function (features, callback, context) {\r\n this._getMetadata(\r\n Util.bind(function (error, metadata) {\r\n if (error) {\r\n if (callback) {\r\n callback.call(this, error, null);\r\n }\r\n return;\r\n }\r\n // GeoJSON featureCollection or simple feature\r\n var featuresArray = features.features ? features.features : [features];\r\n\r\n this.service.addFeatures(\r\n features,\r\n Util.bind(function (error, response) {\r\n if (!error) {\r\n for (var i = featuresArray.length - 1; i >= 0; i--) {\r\n // assign ID from result to appropriate objectid field from service metadata\r\n featuresArray[i].properties[metadata.objectIdField] =\r\n featuresArray.length > 1\r\n ? response[i].objectId\r\n : response.objectId;\r\n // we also need to update the geojson id for createLayers() to function\r\n featuresArray[i].id =\r\n featuresArray.length > 1\r\n ? response[i].objectId\r\n : response.objectId;\r\n }\r\n this._addFeatures(featuresArray);\r\n }\r\n\r\n if (callback) {\r\n callback.call(context, error, response);\r\n }\r\n }, this)\r\n );\r\n }, this)\r\n );\r\n },\r\n\r\n updateFeature: function (feature, callback, context) {\r\n this.updateFeatures(feature, callback, context);\r\n },\r\n\r\n updateFeatures: function (features, callback, context) {\r\n // GeoJSON featureCollection or simple feature\r\n var featuresArray = features.features ? features.features : [features];\r\n this.service.updateFeatures(\r\n features,\r\n function (error, response) {\r\n if (!error) {\r\n for (var i = featuresArray.length - 1; i >= 0; i--) {\r\n this.removeLayers([featuresArray[i].id], true);\r\n }\r\n this._addFeatures(featuresArray);\r\n }\r\n\r\n if (callback) {\r\n callback.call(context, error, response);\r\n }\r\n },\r\n this\r\n );\r\n },\r\n\r\n deleteFeature: function (id, callback, context) {\r\n this.deleteFeatures(id, callback, context);\r\n },\r\n\r\n deleteFeatures: function (ids, callback, context) {\r\n return this.service.deleteFeatures(\r\n ids,\r\n function (error, response) {\r\n var responseArray = response.length ? response : [response];\r\n if (!error && responseArray.length > 0) {\r\n for (var i = responseArray.length - 1; i >= 0; i--) {\r\n this.removeLayers([responseArray[i].objectId], true);\r\n }\r\n }\r\n if (callback) {\r\n callback.call(context, error, response);\r\n }\r\n },\r\n this\r\n );\r\n }\r\n});\r\n","import { Path, Util, GeoJSON, latLng } from 'leaflet';\r\nimport { FeatureManager } from './FeatureManager';\r\nimport { warn } from '../../Util';\r\n\r\nexport var FeatureLayer = FeatureManager.extend({\r\n options: {\r\n cacheLayers: true\r\n },\r\n\r\n /**\r\n * Constructor\r\n */\r\n initialize: function (options) {\r\n if (options.apikey) {\r\n options.token = options.apikey;\r\n }\r\n FeatureManager.prototype.initialize.call(this, options);\r\n this._originalStyle = this.options.style;\r\n this._layers = {};\r\n },\r\n\r\n /**\r\n * Layer Interface\r\n */\r\n\r\n onRemove: function (map) {\r\n for (var i in this._layers) {\r\n map.removeLayer(this._layers[i]);\r\n // trigger the event when the entire featureLayer is removed from the map\r\n this.fire(\r\n 'removefeature',\r\n {\r\n feature: this._layers[i].feature,\r\n permanent: false\r\n },\r\n true\r\n );\r\n }\r\n\r\n return FeatureManager.prototype.onRemove.call(this, map);\r\n },\r\n\r\n createNewLayer: function (geojson) {\r\n var layer = GeoJSON.geometryToLayer(geojson, this.options);\r\n // trap for GeoJSON without geometry\r\n if (layer) {\r\n layer.defaultOptions = layer.options;\r\n }\r\n return layer;\r\n },\r\n\r\n _updateLayer: function (layer, geojson) {\r\n // convert the geojson coordinates into a Leaflet LatLng array/nested arrays\r\n // pass it to setLatLngs to update layer geometries\r\n var latlngs = [];\r\n var coordsToLatLng = this.options.coordsToLatLng || GeoJSON.coordsToLatLng;\r\n\r\n // copy new attributes, if present\r\n if (geojson.properties) {\r\n layer.feature.properties = geojson.properties;\r\n }\r\n\r\n switch (geojson.geometry.type) {\r\n case 'Point':\r\n latlngs = GeoJSON.coordsToLatLng(geojson.geometry.coordinates);\r\n layer.setLatLng(latlngs);\r\n break;\r\n case 'LineString':\r\n latlngs = GeoJSON.coordsToLatLngs(\r\n geojson.geometry.coordinates,\r\n 0,\r\n coordsToLatLng\r\n );\r\n layer.setLatLngs(latlngs);\r\n break;\r\n case 'MultiLineString':\r\n latlngs = GeoJSON.coordsToLatLngs(\r\n geojson.geometry.coordinates,\r\n 1,\r\n coordsToLatLng\r\n );\r\n layer.setLatLngs(latlngs);\r\n break;\r\n case 'Polygon':\r\n latlngs = GeoJSON.coordsToLatLngs(\r\n geojson.geometry.coordinates,\r\n 1,\r\n coordsToLatLng\r\n );\r\n layer.setLatLngs(latlngs);\r\n break;\r\n case 'MultiPolygon':\r\n latlngs = GeoJSON.coordsToLatLngs(\r\n geojson.geometry.coordinates,\r\n 2,\r\n coordsToLatLng\r\n );\r\n layer.setLatLngs(latlngs);\r\n break;\r\n }\r\n\r\n // update symbol/style\r\n this.redraw(layer.feature.id);\r\n },\r\n\r\n /**\r\n * Feature Management Methods\r\n */\r\n\r\n createLayers: function (features) {\r\n for (var i = features.length - 1; i >= 0; i--) {\r\n var geojson = features[i];\r\n\r\n var layer = this._layers[geojson.id];\r\n var newLayer;\r\n\r\n if (\r\n this._visibleZoom() &&\r\n layer &&\r\n !this._map.hasLayer(layer) &&\r\n (!this.options.timeField || this._featureWithinTimeRange(geojson))\r\n ) {\r\n this._map.addLayer(layer);\r\n this.fire(\r\n 'addfeature',\r\n {\r\n feature: layer.feature\r\n },\r\n true\r\n );\r\n }\r\n\r\n // update geometry if the layer already existed.\r\n if (layer && (layer.setLatLngs || layer.setLatLng)) {\r\n this._updateLayer(layer, geojson);\r\n }\r\n\r\n if (!layer) {\r\n newLayer = this.createNewLayer(geojson);\r\n\r\n if (!newLayer) {\r\n warn('invalid GeoJSON encountered');\r\n } else {\r\n newLayer.feature = geojson;\r\n\r\n // bubble events from individual layers to the feature layer\r\n newLayer.addEventParent(this);\r\n\r\n if (this.options.onEachFeature) {\r\n this.options.onEachFeature(newLayer.feature, newLayer);\r\n }\r\n\r\n // cache the layer\r\n this._layers[newLayer.feature.id] = newLayer;\r\n\r\n // style the layer\r\n this.setFeatureStyle(newLayer.feature.id, this.options.style);\r\n\r\n this.fire(\r\n 'createfeature',\r\n {\r\n feature: newLayer.feature\r\n },\r\n true\r\n );\r\n\r\n // add the layer if the current zoom level is inside the range defined for the layer, it is within the current time bounds or our layer is not time enabled\r\n if (\r\n this._visibleZoom() &&\r\n (!this.options.timeField ||\r\n (this.options.timeField && this._featureWithinTimeRange(geojson)))\r\n ) {\r\n this._map.addLayer(newLayer);\r\n }\r\n }\r\n }\r\n }\r\n },\r\n\r\n addLayers: function (ids) {\r\n for (var i = ids.length - 1; i >= 0; i--) {\r\n var layer = this._layers[ids[i]];\r\n if (\r\n layer &&\r\n (!this.options.timeField || this._featureWithinTimeRange(layer.feature))\r\n ) {\r\n this._map.addLayer(layer);\r\n this.fire(\r\n 'addfeature',\r\n {\r\n feature: layer.feature\r\n },\r\n true\r\n );\r\n }\r\n }\r\n },\r\n\r\n removeLayers: function (ids, permanent) {\r\n for (var i = ids.length - 1; i >= 0; i--) {\r\n var id = ids[i];\r\n var layer = this._layers[id];\r\n if (layer) {\r\n this.fire(\r\n 'removefeature',\r\n {\r\n feature: layer.feature,\r\n permanent: permanent\r\n },\r\n true\r\n );\r\n this._map.removeLayer(layer);\r\n }\r\n if (layer && permanent) {\r\n delete this._layers[id];\r\n }\r\n }\r\n },\r\n\r\n cellEnter: function (bounds, coords) {\r\n if (this._visibleZoom() && !this._zooming && this._map) {\r\n Util.requestAnimFrame(\r\n Util.bind(function () {\r\n var cacheKey = this._cacheKey(coords);\r\n var cellKey = this._cellCoordsToKey(coords);\r\n var layers = this._cache[cacheKey];\r\n if (this._activeCells[cellKey] && layers) {\r\n this.addLayers(layers);\r\n }\r\n }, this)\r\n );\r\n }\r\n },\r\n\r\n cellLeave: function (bounds, coords) {\r\n if (!this._zooming) {\r\n Util.requestAnimFrame(\r\n Util.bind(function () {\r\n if (this._map) {\r\n var cacheKey = this._cacheKey(coords);\r\n var cellKey = this._cellCoordsToKey(coords);\r\n var layers = this._cache[cacheKey];\r\n var mapBounds = this._map.getBounds();\r\n if (!this._activeCells[cellKey] && layers) {\r\n var removable = true;\r\n\r\n for (var i = 0; i < layers.length; i++) {\r\n var layer = this._layers[layers[i]];\r\n if (\r\n layer &&\r\n layer.getBounds &&\r\n mapBounds.intersects(layer.getBounds())\r\n ) {\r\n removable = false;\r\n }\r\n }\r\n\r\n if (removable) {\r\n this.removeLayers(layers, !this.options.cacheLayers);\r\n }\r\n\r\n if (!this.options.cacheLayers && removable) {\r\n delete this._cache[cacheKey];\r\n delete this._cells[cellKey];\r\n delete this._activeCells[cellKey];\r\n }\r\n }\r\n }\r\n }, this)\r\n );\r\n }\r\n },\r\n\r\n /**\r\n * Styling Methods\r\n */\r\n\r\n resetStyle: function () {\r\n this.options.style = this._originalStyle;\r\n this.eachFeature(function (layer) {\r\n this.resetFeatureStyle(layer.feature.id);\r\n }, this);\r\n return this;\r\n },\r\n\r\n setStyle: function (style) {\r\n this.options.style = style;\r\n this.eachFeature(function (layer) {\r\n this.setFeatureStyle(layer.feature.id, style);\r\n }, this);\r\n return this;\r\n },\r\n\r\n resetFeatureStyle: function (id) {\r\n var layer = this._layers[id];\r\n var style = this._originalStyle || Path.prototype.options;\r\n if (layer) {\r\n Util.extend(layer.options, layer.defaultOptions);\r\n this.setFeatureStyle(id, style);\r\n }\r\n return this;\r\n },\r\n\r\n setFeatureStyle: function (id, style) {\r\n var layer = this._layers[id];\r\n if (typeof style === 'function') {\r\n style = style(layer.feature);\r\n }\r\n if (layer.setStyle) {\r\n layer.setStyle(style);\r\n }\r\n return this;\r\n },\r\n\r\n /**\r\n * Utility Methods\r\n */\r\n\r\n eachActiveFeature: function (fn, context) {\r\n // figure out (roughly) which layers are in view\r\n if (this._map) {\r\n var activeBounds = this._map.getBounds();\r\n for (var i in this._layers) {\r\n if (this._currentSnapshot.indexOf(this._layers[i].feature.id) !== -1) {\r\n // a simple point in poly test for point geometries\r\n if (\r\n typeof this._layers[i].getLatLng === 'function' &&\r\n activeBounds.contains(this._layers[i].getLatLng())\r\n ) {\r\n fn.call(context, this._layers[i]);\r\n } else if (\r\n typeof this._layers[i].getBounds === 'function' &&\r\n activeBounds.intersects(this._layers[i].getBounds())\r\n ) {\r\n // intersecting bounds check for polyline and polygon geometries\r\n fn.call(context, this._layers[i]);\r\n }\r\n }\r\n }\r\n }\r\n return this;\r\n },\r\n\r\n eachFeature: function (fn, context) {\r\n for (var i in this._layers) {\r\n fn.call(context, this._layers[i]);\r\n }\r\n return this;\r\n },\r\n\r\n getFeature: function (id) {\r\n return this._layers[id];\r\n },\r\n\r\n bringToBack: function () {\r\n this.eachFeature(function (layer) {\r\n if (layer.bringToBack) {\r\n layer.bringToBack();\r\n }\r\n });\r\n },\r\n\r\n bringToFront: function () {\r\n this.eachFeature(function (layer) {\r\n if (layer.bringToFront) {\r\n layer.bringToFront();\r\n }\r\n });\r\n },\r\n\r\n redraw: function (id) {\r\n if (id) {\r\n this._redraw(id);\r\n }\r\n return this;\r\n },\r\n\r\n _redraw: function (id) {\r\n var layer = this._layers[id];\r\n var geojson = layer.feature;\r\n\r\n // if this looks like a marker\r\n if (layer && layer.setIcon && this.options.pointToLayer) {\r\n // update custom symbology, if necessary\r\n if (this.options.pointToLayer) {\r\n var getIcon = this.options.pointToLayer(\r\n geojson,\r\n latLng(\r\n geojson.geometry.coordinates[1],\r\n geojson.geometry.coordinates[0]\r\n )\r\n );\r\n var updatedIcon = getIcon.options.icon;\r\n layer.setIcon(updatedIcon);\r\n }\r\n }\r\n\r\n // looks like a vector marker (circleMarker)\r\n if (layer && layer.setStyle && this.options.pointToLayer) {\r\n var getStyle = this.options.pointToLayer(\r\n geojson,\r\n latLng(geojson.geometry.coordinates[1], geojson.geometry.coordinates[0])\r\n );\r\n var updatedStyle = getStyle.options;\r\n this.setFeatureStyle(geojson.id, updatedStyle);\r\n }\r\n\r\n // looks like a path (polygon/polyline)\r\n if (layer && layer.setStyle && this.options.style) {\r\n this.resetFeatureStyle(geojson.id);\r\n }\r\n },\r\n\r\n // This is the same as the Layer.openPopup method except it excludes the `FeatureGroup`\r\n // logic to work around https://github.com/Leaflet/Leaflet/issues/8761\r\n openPopup (latlng) {\r\n if (this._popup) {\r\n if (this._popup._prepareOpen(latlng || this._latlng)) {\r\n // open the popup on the map\r\n this._popup.openOn(this._map);\r\n }\r\n }\r\n return this;\r\n },\r\n\r\n // This is the same as the `Layer.openTooltip` method except it excludes the `FeatureGroup`\r\n // logic to work around https://github.com/Leaflet/Leaflet/issues/8761\r\n openTooltip (latlng) {\r\n if (this._tooltip) {\r\n if (this._tooltip._prepareOpen(latlng)) {\r\n // open the tooltip on the map\r\n this._tooltip.openOn(this._map);\r\n\r\n if (this.getElement) {\r\n this._setAriaDescribedByOnLayer(this);\r\n } else if (this.eachLayer) {\r\n this.eachLayer(this._setAriaDescribedByOnLayer, this);\r\n }\r\n }\r\n }\r\n return this;\r\n }\r\n});\r\n\r\nexport function featureLayer (options) {\r\n return new FeatureLayer(options);\r\n}\r\n\r\nexport default featureLayer;\r\n","// export version\r\nimport packageInfo from '../package.json';\r\nvar version = packageInfo.version;\r\nexport { version as VERSION };\r\n\r\n// import base\r\nexport { Support } from './Support';\r\nexport { options } from './Options';\r\nexport { EsriUtil as Util } from './Util';\r\nexport { get, post, request } from './Request';\r\n\r\n// export tasks\r\nexport { Task, task } from './Tasks/Task';\r\nexport { Query, query } from './Tasks/Query';\r\nexport { Find, find } from './Tasks/Find';\r\nexport { Identify, identify } from './Tasks/Identify';\r\nexport { IdentifyFeatures, identifyFeatures } from './Tasks/IdentifyFeatures';\r\nexport { IdentifyImage, identifyImage } from './Tasks/IdentifyImage';\r\n\r\n// export services\r\nexport { Service, service } from './Services/Service';\r\nexport { MapService, mapService } from './Services/MapService';\r\nexport { ImageService, imageService } from './Services/ImageService';\r\nexport { FeatureLayerService, featureLayerService } from './Services/FeatureLayerService';\r\n\r\n// export layers\r\nexport { BasemapLayer, basemapLayer } from './Layers/BasemapLayer';\r\nexport { TiledMapLayer, tiledMapLayer } from './Layers/TiledMapLayer';\r\nexport { RasterLayer } from './Layers/RasterLayer';\r\nexport { ImageMapLayer, imageMapLayer } from './Layers/ImageMapLayer';\r\nexport { DynamicMapLayer, dynamicMapLayer } from './Layers/DynamicMapLayer';\r\nexport { FeatureManager } from './Layers/FeatureLayer/FeatureManager';\r\nexport { FeatureLayer, featureLayer } from './Layers/FeatureLayer/FeatureLayer';\r\n"],"names":["cors","window","XMLHttpRequest","pointerEvents","document","documentElement","style","Support","options","attributionWidthOffset","callbacks","serialize","params","data","key","f","Object","prototype","hasOwnProperty","call","value","param","type","toString","length","JSON","stringify","join","valueOf","encodeURIComponent","replaceAll","createRequest","callback","context","httpRequest","onerror","e","onreadystatechange","Util","falseFn","error","code","message","response","readyState","parse","responseText","ontimeout","this","xmlHttpPost","url","open","timeout","setRequestHeader","send","xmlHttpGet","withCredentials","request","paramString","requestLength","jsonp","warn","_EsriLeafletCallbacks","callbackId","responseType","script","DomUtil","create","body","src","id","addClass","abort","_callback","get","console","apply","arguments","CORS","JSONP","Request","post","edgeIntersectsEdge","a1","a2","b1","b2","uaT","ubT","uB","ua","ub","arrayIntersectsArray","a","b","i","j","closeRing","coordinates","pointsEqual","push","ringIsClockwise","ringToTest","pt2","total","rLength","pt1","shallowClone","obj","target","coordinatesContainCoordinates","outer","inner","intersects","contains","point","l","coordinatesContainPoint","arcgisToGeoJSON","arcgis","idAttribute","geojson","features","x","y","z","points","slice","paths","rings","outerRing","hole","outerRings","holes","r","ring","polygon","reverse","uncontainedHoles","pop","contained","convertRingsToGeoJSON","xmin","ymin","xmax","ymax","geometry","attributes","properties","keys","Error","getId","err","spatialReference","wkid","orientRings","poly","output","shift","geojsonToArcGIS","result","hasZ","flattenMultiPolygonRings","geometries","idAttr","g2a","a2g","extentToBounds","extent","sw","latLng","ne","latLngBounds","boundsToExtent","bounds","getSouthWest","lng","lat","getNorthEast","knownFieldNames","_findIdAttributeFromResponse","objectIdFieldName","fields","name","match","_findIdAttributeFromFeature","feature","responseToFeatureCollection","objectIdField","results","count","featureCollection","cleanUrl","trim","getUrlParams","indexOf","requestParams","queryString","substring","split","decodeURI","replace","isArcgisOnline","test","geojsonTypeToArcGIS","geoJsonType","arcgisGeometryType","calcAttributionWidth","map","getSize","setEsriAttribution","attributionControl","_esriAttributionLayerCount","_esriAttributionAddedOnce","hoverAttributionStyle","createElement","innerHTML","getElementsByTagName","appendChild","attributionStyle","on","_container","maxWidth","removeEsriAttribution","removeClass","_setGeometry","geometryType","LatLngBounds","getLatLng","LatLng","GeoJSON","getLayers","toGeoJSON","_getAttributionData","bind","attributions","_esriAttributions","c","contributors","contributor","coverageAreas","coverageArea","southWest","bbox","northEast","attribution","score","minZoom","zoomMin","maxZoom","zoomMax","sort","_updateMapAttribution","evt","oldAttributions","attributionElement","querySelector","newAttributions","getBounds","wrappedBounds","wrap","zoom","getZoom","text","POWERED_BY_ESRI_ATTRIBUTION_STRING","substr","fire","EsriUtil","Task","Class","extend","proxy","useCors","generateSetter","initialize","endpoint","_service","setOptions","setters","setter","token","authenticate","apikey","format","boolean","returnUnformattedValues","path","_request","method","Query","offset","limit","precision","featureIds","returnGeometry","returnM","transform","where","outSR","outFields","within","_setGeometryParams","spatialRel","crosses","touches","overlaps","bboxIntersects","indexIntersects","nearby","latlng","radius","units","distance","inSR","string","between","start","end","time","simplify","factor","mapWidth","Math","abs","getWest","getEast","maxAllowableOffset","orderBy","fieldName","order","orderByFields","run","_cleanParams","isModern","undefined","_trapSQLerrors","returnCountOnly","ids","returnIdsOnly","objectIds","returnExtentOnly","distinct","returnDistinctValues","pixelSize","rawPoint","castPoint","layer","converted","query","Find","sr","layers","dynamicLayers","returnZ","gdbVersion","layerDefs","find","Identify","IdentifyFeatures","tolerance","size","imageDisplay","mapExtent","at","layerDef","layerId","identifyFeatures","IdentifyImage","setMosaicRule","setRenderingRule","setPixelSize","returnCatalogItems","getMosaicRule","mosaicRule","getRenderingRule","renderingRule","getPixelSize","_responseToGeoJSON","location","catalogItems","catalogItemVisibilities","geoJSON","pixel","crs","OBJECTID","objectId","Values","values","catalogItemVisibility","identifyImage","Service","Evented","_requestQueue","_authenticating","metadata","_runQueue","getTimeout","setTimeout","wrappedCallback","_createServiceCallback","MapService","identify","mapService","ImageService","imageService","FeatureLayerService","addFeature","addFeatures","featuresArray","addResults","updateFeature","updateFeatures","updateResults","deleteFeature","deleteFeatures","deleteResults","featureLayerService","tileProtocol","protocol","BasemapLayer","TileLayer","statics","TILES","Streets","urlTemplate","subdomains","attributionUrl","Topographic","Oceans","OceansLabels","pane","NationalGeographic","DarkGray","DarkGrayLabels","Gray","GrayLabels","Imagery","ImageryLabels","ImageryTransportation","ShadedRelief","ShadedReliefLabels","Terrain","TerrainLabels","USATopo","ImageryClarity","Physical","ImageryFirefly","config","tileOptions","ignoreDeprecationWarning","onAdd","_initPane","onRemove","off","_map","getPane","createPane","zIndex","getAttribution","TiledMapLayer","zoomOffsetAllowance","errorTileUrl","MercatorZoomLevels","tileUrl","getParamString","service","addEventParent","RegExp","getTileUrl","tilePoint","_getZoomForUrl","template","s","_getSubdomain","_lodMap","createTile","coords","done","tile","DomEvent","_tileOnLoad","_tileOnError","crossOrigin","alt","once","latestWkid","copyrightText","addAttribution","CRS","EPSG3857","arcgisLODs","tileInfo","lods","correctResolutions","arcgisLOD","ci","correctRes","_withinPercentage","resolution","level","tokenQs","percentage","Overlay","ImageOverlay","_topLeft","getPixelBounds","min","_reset","setPosition","_image","subtract","getPixelOrigin","RasterLayer","Layer","opacity","position","interactive","_update","throttle","updateInterval","_currentImage","_bounds","equals","addLayer","removeLayer","_popup","_getPopupData","_resetPopupState","bindPopup","fn","popupOptions","_shouldRenderPopup","_lastClick","popup","_popupFunction","unbindPopup","closePopup","bringToFront","_setAutoZIndex","max","bringToBack","setZIndex","compare","children","edgeZIndex","Infinity","len","isFinite","getOpacity","setOpacity","getTimeRange","from","to","setTimeRange","redraw","_renderImage","contentType","image","addTo","onOverlayError","onOverlayLoad","newImage","oldImage","_animatingZoom","_panTransition","_inProgress","_buildExportParams","_requestExport","_renderPopup","content","setLatLng","setContent","openOn","_calculateBbox","pixelBounds","unproject","getBottomLeft","getTopRight","neProjected","project","swProjected","boundsProjected","_calculateImageSize","top","latLngToLayerPoint","bottom","ImageMapLayer","transparent","setPixelType","pixelType","getPixelType","setBandIds","bandIds","isArray","getBandIds","setNoData","noData","noDataInterpretation","getNoData","getNoDataInterpretation","identifyRequest","parseInt","bboxSR","imageSR","interpolation","compressionQuality","href","fullUrl","DynamicMapLayer","timeOptions","getDynamicLayers","setDynamicLayers","setLayers","getLayerDefs","setLayerDefs","getTimeOptions","setTimeOptions","dpi","disableCache","_ts","Date","now","imageData","FeatureGrid","cellSize","updateWhenIdle","Browser","mobile","noWrap","keepBuffer","_cells","_activeCells","_resetView","_removeAllCells","_cellZoom","isLoading","_loading","getEvents","events","viewprereset","_invalidateAll","viewreset","moveend","_onMoveEnd","_onMove","move","createCell","removeCell","reuseCell","cellLeave","cellEnter","getCellSize","Point","_pruneCells","cell","retain","current","active","_retainParent","_retainChildren","_removeCell","x2","floor","y2","z2","coords2","_cellCoordsToKey","loaded","animating","pinch","flyTo","_setView","getCenter","center","noPrune","noUpdate","cellZoom","round","_abortLoading","_resetGrid","_noPrune","_cellSize","getPixelWorldBounds","_globalCellRange","_pxBoundsToCellRange","_wrapX","wrapLng","ceil","_wrapY","wrapLat","_getCelldPixelBounds","mapZoom","_animateToZoom","scale","getZoomScale","pixelCenter","halfSize","divideBy","Bounds","add","cellRange","cellCenter","queue","margin","noPruneRange","_isValidCell","distanceTo","_key","_coords","_keyToCellCoords","_reuseCell","_createCell","infinite","cellBounds","_cellCoordsToBounds","_keyToBounds","_cellCoordsToNwSe","nwPoint","scaleBy","sePoint","bp","wrapLatLngBounds","k","wrappedCoords","_wrapCoords","requestAnimFrame","_cellReady","_getCellPos","newCoords","wrapNum","unscaleBy","BinarySearchIndex","concat","index","getIndex","dirty","currentIndex","currentElement","minIndex","maxIndex","startIndex","endIndex","insert","item","splice","bulkAdd","items","FeatureManager","timeField","timeFilterMode","simplifyFactor","fetchAllFeatures","oidCheck","_startTimeIndex","_endTimeIndex","_timeIndex","_cache","_currentSnapshot","_activeRequests","supportedFormats","supportedQueryFormats","forceJsonFormat","_handleZoomChange","_visibleZoom","_requestFeatures","originalWhere","_buildQuery","exceededTransferLimit","_addFeatures","_postProcessFeatures","_cacheKey","_buildTimeIndexes","createLayers","isNaN","setWhere","oldSnapshot","newSnapshot","pendingRequests","requestError","requestCallback","removeLayers","addLayers","getWhere","oldFrom","oldTo","_filterExistingFeatures","refresh","newFrom","newTo","layersToRemove","_getFeaturesInTimeRange","layersToAdd","shouldRemoveLayer","search","startTimes","endTimes","startTimeEntries","endTimeEntries","timeEntries","_featureWithinTimeRange","date","startDate","endDate","_getMetadata","_metadata","responseArray","FeatureLayer","cacheLayers","_originalStyle","_layers","permanent","createNewLayer","geometryToLayer","defaultOptions","_updateLayer","latlngs","coordsToLatLng","coordsToLatLngs","setLatLngs","newLayer","hasLayer","onEachFeature","setFeatureStyle","_zooming","cacheKey","cellKey","mapBounds","removable","resetStyle","eachFeature","resetFeatureStyle","setStyle","Path","eachActiveFeature","activeBounds","getFeature","_redraw","setIcon","pointToLayer","updatedIcon","icon","updatedStyle","openPopup","_prepareOpen","_latlng","openTooltip","_tooltip","getElement","_setAriaDescribedByOnLayer","eachLayer","version","packageInfo"],"mappings":";;;8SAAWA,EAASC,OAAOC,gBAAkB,oBAAqB,IAAID,OAAOC,eAClEC,EAAiE,KAAjDC,SAASC,gBAAgBC,MAAMH,cAE/CI,EAAU,CACnBP,KAAMA,EACNG,cAAeA,GCLNK,EAAU,CACnBC,uBAAwB,ICEtBC,EAAY,EAEhB,SAASC,EAAW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B,2BAA2BhyB,MACvBA,KAAKiyB,WACdjyB,KAAKiyB,UAAUjyB,KAAKgyB,2BAA4BhyB,OAI/CA,IACR,ICvbC,IAAAkyB,GAAUC,+UTwRP,SAAuBr0B,EAAKN,GACjC,OAAO,IAAI2Z,GAAarZ,EAAKN,EAC/B,oBIlFO,SAA0B0C,EAAK1C,GACpC,OAAO,IAAIwlB,GAAgB9iB,EAAK1C,EAClC,iBIgPO,SAAuBA,GAC5B,OAAO,IAAI8xB,GAAa9xB,EAC1B,uDfnbO,SAAmBA,GACxB,OAAO,IAAI6V,EAAS7V,EACtB,0DU4LO,SAAwB0C,EAAK1C,GAClC,OAAO,IAAIkkB,GAAcxhB,EAAK1C,EAChC,yFPtEO,SAAkBA,GAEvB,OADAA,EAAU0L,EAAa1L,GAChB,IAAI8X,GAAQ9X,EACrB,SNpDO,SAAeA,GAEpB,OADAA,EAAU0L,EAAa1L,GAChB,IAAIoQ,EAAKpQ,EAClB,kBWyGO,SAAwB0C,EAAK1C,GAClC,OAAO,IAAImc,GAAczZ,EAAK1C,EAChC"} \ No newline at end of file diff --git a/dist/siteData.json b/dist/siteData.json new file mode 100644 index 000000000..b51f04391 --- /dev/null +++ b/dist/siteData.json @@ -0,0 +1 @@ +{"name": "esri-leaflet","version": "3.0.12","lib": {"path": "dist/esri-leaflet.js","integrity": "sha512-G4+fuKc1B96F0sUG7eKtgiJr0JM3iQC4bfc8WtYvmm7msHES0Hst2mLWASPb8zZk91tqMG86AjP0tgXIEFPPUA=="}}