geoblacklight 4.0.0.pre.alpha.1 → 4.0.0.pre.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE.md +1 -1
- data/.github/workflows/ruby.yml +32 -64
- data/.gitignore +1 -0
- data/.rubocop.yml +6 -6
- data/.rubocop_todo.yml +0 -3
- data/.solr_wrapper +1 -0
- data/README.md +1 -4
- data/Rakefile +0 -1
- data/app/assets/images/blacklight/child-item.svg +3 -0
- data/app/assets/images/blacklight/collections.svg +4 -0
- data/app/assets/images/blacklight/datasets.svg +7 -0
- data/app/assets/images/blacklight/geoblacklight-icons.json +363 -332
- data/app/assets/images/blacklight/imagery.svg +4 -0
- data/app/assets/images/blacklight/maps.svg +4 -0
- data/app/assets/images/blacklight/michigan-state-university.svg +0 -1
- data/app/assets/images/blacklight/parent-item.svg +3 -0
- data/app/assets/images/blacklight/pennsylvania-state-university.svg +0 -1
- data/app/assets/images/blacklight/purdue-university.svg +0 -1
- data/app/assets/images/blacklight/the-ohio-state-university.svg +0 -1
- data/app/assets/images/blacklight/university-of-chicago.svg +0 -1
- data/app/assets/images/blacklight/university-of-colorado-boulder.svg +6 -0
- data/app/assets/images/blacklight/university-of-illinois-urbana-champaign.svg +0 -1
- data/app/assets/images/blacklight/university-of-iowa.svg +0 -1
- data/app/assets/images/blacklight/university-of-maryland.svg +0 -1
- data/app/assets/images/blacklight/university-of-michigan.svg +0 -1
- data/app/assets/images/blacklight/university-of-minnesota.svg +0 -1
- data/app/assets/images/blacklight/university-of-nebraska-lincoln.svg +0 -1
- data/app/assets/images/blacklight/university-of-wisconsin-madison.svg +0 -1
- data/app/assets/images/blacklight/websites.svg +4 -0
- data/app/assets/javascripts/geoblacklight/controls/fullscreen.js +8 -0
- data/app/assets/javascripts/geoblacklight/geoblacklight.js +2 -1
- data/app/assets/javascripts/geoblacklight/viewers/esri.js +1 -0
- data/app/assets/javascripts/geoblacklight/viewers/index_map.js +1 -0
- data/app/assets/javascripts/geoblacklight/viewers/tilejson.js +33 -0
- data/app/assets/javascripts/geoblacklight/viewers/tms.js +2 -2
- data/app/assets/javascripts/geoblacklight/viewers/viewer.js +3 -0
- data/app/assets/javascripts/geoblacklight/viewers/wms.js +2 -2
- data/app/assets/javascripts/geoblacklight/viewers/wmts.js +85 -0
- data/app/assets/javascripts/geoblacklight/viewers/xyz.js +10 -0
- data/app/assets/stylesheets/geoblacklight/geoblacklight.scss +1 -0
- data/app/assets/stylesheets/geoblacklight/modules/_base.scss +0 -1
- data/app/assets/stylesheets/geoblacklight/modules/_styles.scss +5 -1
- data/app/assets/stylesheets/geoblacklight/modules/downloads.scss +20 -47
- data/app/assets/stylesheets/geoblacklight/modules/index_maps.scss +68 -0
- data/app/assets/stylesheets/geoblacklight/modules/item.scss +16 -0
- data/app/assets/stylesheets/geoblacklight/modules/modal.scss +6 -0
- data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +4 -0
- data/app/components/geoblacklight/icon_facet_item_component.rb +33 -0
- data/app/helpers/geoblacklight_helper.rb +6 -45
- data/app/models/concerns/geoblacklight/bbox_filter_field.rb +45 -0
- data/app/models/concerns/geoblacklight/bbox_filter_query.rb +50 -0
- data/app/models/concerns/geoblacklight/solr_document.rb +1 -1
- data/app/models/concerns/geoblacklight/suppressed_records_search_behavior.rb +26 -0
- data/app/presenters/geoblacklight/bbox_item_presenter.rb +9 -0
- data/app/views/catalog/_downloads_collapse.html.erb +27 -0
- data/app/views/catalog/_header_icons.html.erb +2 -2
- data/app/views/catalog/_index_split_default.html.erb +2 -2
- data/app/views/catalog/_show_default_viewer_container.html.erb +17 -0
- data/app/views/catalog/_show_downloads.html.erb +10 -21
- data/app/views/catalog/_show_sidebar.html.erb +3 -0
- data/app/views/catalog/_show_web_services.html.erb +11 -0
- data/app/views/catalog/_web_services.html.erb +3 -2
- data/app/views/catalog/web_services.html.erb +1 -1
- data/app/views/relation/_relations.html.erb +1 -1
- data/app/views/relation/index.html.erb +1 -1
- data/config/locales/geoblacklight.en.yml +4 -1
- data/geoblacklight.gemspec +6 -6
- data/lib/generators/geoblacklight/install_generator.rb +1 -1
- data/lib/generators/geoblacklight/templates/assets/_customizations.scss +5 -4
- data/lib/generators/geoblacklight/templates/assets/application.scss +0 -3
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +74 -56
- data/lib/generators/geoblacklight/templates/settings.gbl_v1.yml +5 -5
- data/lib/generators/geoblacklight/templates/settings.yml +36 -23
- data/lib/geoblacklight/bounding_box.rb +4 -0
- data/lib/geoblacklight/constants.rb +3 -0
- data/lib/geoblacklight/engine.rb +3 -2
- data/lib/geoblacklight/faraday_middleware/follow_redirects.rb +176 -0
- data/lib/geoblacklight/item_viewer.rb +13 -1
- data/lib/geoblacklight/metadata/base.rb +2 -1
- data/lib/geoblacklight/version.rb +1 -1
- data/lib/geoblacklight/view_helper_override.rb +2 -28
- data/lib/geoblacklight.rb +0 -10
- data/lib/tasks/geoblacklight.rake +1 -1
- data/schema/geoblacklight-schema-aardvark.json +3 -23
- data/solr/conf/schema.xml +37 -43
- data/solr/conf/solrconfig.xml +17 -17
- data/spec/components/geoblacklight/icon_facet_item_component_spec.rb +17 -0
- data/spec/controllers/catalog_controller_spec.rb +1 -1
- data/spec/features/download_layer_spec.rb +31 -14
- data/spec/features/esri_viewer_spec.rb +5 -1
- data/spec/features/full_screen_controll_spec.rb +15 -0
- data/spec/features/home_page_spec.rb +2 -2
- data/spec/features/index_map_spec.rb +2 -2
- data/spec/features/missing_metadata_spec.rb +1 -1
- data/spec/features/multiple_downloads_spec.rb +2 -1
- data/spec/features/relations_spec.rb +1 -1
- data/spec/features/saved_searches_spec.rb +1 -1
- data/spec/features/search_results_complex_geometry_spec.rb +24 -0
- data/spec/features/search_results_icons_spec.rb +16 -0
- data/spec/features/search_results_map_spec.rb +2 -2
- data/spec/features/search_spec.rb +22 -0
- data/spec/features/show_page_download_spec.rb +29 -0
- data/spec/features/show_page_metadata_spec.rb +2 -2
- data/spec/features/split_view.html.erb_spec.rb +12 -1
- data/spec/features/tilejson_spec.rb +22 -0
- data/spec/features/tms_spec.rb +2 -2
- data/spec/features/web_services_modal_spec.rb +35 -2
- data/spec/features/wmts_spec.rb +34 -0
- data/spec/features/xyz_spec.rb +10 -0
- data/spec/fixtures/manifests/tilejson.json +21 -0
- data/spec/fixtures/manifests/wmts-multiple.xml +813 -0
- data/spec/fixtures/manifests/wmts-single.xml +126 -0
- data/spec/fixtures/solr_documents/README.md +46 -43
- data/spec/fixtures/solr_documents/actual-papermap1.json +2 -1
- data/spec/fixtures/solr_documents/actual-point1.json +2 -1
- data/spec/fixtures/solr_documents/actual-polygon1.json +2 -1
- data/spec/fixtures/solr_documents/actual-raster1.json +3 -2
- data/spec/fixtures/solr_documents/baruch_ancestor1.json +2 -1
- data/spec/fixtures/solr_documents/baruch_ancestor2.json +2 -1
- data/spec/fixtures/solr_documents/baruch_documentation_download.json +1 -1
- data/spec/fixtures/solr_documents/bbox-spans-180.json +2 -1
- data/spec/fixtures/solr_documents/cornell_html_metadata.json +4 -3
- data/spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json +3 -2
- data/spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json +3 -2
- data/spec/fixtures/solr_documents/esri-feature-layer.json +2 -1
- data/spec/fixtures/solr_documents/esri-image-map-layer.json +3 -2
- data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +2 -1
- data/spec/fixtures/solr_documents/esri-wms-layer.json +2 -1
- data/spec/fixtures/solr_documents/harvard_raster.json +3 -2
- data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +3 -2
- data/spec/fixtures/solr_documents/index-map-polygon-no-downloadurl.json +2 -1
- data/spec/fixtures/solr_documents/index-map-polygon.json +2 -1
- data/spec/fixtures/solr_documents/index-map-stanford.json +2 -1
- data/spec/fixtures/solr_documents/index_map_point.json +3 -2
- data/spec/fixtures/solr_documents/metadata_no_provider.json +2 -1
- data/spec/fixtures/solr_documents/multiple-downloads.json +3 -2
- data/spec/fixtures/solr_documents/no_spatial.json +1 -4
- data/spec/fixtures/solr_documents/oembed.json +2 -1
- data/spec/fixtures/solr_documents/princeton-child1.json +3 -2
- data/spec/fixtures/solr_documents/princeton-child2.json +3 -2
- data/spec/fixtures/solr_documents/princeton-child3.json +2 -1
- data/spec/fixtures/solr_documents/princeton-child4.json +3 -2
- data/spec/fixtures/solr_documents/princeton-parent.json +5 -3
- data/spec/fixtures/solr_documents/public_direct_download.json +2 -1
- data/spec/fixtures/solr_documents/public_iiif_princeton.json +3 -2
- data/spec/fixtures/solr_documents/public_polygon_mit.json +2 -1
- data/spec/fixtures/solr_documents/restricted-line.json +2 -1
- data/spec/fixtures/solr_documents/tilejson.json +48 -0
- data/spec/fixtures/solr_documents/tms.json +15 -18
- data/spec/fixtures/solr_documents/umn_metro_result1.json +5 -3
- data/spec/fixtures/solr_documents/umn_state_result1.json +3 -2
- data/spec/fixtures/solr_documents/umn_state_result2.json +3 -5
- data/spec/fixtures/solr_documents/uva_slug_colon.json +2 -1
- data/spec/fixtures/solr_documents/wmts-multiple.json +41 -0
- data/spec/fixtures/solr_documents/wmts-single-layer.json +48 -0
- data/spec/fixtures/solr_documents/xyz.json +46 -0
- data/spec/helpers/geoblacklight_helper_spec.rb +12 -35
- data/spec/lib/geoblacklight/document_presenter_spec.rb +3 -3
- data/spec/lib/geoblacklight/download/geojson_download_spec.rb +1 -1
- data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +1 -1
- data/spec/lib/geoblacklight/download/kmz_download_spec.rb +1 -1
- data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +1 -1
- data/spec/lib/geoblacklight/download_spec.rb +2 -2
- data/spec/lib/geoblacklight/metadata/base_spec.rb +19 -1
- data/spec/lib/geoblacklight/references_spec.rb +1 -1
- data/spec/lib/geoblacklight/relation/relation_response_spec.rb +5 -0
- data/spec/lib/geoblacklight/view_helper_override_spec.rb +0 -10
- data/spec/models/concerns/geoblacklight/bbox_filter_field_spec.rb +77 -0
- data/spec/models/concerns/geoblacklight/bbox_filter_query_spec.rb +105 -0
- data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +2 -1
- data/spec/models/concerns/geoblacklight/suppressed_records_search_behavior_spec.rb +31 -0
- data/spec/presenters/geoblacklight/bbox_item_presenter_spec.rb +36 -0
- data/spec/spec_helper.rb +6 -1
- data/spec/test_app_templates/Gemfile.extra +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +4 -4
- data/spec/views/catalog/_show_downloads.html.erb_spec.rb +5 -5
- data/template.rb +2 -4
- data/vendor/assets/images/fullscreen.png +0 -0
- data/vendor/assets/images/fullscreen@2x.png +0 -0
- data/vendor/assets/javascripts/Leaflet.fullscreen.js +152 -0
- data/vendor/assets/javascripts/esri-leaflet.js +10 -3
- data/vendor/assets/javascripts/esri-leaflet.js.map +1 -1
- data/vendor/assets/javascripts/leaflet-iiif.js +39 -18
- data/vendor/assets/javascripts/leaflet-src.js.erb +14062 -0
- data/vendor/assets/javascripts/leaflet-src.js.map +1 -1
- data/vendor/assets/stylesheets/leaflet.css +640 -634
- data/vendor/assets/stylesheets/leaflet.fullscreen.css +40 -0
- metadata +91 -46
- data/app/models/concerns/geoblacklight/spatial_search_behavior.rb +0 -71
- data/app/views/catalog/_download_generated_link.html.erb +0 -4
- data/app/views/catalog/_download_link.html.erb +0 -3
- data/app/views/catalog/_downloads_generated.html.erb +0 -6
- data/app/views/catalog/_downloads_primary.html.erb +0 -21
- data/app/views/catalog/_downloads_secondary.html.erb +0 -39
- data/app/views/catalog/_icon_facet.html.erb +0 -16
- data/bin/coverage.rb +0 -36
- data/lib/generators/geoblacklight/templates/Procfile +0 -3
- data/lib/generators/geoblacklight/templates/package.json +0 -14
- data/lib/generators/geoblacklight/templates/webpacker.yml +0 -67
- data/lib/generators/geoblacklight/webpacker_generator.rb +0 -36
- data/lib/geoblacklight/catalog_helper_override.rb +0 -14
- data/spec/models/concerns/geoblacklight/spatial_search_behavior_spec.rb +0 -97
- data/vendor/assets/javascripts/leaflet.js.erb +0 -13922
- data/vendor/assets/stylesheets/leaflet-label.css +0 -54
@@ -0,0 +1,152 @@
|
|
1
|
+
L.Control.Fullscreen = L.Control.extend({
|
2
|
+
options: {
|
3
|
+
position: 'topleft',
|
4
|
+
title: {
|
5
|
+
'false': 'View Fullscreen',
|
6
|
+
'true': 'Exit Fullscreen'
|
7
|
+
}
|
8
|
+
},
|
9
|
+
|
10
|
+
onAdd: function (map) {
|
11
|
+
var container = L.DomUtil.create('div', 'leaflet-control-fullscreen leaflet-bar leaflet-control');
|
12
|
+
|
13
|
+
this.link = L.DomUtil.create('a', 'leaflet-control-fullscreen-button leaflet-bar-part', container);
|
14
|
+
this.link.href = '#';
|
15
|
+
|
16
|
+
this._map = map;
|
17
|
+
this._map.on('fullscreenchange', this._toggleTitle, this);
|
18
|
+
this._toggleTitle();
|
19
|
+
|
20
|
+
L.DomEvent.on(this.link, 'click', this._click, this);
|
21
|
+
|
22
|
+
return container;
|
23
|
+
},
|
24
|
+
|
25
|
+
_click: function (e) {
|
26
|
+
L.DomEvent.stopPropagation(e);
|
27
|
+
L.DomEvent.preventDefault(e);
|
28
|
+
this._map.toggleFullscreen(this.options);
|
29
|
+
},
|
30
|
+
|
31
|
+
_toggleTitle: function() {
|
32
|
+
this.link.title = this.options.title[this._map.isFullscreen()];
|
33
|
+
}
|
34
|
+
});
|
35
|
+
|
36
|
+
L.Map.include({
|
37
|
+
isFullscreen: function () {
|
38
|
+
return this._isFullscreen || false;
|
39
|
+
},
|
40
|
+
|
41
|
+
toggleFullscreen: function (options) {
|
42
|
+
var container = this.getContainer();
|
43
|
+
if (this.isFullscreen()) {
|
44
|
+
if (options && options.pseudoFullscreen) {
|
45
|
+
this._disablePseudoFullscreen(container);
|
46
|
+
} else if (document.exitFullscreen) {
|
47
|
+
document.exitFullscreen();
|
48
|
+
} else if (document.mozCancelFullScreen) {
|
49
|
+
document.mozCancelFullScreen();
|
50
|
+
} else if (document.webkitCancelFullScreen) {
|
51
|
+
document.webkitCancelFullScreen();
|
52
|
+
} else if (document.msExitFullscreen) {
|
53
|
+
document.msExitFullscreen();
|
54
|
+
} else {
|
55
|
+
this._disablePseudoFullscreen(container);
|
56
|
+
}
|
57
|
+
} else {
|
58
|
+
if (options && options.pseudoFullscreen) {
|
59
|
+
this._enablePseudoFullscreen(container);
|
60
|
+
} else if (container.requestFullscreen) {
|
61
|
+
container.requestFullscreen();
|
62
|
+
} else if (container.mozRequestFullScreen) {
|
63
|
+
container.mozRequestFullScreen();
|
64
|
+
} else if (container.webkitRequestFullscreen) {
|
65
|
+
container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
|
66
|
+
} else if (container.msRequestFullscreen) {
|
67
|
+
container.msRequestFullscreen();
|
68
|
+
} else {
|
69
|
+
this._enablePseudoFullscreen(container);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
},
|
74
|
+
|
75
|
+
_enablePseudoFullscreen: function (container) {
|
76
|
+
L.DomUtil.addClass(container, 'leaflet-pseudo-fullscreen');
|
77
|
+
this._setFullscreen(true);
|
78
|
+
this.fire('fullscreenchange');
|
79
|
+
},
|
80
|
+
|
81
|
+
_disablePseudoFullscreen: function (container) {
|
82
|
+
L.DomUtil.removeClass(container, 'leaflet-pseudo-fullscreen');
|
83
|
+
this._setFullscreen(false);
|
84
|
+
this.fire('fullscreenchange');
|
85
|
+
},
|
86
|
+
|
87
|
+
_setFullscreen: function(fullscreen) {
|
88
|
+
this._isFullscreen = fullscreen;
|
89
|
+
var container = this.getContainer();
|
90
|
+
if (fullscreen) {
|
91
|
+
L.DomUtil.addClass(container, 'leaflet-fullscreen-on');
|
92
|
+
} else {
|
93
|
+
L.DomUtil.removeClass(container, 'leaflet-fullscreen-on');
|
94
|
+
}
|
95
|
+
this.invalidateSize();
|
96
|
+
},
|
97
|
+
|
98
|
+
_onFullscreenChange: function (e) {
|
99
|
+
var fullscreenElement =
|
100
|
+
document.fullscreenElement ||
|
101
|
+
document.mozFullScreenElement ||
|
102
|
+
document.webkitFullscreenElement ||
|
103
|
+
document.msFullscreenElement;
|
104
|
+
|
105
|
+
if (fullscreenElement === this.getContainer() && !this._isFullscreen) {
|
106
|
+
this._setFullscreen(true);
|
107
|
+
this.fire('fullscreenchange');
|
108
|
+
} else if (fullscreenElement !== this.getContainer() && this._isFullscreen) {
|
109
|
+
this._setFullscreen(false);
|
110
|
+
this.fire('fullscreenchange');
|
111
|
+
}
|
112
|
+
}
|
113
|
+
});
|
114
|
+
|
115
|
+
L.Map.mergeOptions({
|
116
|
+
fullscreenControl: false
|
117
|
+
});
|
118
|
+
|
119
|
+
L.Map.addInitHook(function () {
|
120
|
+
if (this.options.fullscreenControl) {
|
121
|
+
this.fullscreenControl = new L.Control.Fullscreen(this.options.fullscreenControl);
|
122
|
+
this.addControl(this.fullscreenControl);
|
123
|
+
}
|
124
|
+
|
125
|
+
var fullscreenchange;
|
126
|
+
|
127
|
+
if ('onfullscreenchange' in document) {
|
128
|
+
fullscreenchange = 'fullscreenchange';
|
129
|
+
} else if ('onmozfullscreenchange' in document) {
|
130
|
+
fullscreenchange = 'mozfullscreenchange';
|
131
|
+
} else if ('onwebkitfullscreenchange' in document) {
|
132
|
+
fullscreenchange = 'webkitfullscreenchange';
|
133
|
+
} else if ('onmsfullscreenchange' in document) {
|
134
|
+
fullscreenchange = 'MSFullscreenChange';
|
135
|
+
}
|
136
|
+
|
137
|
+
if (fullscreenchange) {
|
138
|
+
var onFullscreenChange = L.bind(this._onFullscreenChange, this);
|
139
|
+
|
140
|
+
this.whenReady(function () {
|
141
|
+
L.DomEvent.on(document, fullscreenchange, onFullscreenChange);
|
142
|
+
});
|
143
|
+
|
144
|
+
this.on('unload', function () {
|
145
|
+
L.DomEvent.off(document, fullscreenchange, onFullscreenChange);
|
146
|
+
});
|
147
|
+
}
|
148
|
+
});
|
149
|
+
|
150
|
+
L.control.fullscreen = function (options) {
|
151
|
+
return new L.Control.Fullscreen(options);
|
152
|
+
};
|
@@ -1,5 +1,12 @@
|
|
1
|
-
/* esri-leaflet -
|
2
|
-
* Copyright (c)
|
1
|
+
/* esri-leaflet - v3.0.4 - Mon Dec 06 2021 15:19:56 GMT-0600 (Central Standard Time)
|
2
|
+
* Copyright (c) 2021 Environmental Systems Research Institute, Inc.
|
3
3
|
* Apache-2.0 */
|
4
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("leaflet")):"function"==typeof define&&define.amd?define(["exports","leaflet"],e):e((t.L=t.L||{},t.L.esri={}),t.L)}(this,function(t,e){"use strict";var i=window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest,s=""===document.documentElement.style.pointerEvents,r={cors:i,pointerEvents:s},n={attributionWidthOffset:55},o=0;function a(t){var e="";for(var i in t.f=t.f||"json",t)if(t.hasOwnProperty(i)){var s,r=t[i],n=Object.prototype.toString.call(r);e.length&&(e+="&"),s="[object Array]"===n?"[object Object]"===Object.prototype.toString.call(r[0])?JSON.stringify(r):r.join(","):"[object Object]"===n?JSON.stringify(r):"[object Date]"===n?r.valueOf():r,e+=encodeURIComponent(i)+"="+encodeURIComponent(s)}return e}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,n;if(4===s.readyState){try{r=JSON.parse(s.responseText)}catch(t){r=null,n={code:500,message:"Could not parse response as JSON. This could also be caused by a CORS or XMLHttpRequest error."}}!n&&r.error&&(n=r.error,r=null),s.onerror=e.Util.falseFn,t.call(i,n,r)}},s.ontimeout=function(){this.onerror()},s}function l(t,e,i,s){var r=u(i,s);return r.open("POST",t),void 0!==s&&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(a(e)),r}function h(t,e,i,s){var r=u(i,s);return r.open("GET",t+"?"+a(e),!0),void 0!==s&&null!==s&&void 0!==s.options&&(r.timeout=s.options.timeout),r.send(null),r}function c(t,e,i,s){var n=a(e),o=u(i,s),l=(t+"?"+n).length;if(l<=2e3&&r.cors?o.open("GET",t+"?"+n):l>2e3&&r.cors&&(o.open("POST",t),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8")),void 0!==s&&null!==s&&void 0!==s.options&&(o.timeout=s.options.timeout),l<=2e3&&r.cors)o.send(null);else{if(!(l>2e3&&r.cors))return l<=2e3&&!r.cors?p(t,e,i,s):void M("a request to "+t+" was longer then 2000 characters and this browser cannot make a cross-domain post request. Please use a proxy http://esri.github.io/esri-leaflet/api-reference/request.html");o.send(n)}return o}function p(t,i,s,r){window._EsriLeafletCallbacks=window._EsriLeafletCallbacks||{};var n="c"+o;i.callback="window._EsriLeafletCallbacks."+n,window._EsriLeafletCallbacks[n]=function(t){if(!0!==window._EsriLeafletCallbacks[n]){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[n]=!0}};var u=e.DomUtil.create("script",null,document.body);return u.type="text/javascript",u.src=t+"?"+a(i),u.id=n,u.onerror=function(t){if(t&&!0!==window._EsriLeafletCallbacks[n]){s.call(r,{error:{code:500,message:"An unknown error occurred"}}),window._EsriLeafletCallbacks[n]=!0}},e.DomUtil.addClass(u,"esri-leaflet-jsonp"),o++,{id:n,url:u.src,abort:function(){window._EsriLeafletCallbacks._callback[n]({code:0,message:"Request aborted."})}}}var m=r.cors?h:p;m.CORS=h,m.JSONP=p;var d={request:c,get:m,post:l};function f(t){return function(t,e){for(var i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}(t[0],t[t.length-1])||t.push(t[0]),t}function y(t){for(var e,i=0,s=0,r=t.length,n=t[s];s<r-1;s++)i+=((e=t[s+1])[0]-n[0])*(e[1]+n[1]),n=e;return i>=0}function g(t,e,i,s){var r=(s[0]-i[0])*(t[1]-i[1])-(s[1]-i[1])*(t[0]-i[0]),n=(e[0]-t[0])*(t[1]-i[1])-(e[1]-t[1])*(t[0]-i[0]),o=(s[1]-i[1])*(e[0]-t[0])-(s[0]-i[0])*(e[1]-t[1]);if(0!==o){var a=r/o,u=n/o;if(a>=0&&a<=1&&u>=0&&u<=1)return!0}return!1}function v(t,e){for(var i=0;i<t.length-1;i++)for(var s=0;s<e.length-1;s++)if(g(t[i],t[i+1],e[s],e[s+1]))return!0;return!1}function _(t,e){var i=v(t,e),s=function(t,e){for(var i=!1,s=-1,r=t.length,n=r-1;++s<r;n=s)(t[s][1]<=e[1]&&e[1]<t[n][1]||t[n][1]<=e[1]&&e[1]<t[s][1])&&e[0]<(t[n][0]-t[s][0])*(e[1]-t[s][1])/(t[n][1]-t[s][1])+t[s][0]&&(i=!i);return i}(t,e[0]);return!(i||!s)}function b(t){var e=[],i=t.slice(0),s=f(i.shift().slice(0));if(s.length>=4){y(s)||s.reverse(),e.push(s);for(var r=0;r<i.length;r++){var n=f(i[r].slice(0));n.length>=4&&(y(n)&&n.reverse(),e.push(n))}}return e}function x(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function S(t,e){var i={};if(t.features){i.type="FeatureCollection",i.features=[];for(var s=0;s<t.features.length;s++)i.features.push(S(t.features[s],e))}if("number"==typeof t.x&&"number"==typeof t.y&&(i.type="Point",i.coordinates=[t.x,t.y],"number"==typeof t.z&&i.coordinates.push(t.z)),t.points&&(i.type="MultiPoint",i.coordinates=t.points.slice(0)),t.paths&&(1===t.paths.length?(i.type="LineString",i.coordinates=t.paths[0].slice(0)):(i.type="MultiLineString",i.coordinates=t.paths.slice(0))),t.rings&&(i=function(t){for(var e,i,s=[],r=[],n=0;n<t.length;n++){var o=f(t[n].slice(0));if(!(o.length<4))if(y(o)){var a=[o.slice().reverse()];s.push(a)}else r.push(o.slice().reverse())}for(var u=[];r.length;){i=r.pop();var l=!1;for(e=s.length-1;e>=0;e--)if(_(s[e][0],i)){s[e].push(i),l=!0;break}l||u.push(i)}for(;u.length;){i=u.pop();var h=!1;for(e=s.length-1;e>=0;e--)if(v(s[e][0],i)){s[e].push(i),h=!0;break}h||s.push([i.reverse()])}return 1===s.length?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s}}(t.rings.slice(0))),"number"==typeof t.xmin&&"number"==typeof t.ymin&&"number"==typeof t.xmax&&"number"==typeof t.ymax&&(i.type="Polygon",i.coordinates=[[[t.xmax,t.ymax],[t.xmin,t.ymax],[t.xmin,t.ymin],[t.xmax,t.ymin],[t.xmax,t.ymax]]]),(t.geometry||t.attributes)&&(i.type="Feature",i.geometry=t.geometry?S(t.geometry):null,i.properties=t.attributes?x(t.attributes):null,t.attributes))try{i.id=function(t,e){for(var i=e?[e,"OBJECTID","FID"]:["OBJECTID","FID"],s=0;s<i.length;s++){var r=i[s];if(r in t&&("string"==typeof t[r]||"number"==typeof t[r]))return t[r]}throw Error("No valid id attribute found")}(t.attributes,e)}catch(t){}return JSON.stringify(i.geometry)===JSON.stringify({})&&(i.geometry=null),t.spatialReference&&t.spatialReference.wkid&&4326!==t.spatialReference.wkid&&console.warn("Object converted in non-standard crs - "+JSON.stringify(t.spatialReference)),i}function L(t,e){e=e||"OBJECTID";var i,s={wkid:4326},r={};switch(t.type){case"Point":r.x=t.coordinates[0],r.y=t.coordinates[1],r.spatialReference=s;break;case"MultiPoint":r.points=t.coordinates.slice(0),r.spatialReference=s;break;case"LineString":r.paths=[t.coordinates.slice(0)],r.spatialReference=s;break;case"MultiLineString":r.paths=t.coordinates.slice(0),r.spatialReference=s;break;case"Polygon":r.rings=b(t.coordinates.slice(0)),r.spatialReference=s;break;case"MultiPolygon":r.rings=function(t){for(var e=[],i=0;i<t.length;i++)for(var s=b(t[i]),r=s.length-1;r>=0;r--){var n=s[r].slice(0);e.push(n)}return e}(t.coordinates.slice(0)),r.spatialReference=s;break;case"Feature":t.geometry&&(r.geometry=L(t.geometry,e)),r.attributes=t.properties?x(t.properties):{},t.id&&(r.attributes[e]=t.id);break;case"FeatureCollection":for(r=[],i=0;i<t.features.length;i++)r.push(L(t.features[i],e));break;case"GeometryCollection":for(r=[],i=0;i<t.geometries.length;i++)r.push(L(t.geometries[i],e))}return r}function A(t,e){return L(t,e)}function I(t,e){return S(t,e)}function T(t){if("NaN"!==t.xmin&&"NaN"!==t.ymin&&"NaN"!==t.xmax&&"NaN"!==t.ymax){var i=e.latLng(t.ymin,t.xmin),s=e.latLng(t.ymax,t.xmax);return e.latLngBounds(i,s)}return null}function w(t){return{xmin:(t=e.latLngBounds(t)).getSouthWest().lng,ymin:t.getSouthWest().lat,xmax:t.getNorthEast().lng,ymax:t.getNorthEast().lat,spatialReference:{wkid:4326}}}var R=/^(OBJECTID|FID|OID|ID)$/i;function C(t){var e;if(t.objectIdFieldName)e=t.objectIdFieldName;else if(t.fields){for(var i=0;i<=t.fields.length-1;i++)if("esriFieldTypeOID"===t.fields[i].type){e=t.fields[i].name;break}if(!e)for(i=0;i<=t.fields.length-1;i++)if(t.fields[i].name.match(R)){e=t.fields[i].name;break}}return e}function O(t){for(var e in t.attributes)if(e.match(R))return e}function P(t,e){var i,s=t.features||t.results,r=s.length;i=e||C(t);var n={type:"FeatureCollection",features:[]};if(r)for(var o=s.length-1;o>=0;o--){var a=I(s[o],i||O(s[o]));n.features.push(a)}return n}function F(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=F(t.url.split("?")[0]),t}function k(t){return/^(?!.*utility\.arcgis\.com).*\.arcgis\.com.*FeatureServer/i.test(t)}function G(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 M(){console&&console.warn&&console.warn.apply(console,arguments)}function q(t){return t.getSize().x-n.attributionWidthOffset+"px"}function D(t){if(t.attributionControl&&!t.attributionControl._esriAttributionAdded){t.attributionControl.setPrefix('<a href="http://leafletjs.com" title="A JS library for interactive maps">Leaflet</a> | Powered by <a href="https://www.esri.com">Esri</a>');var i=document.createElement("style");i.type="text/css",i.innerHTML=".esri-truncated-attribution:hover {white-space: normal;}",document.getElementsByTagName("head")[0].appendChild(i),e.DomUtil.addClass(t.attributionControl._container,"esri-truncated-attribution:hover");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: "+q(t)+";}",document.getElementsByTagName("head")[0].appendChild(s),e.DomUtil.addClass(t.attributionControl._container,"esri-truncated-attribution"),t.on("resize",function(e){t.attributionControl._container.style.maxWidth=q(e.target)}),t.on("unload",function(){i.parentNode.removeChild(i),s.parentNode.removeChild(s);for(var t=document.querySelectorAll(".esri-leaflet-jsonp"),e=0;e<t.length;e++)t.item(e).parentNode.removeChild(t.item(e))}),t.attributionControl._esriAttributionAdded=!0}}function E(t){var i={geometry:null,geometryType:null};return t instanceof e.LatLngBounds?(i.geometry=w(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=A(t),i.geometryType=G(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=A(t),i.geometryType=G(t.type),i):void M("invalid geometry passed to spatial query. Should be L.LatLng, L.LatLngBounds, L.Marker or a GeoJSON Point, Line, Polygon or MultiPolygon object"))}function B(t,i){p(t,{},e.Util.bind(function(t,s){if(!t){i._esriAttributions=[];for(var r=0;r<s.contributors.length;r++)for(var n=s.contributors[r],o=0;o<n.coverageAreas.length;o++){var a=n.coverageAreas[o],u=e.latLng(a.bbox[0],a.bbox[1]),l=e.latLng(a.bbox[2],a.bbox[3]);i._esriAttributions.push({attribution:n.attribution,score:a.score,bounds:e.latLngBounds(u,l),minZoom:a.zoomMin,maxZoom:a.zoomMax})}i._esriAttributions.sort(function(t,e){return e.score-t.score}),z({target:i})}},this))}function z(t){var i=t.target,s=i._esriAttributions,r=i.attributionControl._container.querySelector(".esri-dynamic-attribution");if(i&&i.attributionControl&&r&&s){for(var n="",o=i.getBounds(),a=e.latLngBounds(o.getSouthWest().wrap(),o.getNorthEast().wrap()),u=i.getZoom(),l=0;l<s.length;l++){var h=s[l],c=h.attribution;!n.match(c)&&h.bounds.intersects(a)&&u>=h.minZoom&&u<=h.maxZoom&&(n+=", "+c)}n=n.substr(2),r.innerHTML=n,r.style.maxWidth=q(i),i.fire("attributionupdated",{attribution:n})}}var N={warn:M,cleanUrl:F,getUrlParams:U,isArcgisOnline:k,geojsonTypeToArcGIS:G,responseToFeatureCollection:P,geojsonToArcGIS:A,arcgisToGeoJSON:I,boundsToExtent:w,extentToBounds:T,calcAttributionWidth:q,setEsriAttribution:D,_setGeometry:E,_getAttributionData:B,_updateMapAttribution:z,_findIdAttributeFromFeature:O,_findIdAttributeFromResponse:C},Z=e.Class.extend({options:{proxy:!1,useCors:i},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=F(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},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 n=this.options.proxy?this.options.proxy+"?"+this.options.url+e:this.options.url+e;return"get"!==t&&"request"!==t||this.options.useCors?d[t](n,i,s,r):d.get.JSONP(n,i,s,r)}});var j=Z.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||k(this.options.url)?(this.params.f="geojson",this.request(function(i,s){this._trapSQLerrors(i),t.call(e,i,s,s)},this)):this.request(function(i,s){this._trapSQLerrors(i),t.call(e,i,s&&P(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&&T(s.extent)?t.call(e,i,T(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&&M("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=E(t);this.params.geometry=e.geometry,this.params.geometryType=e.geometryType}});function W(t){return new j(t)}var J=Z.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&&P(s),s)},e)}});function Q(t){return new J(t)}var V=Z.extend({path:"identify",between:function(t,e){return this.params.time=[t.valueOf(),e.valueOf()],this}});var H=V.extend({setters:{layers:"layers",precision:"geometryPrecision",tolerance:"tolerance",returnGeometry:"returnGeometry"},params:{sr:4326,layers:"all",tolerance:3,returnGeometry:!0},on:function(t){var e=w(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=P(s);s.results=s.results.reverse();for(var n=0;n<r.features.length;n++){r.features[n].layerId=s.results[n].layerId}t.call(e,void 0,r,s)}})},_setGeometryParams:function(t){var e=E(t);this.params.geometry=e.geometry,this.params.geometryType=e.geometryType}});function K(t){return new H(t)}var X=V.extend({setters:{setMosaicRule:"mosaicRule",setRenderingRule:"renderingRule",setPixelSize:"pixelSize",returnCatalogItems:"returnCatalogItems",returnGeometry:"returnGeometry"},params:{returnGeometry:!1},at:function(t){return t=e.latLng(t),this.params.geometry=JSON.stringify({x:t.lng,y:t.lat,spatialReference:{wkid:4326}}),this.params.geometryType="esriGeometryPoint",this},getMosaicRule:function(){return this.params.mosaicRule},getRenderingRule:function(){return this.params.renderingRule},getPixelSize:function(){return this.params.pixelSize},run:function(t,e){return this.request(function(i,s){t.call(e,i,s&&this._responseToGeoJSON(s),s)},this)},_responseToGeoJSON:function(t){var e=t.location,i=t.catalogItems,s=t.catalogItemVisibilities,r={pixel:{type:"Feature",geometry:{type:"Point",coordinates:[e.x,e.y]},crs:{type:"EPSG",properties:{code:e.spatialReference.wkid}},properties:{OBJECTID:t.objectId,name:t.name,value:t.value},id:t.objectId}};if(t.properties&&t.properties.Values&&(r.pixel.properties.values=t.properties.Values),i&&i.features&&(r.catalogItems=P(i),s&&s.length===r.catalogItems.features.length))for(var n=s.length-1;n>=0;n--)r.catalogItems.features[n].properties.catalogItemVisibility=s[n];return r}});function $(t){return new X(t)}var Y=e.Evented.extend({options:{proxy:!1,useCors:i,timeout:0},initialize:function(t){t=t||{},this._requestQueue=[],this._authenticating=!1,e.Util.setOptions(this,t),this.options.url=F(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,n){this.fire("requeststart",{url:this.options.url+i,params:s,method:t},!0);var o=this._createServiceCallback(t,i,s,r,n);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?d[t](a,s,o,n):d.get.JSONP(a,s,o,n)}this._requestQueue.push([t,i,s,r,n])},_createServiceCallback:function(t,i,s,r,n){return e.Util.bind(function(o,a){!o||499!==o.code&&498!==o.code||(this._authenticating=!0,this._requestQueue.push([t,i,s,r,n]),this.fire("authenticationrequired",{authenticate:e.Util.bind(this.authenticate,this)},!0),o.authenticate=e.Util.bind(this.authenticate,this)),r.call(n,o,a),o?this.fire("requesterror",{url:this.options.url+i,params:s,message:o.message,code:o.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 tt=Y.extend({identify:function(){return K(this)},find:function(){return Q(this)},query:function(){return W(this)}});function et(t){return new tt(t)}var it=Y.extend({query:function(){return W(this)},identify:function(){return $(this)}});function st(t){return new it(t)}var rt=Y.extend({options:{idAttribute:"OBJECTID"},query:function(){return W(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=A(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=A(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 nt(t){return new rt(t)}var ot="https:"!==window.location.protocol?"http:":"https:",at=e.TileLayer.extend({statics:{TILES:{Streets:{urlTemplate:ot+"//{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:ot+"//{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:ot+"//{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:ot+"//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],pane:s?"esri-labels":"tilePane",attribution:""}},NationalGeographic:{urlTemplate:ot+"//{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:ot+"//{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:ot+"//{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:s?"esri-labels":"tilePane",attribution:""}},Gray:{urlTemplate:ot+"//{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:ot+"//{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:s?"esri-labels":"tilePane",attribution:""}},Imagery:{urlTemplate:ot+"//{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:ot+"//{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:s?"esri-labels":"tilePane",attribution:""}},ImageryTransportation:{urlTemplate:ot+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],pane:s?"esri-labels":"tilePane",attribution:""}},ShadedRelief:{urlTemplate:ot+"//{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:ot+"//{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:s?"esri-labels":"tilePane",attribution:""}},Terrain:{urlTemplate:ot+"//{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:ot+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:13,subdomains:["server","services"],pane:s?"esri-labels":"tilePane",attribution:""}},USATopo:{urlTemplate:ot+"//{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:ot+"//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:ot+"//{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:ot+"//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||!at.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=at.TILES[t]}var r=e.Util.extend(s.options,i);e.Util.setOptions(this,r),this.options.token&&-1===s.urlTemplate.indexOf("token=")&&(s.urlTemplate+="?token="+this.options.token),e.TileLayer.prototype.initialize.call(this,s.urlTemplate,r)},onAdd:function(t){D(t),"esri-labels"===this.options.pane&&this._initPane(),this.options.attributionUrl&&B(this.options.attributionUrl,t),t.on("moveend",z),e.TileLayer.prototype.onAdd.call(this,t)},onRemove:function(t){t.off("moveend",z),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='<span class="esri-dynamic-attribution">'+this.options.attribution+"</span>";return t}});var ut=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=et(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&&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&&this._lodMap[this._getZoomForUrl()]?s.src=this.getTileUrl(t):this.once("lodmap",function(){s.src=this.getTileUrl(t)},this),s},onAdd:function(t){D(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||M("L.esri.TiledMapLayer is using a non-mercator spatial reference. Support may be available through Proj4Leaflet http://esri.github.io/esri-leaflet/examples/non-mercator-projection.html");else{this._lodMap={};for(var n=s.tileInfo.lods,o=ut.MercatorZoomLevels,a=0;a<n.length;a++){var u=n[a];for(var l in o){var h=o[l];if(this._withinPercentage(u.resolution,h,this.options.zoomOffsetAllowance)){this._lodMap[l]=u.level;break}}}this.fire("lodmap")}}},this),e.TileLayer.prototype.onAdd.call(this,t)},metadata:function(t,e){return this.service.metadata(t,e),this},identify:function(){return this.service.identify()},find:function(){return this.service.find()},query:function(){return this.service.query()},authenticate:function(t){var e="?token="+t;return this.tileUrl=this.options.token?this.tileUrl.replace(/\?token=(.+)/g,e):this.tileUrl+e,this.options.token=t,this.service.authenticate(t),this},_withinPercentage:function(t,e,i){return Math.abs(t/e-1)<i}});var lt=e.ImageOverlay.extend({onAdd:function(t){this._topLeft=t.getPixelBounds().min,e.ImageOverlay.prototype.onAdd.call(this,t)},_reset:function(){this._map.options.crs===e.CRS.EPSG3857?e.ImageOverlay.prototype._reset.call(this):e.DomUtil.setPosition(this._image,this._topLeft.subtract(this._map.getPixelOrigin()))}}),ht=e.Layer.extend({options:{opacity:1,position:"front",f:"image",useCors:i,attribution:null,interactive:!1,alt:""},onAdd:function(t){D(t),this._update=e.Util.throttle(this._update,this.options.updateInterval,this),t.on("moveend",this._update,this),this._currentImage&&this._currentImage._bounds.equals(this._map.getBounds())?t.addLayer(this._currentImage):this._currentImage&&(this._map.removeLayer(this._currentImage),this._currentImage=null),this._update(),this._popup&&(this._map.on("click",this._getPopupData,this),this._map.on("dblclick",this._resetPopupState,this)),this.metadata(function(e,i){!e&&!this.options.attribution&&t.attributionControl&&i.copyrightText&&(this.options.attribution=i.copyrightText,t.attributionControl.addAttribution(this.getAttribution()))},this)},onRemove:function(t){this._currentImage&&this._map.removeLayer(this._currentImage),this._popup&&(this._map.off("click",this._getPopupData,this),this._map.off("dblclick",this._resetPopupState,this)),this._map.off("moveend",this._update,this)},bindPopup:function(t,i){return this._shouldRenderPopup=!1,this._lastClick=!1,this._popup=e.popup(i),this._popupFunction=t,this._map&&(this._map.on("click",this._getPopupData,this),this._map.on("dblclick",this._resetPopupState,this)),this},unbindPopup:function(){return this._map&&(this._map.closePopup(this._popup),this._map.off("click",this._getPopupData,this),this._map.off("dblclick",this._resetPopupState,this)),this._popup=!1,this},bringToFront:function(){return this.options.position="front",this._currentImage&&this._currentImage.bringToFront(),this},bringToBack:function(){return this.options.position="back",this._currentImage&&this._currentImage.bringToBack(),this},getAttribution:function(){return this.options.attribution},getOpacity:function(){return this.options.opacity},setOpacity:function(t){return this.options.opacity=t,this._currentImage&&this._currentImage.setOpacity(t),this},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(t,e){return this.options.from=t,this.options.to=e,this._update(),this},metadata:function(t,e){return this.service.metadata(t,e),this},authenticate:function(t){return this.service.authenticate(t),this},redraw:function(){this._update()},_renderImage:function(t,e,i){if(this._map){if(i&&(t="data:"+i+";base64,"+t),!t)return;var s=new lt(t,e,{opacity:0,crossOrigin:this.options.useCors,alt:this.options.alt,pane:this.options.pane||this.getPane(),interactive:this.options.interactive}).addTo(this._map),r=function(t){if(s.off("error",r,this),this._map){var i=t.target,n=this._currentImage;i._bounds.equals(e)&&i._bounds.equals(this._map.getBounds())?(this._currentImage=i,"front"===this.options.position?this.bringToFront():this.bringToBack(),this._map&&this._currentImage._map?this._currentImage.setOpacity(this.options.opacity):this._currentImage._map.removeLayer(this._currentImage),n&&this._map&&this._map.removeLayer(n),n&&n._map&&n._map.removeLayer(n)):this._map.removeLayer(i)}this.fire("load",{bounds:e})};s.once("error",function(){this._map.removeLayer(s),this.fire("error"),s.off("load",r,this)},this),s.once("load",r,this),this.fire("loading",{bounds:e})}},_update:function(){if(this._map){var t=this._map.getZoom(),i=this._map.getBounds();if(!(this._animatingZoom||this._map._panTransition&&this._map._panTransition._inProgress))if(t>this.options.maxZoom||t<this.options.minZoom)this._currentImage&&(this._currentImage._map.removeLayer(this._currentImage),this._currentImage=null);else{var s=this._buildExportParams();e.Util.extend(s,this.options.requestParams),s?this._requestExport(s,i):this._currentImage&&(this._currentImage._map.removeLayer(this._currentImage),this._currentImage=null)}}},_renderPopup:function(t,i,s,r){if(t=e.latLng(t),this._shouldRenderPopup&&this._lastClick.equals(t)){var n=this._popupFunction(i,s,r);n&&this._popup.setLatLng(t).setContent(n).openOn(this._map)}},_resetPopupState:function(t){this._shouldRenderPopup=!1,this._lastClick=t.latlng},_calculateBbox:function(){var t=this._map.getPixelBounds(),i=this._map.unproject(t.getBottomLeft()),s=this._map.unproject(t.getTopRight()),r=this._map.options.crs.project(s),n=this._map.options.crs.project(i),o=e.bounds(r,n);return[o.getBottomLeft().x,o.getBottomLeft().y,o.getTopRight().x,o.getTopRight().y].join(",")},_calculateImageSize:function(){var t=this._map.getPixelBounds(),e=this._map.getSize(),i=this._map.unproject(t.getBottomLeft()),s=this._map.unproject(t.getTopRight()),r=this._map.latLngToLayerPoint(s).y,n=this._map.latLngToLayerPoint(i).y;return(r>0||n<e.y)&&(e.y=n-r),e.x+","+e.y}}),ct=ht.extend({options:{updateInterval:150,format:"jpgpng",transparent:!0,f:"image"},query:function(){return this.service.query()},identify:function(){return this.service.identify()},initialize:function(t){t=U(t),this.service=st(t),this.service.addEventParent(this),e.Util.setOptions(this,t)},setPixelType:function(t){return this.options.pixelType=t,this._update(),this},getPixelType:function(){return this.options.pixelType},setBandIds:function(t){return e.Util.isArray(t)?this.options.bandIds=t.join(","):this.options.bandIds=t.toString(),this._update(),this},getBandIds:function(){return this.options.bandIds},setNoData:function(t,i){return e.Util.isArray(t)?this.options.noData=t.join(","):this.options.noData=t.toString(),i&&(this.options.noDataInterpretation=i),this._update(),this},getNoData:function(){return this.options.noData},getNoDataInterpretation:function(){return this.options.noDataInterpretation},setRenderingRule:function(t){this.options.renderingRule=t,this._update()},getRenderingRule:function(){return this.options.renderingRule},setMosaicRule:function(t){this.options.mosaicRule=t,this._update()},getMosaicRule:function(){return this.options.mosaicRule},_getPopupData:function(t){var i=e.Util.bind(function(i,s,r){i||setTimeout(e.Util.bind(function(){this._renderPopup(t.latlng,i,s,r)},this),300)},this),s=this.identify().at(t.latlng);this.options.mosaicRule&&s.setMosaicRule(this.options.mosaicRule),s.run(i),this._shouldRenderPopup=!0,this._lastClick=t.latlng},_buildExportParams:function(){var t=parseInt(this._map.options.crs.code.split(":")[1],10),e={bbox:this._calculateBbox(),size:this._calculateImageSize(),format:this.options.format,transparent:this.options.transparent,bboxSR:t,imageSR:t};return this.options.from&&this.options.to&&(e.time=this.options.from.valueOf()+","+this.options.to.valueOf()),this.options.pixelType&&(e.pixelType=this.options.pixelType),this.options.interpolation&&(e.interpolation=this.options.interpolation),this.options.compressionQuality&&(e.compressionQuality=this.options.compressionQuality),this.options.bandIds&&(e.bandIds=this.options.bandIds),(0===this.options.noData||this.options.noData)&&(e.noData=this.options.noData),this.options.noDataInterpretation&&(e.noDataInterpretation=this.options.noDataInterpretation),this.service.options.token&&(e.token=this.service.options.token),this.options.renderingRule&&(e.renderingRule=JSON.stringify(this.options.renderingRule)),this.options.mosaicRule&&(e.mosaicRule=JSON.stringify(this.options.mosaicRule)),e},_requestExport:function(t,i){"json"===this.options.f?this.service.request("exportImage",t,function(t,e){t||(this.options.token&&(e.href+="?token="+this.options.token),this._renderImage(e.href,i))},this):(t.f="image",this._renderImage(this.options.url+"exportImage"+e.Util.getParamString(t),i))}});var pt=ht.extend({options:{updateInterval:150,layers:!1,layerDefs:!1,timeOptions:!1,format:"png24",transparent:!0,f:"json"},initialize:function(t){t=U(t),this.service=et(t),this.service.addEventParent(this),(t.proxy||t.token)&&"json"!==t.f&&(t.f="json"),e.Util.setOptions(this,t)},getDynamicLayers:function(){return this.options.dynamicLayers},setDynamicLayers:function(t){return this.options.dynamicLayers=t,this._update(),this},getLayers:function(){return this.options.layers},setLayers:function(t){return this.options.layers=t,this._update(),this},getLayerDefs:function(){return this.options.layerDefs},setLayerDefs:function(t){return this.options.layerDefs=t,this._update(),this},getTimeOptions:function(){return this.options.timeOptions},setTimeOptions:function(t){return this.options.timeOptions=t,this._update(),this},query:function(){return this.service.query()},identify:function(){return this.service.identify()},find:function(){return this.service.find()},_getPopupData:function(t){var i,s=e.Util.bind(function(i,s,r){i||setTimeout(e.Util.bind(function(){this._renderPopup(t.latlng,i,s,r)},this),300)},this);if((i=this.options.popup?this.options.popup.on(this._map).at(t.latlng):this.identify().on(this._map).at(t.latlng)).params.maxAllowableOffset||i.simplify(this._map,.5),this.options.popup&&this.options.popup.params&&this.options.popup.params.layers||(this.options.layers?i.layers("visible:"+this.options.layers.join(",")):i.layers("visible")),this.options.layerDefs&&"string"!=typeof this.options.layerDefs&&!i.params.layerDefs)for(var r in this.options.layerDefs)this.options.layerDefs.hasOwnProperty(r)&&i.layerDef(r,this.options.layerDefs[r]);i.run(s),this._shouldRenderPopup=!0,this._lastClick=t.latlng},_buildExportParams:function(){var t=parseInt(this._map.options.crs.code.split(":")[1],10),e={bbox:this._calculateBbox(),size:this._calculateImageSize(),dpi:96,format:this.options.format,transparent:this.options.transparent,bboxSR:t,imageSR:t};if(this.options.dynamicLayers&&(e.dynamicLayers=this.options.dynamicLayers),this.options.layers){if(0===this.options.layers.length)return;e.layers="show:"+this.options.layers.join(",")}return this.options.layerDefs&&(e.layerDefs="string"==typeof this.options.layerDefs?this.options.layerDefs:JSON.stringify(this.options.layerDefs)),this.options.timeOptions&&(e.timeOptions=JSON.stringify(this.options.timeOptions)),this.options.from&&this.options.to&&(e.time=this.options.from.valueOf()+","+this.options.to.valueOf()),this.service.options.token&&(e.token=this.service.options.token),this.options.proxy&&(e.proxy=this.options.proxy),this.options.disableCache&&(e._ts=Date.now()),e},_requestExport:function(t,i){"json"===this.options.f?this.service.request("export",t,function(t,e){t||(this.options.token&&(e.href+="?token="+this.options.token),this.options.proxy&&(e.href=this.options.proxy+"?"+e.href),e.href?this._renderImage(e.href,i):this._renderImage(e.imageData,i,e.contentType))},this):(t.f="image",this._renderImage(this.options.url+"export"+e.Util.getParamString(t),i))}});var mt=e.Layer.extend({options:{cellSize:512,updateInterval:150},initialize:function(t){t=e.setOptions(this,t),this._zooming=!1},onAdd:function(t){this._map=t,this._update=e.Util.throttle(this._update,this.options.updateInterval,this),this._reset(),this._update()},onRemove:function(){this._map.removeEventListener(this.getEvents(),this),this._removeCells()},getEvents:function(){return{moveend:this._update,zoomstart:this._zoomstart,zoomend:this._reset}},addTo:function(t){return t.addLayer(this),this},removeFrom:function(t){return t.removeLayer(this),this},_zoomstart:function(){this._zooming=!0},_reset:function(){this._removeCells(),this._cells={},this._activeCells={},this._cellsToLoad=0,this._cellsTotal=0,this._cellNumBounds=this._getCellNumBounds(),this._resetWrap(),this._zooming=!1},_resetWrap:function(){var t=this._map,e=t.options.crs;if(!e.infinite){var i=this._getCellSize();e.wrapLng&&(this._wrapLng=[Math.floor(t.project([0,e.wrapLng[0]]).x/i),Math.ceil(t.project([0,e.wrapLng[1]]).x/i)]),e.wrapLat&&(this._wrapLat=[Math.floor(t.project([e.wrapLat[0],0]).y/i),Math.ceil(t.project([e.wrapLat[1],0]).y/i)])}},_getCellSize:function(){return this.options.cellSize},_update:function(){if(this._map){var t=this._map.getPixelBounds(),i=this._getCellSize(),s=e.bounds(t.min.divideBy(i).floor(),t.max.divideBy(i).floor());this._removeOtherCells(s),this._addCells(s),this.fire("cellsupdated")}},_addCells:function(t){var i,s,r,n=[],o=t.getCenter(),a=this._map.getZoom();for(i=t.min.y;i<=t.max.y;i++)for(s=t.min.x;s<=t.max.x;s++)(r=e.point(s,i)).z=a,this._isValidCell(r)&&n.push(r);var u=n.length;if(0!==u)for(this._cellsToLoad+=u,this._cellsTotal+=u,n.sort(function(t,e){return t.distanceTo(o)-e.distanceTo(o)}),s=0;s<u;s++)this._addCell(n[s])},_isValidCell:function(t){var i=this._map.options.crs;if(!i.infinite){var s=this._cellNumBounds;if(!s)return!1;if(!i.wrapLng&&(t.x<s.min.x||t.x>s.max.x)||!i.wrapLat&&(t.y<s.min.y||t.y>s.max.y))return!1}if(!this.options.bounds)return!0;var r=this._cellCoordsToBounds(t);return e.latLngBounds(this.options.bounds).intersects(r)},_cellCoordsToBounds:function(t){var i=this._map,s=this.options.cellSize,r=t.multiplyBy(s),n=r.add([s,s]),o=i.wrapLatLng(i.unproject(r,t.z)),a=i.wrapLatLng(i.unproject(n,t.z));return e.latLngBounds(o,a)},_cellCoordsToKey:function(t){return t.x+":"+t.y},_keyToCellCoords:function(t){var i=t.split(":"),s=parseInt(i[0],10),r=parseInt(i[1],10);return e.point(s,r)},_removeOtherCells:function(t){for(var e in this._cells)t.contains(this._keyToCellCoords(e))||this._removeCell(e)},_removeCell:function(t){var e=this._activeCells[t];e&&(delete this._activeCells[t],this.cellLeave&&this.cellLeave(e.bounds,e.coords),this.fire("cellleave",{bounds:e.bounds,coords:e.coords}))},_removeCells:function(){for(var t in this._cells){var e=this._cells[t].bounds,i=this._cells[t].coords;this.cellLeave&&this.cellLeave(e,i),this.fire("cellleave",{bounds:e,coords:i})}},_addCell:function(t){this._wrapCoords(t);var e=this._cellCoordsToKey(t),i=this._cells[e];i&&!this._activeCells[e]&&(this.cellEnter&&this.cellEnter(i.bounds,t),this.fire("cellenter",{bounds:i.bounds,coords:t}),this._activeCells[e]=i),i||(i={coords:t,bounds:this._cellCoordsToBounds(t)},this._cells[e]=i,this._activeCells[e]=i,this.createCell&&this.createCell(i.bounds,t),this.fire("cellcreate",{bounds:i.bounds,coords:t}))},_wrapCoords:function(t){t.x=this._wrapLng?e.Util.wrapNum(t.x,this._wrapLng):t.x,t.y=this._wrapLat?e.Util.wrapNum(t.y,this._wrapLat):t.y},_getCellNumBounds:function(){var t=this._map.getPixelWorldBounds(),i=this._getCellSize();return t?e.bounds(t.min.divideBy(i).floor(),t.max.divideBy(i).ceil().subtract([1,1])):null}});function dt(t){this.values=[].concat(t||[])}dt.prototype.query=function(t){var e=this.getIndex(t);return this.values[e]},dt.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)},dt.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)},dt.prototype.insert=function(t){return this.values.splice(this.getIndex(t.value),0,t),this},dt.prototype.bulkAdd=function(t,e){return this.values=this.values.concat([].concat(t||[])),e?this.sort():this.dirty=!0,this},dt.prototype.sort=function(){return this.values.sort(function(t,e){return+e.value-+t.value}).reverse(),this.dirty=!1,this};var ft=mt.extend({options:{attribution:null,where:"1=1",fields:["*"],from:!1,to:!1,timeField:!1,timeFilterMode:"server",simplifyFactor:0,precision:6},initialize:function(t){if(mt.prototype.initialize.call(this,t),t=U(t),t=e.Util.setOptions(this,t),this.service=nt(t),this.service.addEventParent(this),"*"!==this.options.fields[0]){for(var i=!1,s=0;s<this.options.fields.length;s++)this.options.fields[s].match(/^(OBJECTID|FID|OID|ID)$/i)&&(i=!0);!1===i&&M("no known esriFieldTypeOID field detected in fields Array. Please add an attribute field containing unique IDs to ensure the layer can be drawn correctly.")}this.options.timeField.start&&this.options.timeField.end?(this._startTimeIndex=new dt,this._endTimeIndex=new dt):this.options.timeField&&(this._timeIndex=new dt),this._cache={},this._currentSnapshot=[],this._activeRequests=0},onAdd:function(t){return D(t),this.service.metadata(function(e,i){if(!e){var s=i.supportedQueryFormats,r=!1;!1===this.service.options.isModern&&(r=!0),!r&&s&&-1!==s.indexOf("geoJSON")&&(this.service.options.isModern=!0),i.objectIdField&&(this.service.options.idAttribute=i.objectIdField),!this.options.attribution&&t.attributionControl&&i.copyrightText&&(this.options.attribution=i.copyrightText,t.attributionControl.addAttribution(this.getAttribution()))}},this),t.on("zoomend",this._handleZoomChange,this),mt.prototype.onAdd.call(this,t)},onRemove:function(t){return t.off("zoomend",this._handleZoomChange,this),mt.prototype.onRemove.call(this,t)},getAttribution:function(){return this.options.attribution},createCell:function(t,e){this._visibleZoom()&&this._requestFeatures(t,e)},_requestFeatures:function(t,i,s){return this._activeRequests++,1===this._activeRequests&&this.fire("loading",{bounds:t},!0),this._buildQuery(t).run(function(r,n,o){o&&o.exceededTransferLimit&&this.fire("drawlimitexceeded"),!r&&n&&n.features.length&&e.Util.requestAnimFrame(e.Util.bind(function(){this._addFeatures(n.features,i),this._postProcessFeatures(t)},this)),r||!n||n.features.length||this._postProcessFeatures(t),r&&this._postProcessFeatures(t),s&&s.call(this,r,n)},this)},_postProcessFeatures:function(t){this._activeRequests--,this._activeRequests<=0&&this.fire("load",{bounds:t})},_cacheKey:function(t){return t.z+":"+t.x+":"+t.y},_addFeatures:function(t,e){var i=this._cacheKey(e);this._cache[i]=this._cache[i]||[];for(var s=t.length-1;s>=0;s--){var r=t[s].id;-1===this._currentSnapshot.indexOf(r)&&this._currentSnapshot.push(r),-1===this._cache[i].indexOf(r)&&this._cache[i].push(r)}this.options.timeField&&this._buildTimeIndexes(t),this.createLayers(t)},_buildQuery:function(t){var i=this.service.query().intersects(t).where(this.options.where).fields(this.options.fields).precision(this.options.precision);return this.options.requestParams&&e.Util.extend(i.params,this.options.requestParams),this.options.simplifyFactor&&i.simplify(this._map,this.options.simplifyFactor),"server"===this.options.timeFilterMode&&this.options.from&&this.options.to&&i.between(this.options.from,this.options.to),i},setWhere:function(t,i,s){this.options.where=t&&t.length?t:"1=1";for(var r=[],n=[],o=0,a=null,u=e.Util.bind(function(t,u){if(t&&(a=t),u)for(var l=u.features.length-1;l>=0;l--)n.push(u.features[l].id);--o<=0&&this._visibleZoom()&&(this._currentSnapshot=n,e.Util.requestAnimFrame(e.Util.bind(function(){this.removeLayers(r),this.addLayers(n),i&&i.call(s,a)},this)))},this),l=this._currentSnapshot.length-1;l>=0;l--)r.push(this._currentSnapshot[l]);for(var h in this._activeCells){o++;var c=this._keyToCellCoords(h),p=this._cellCoordsToBounds(c);this._requestFeatures(p,h,u)}return this},getWhere:function(){return this.options.where},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(t,i,s,r){var n=this.options.from,o=this.options.to,a=0,u=null,l=e.Util.bind(function(e){e&&(u=e),this._filterExistingFeatures(n,o,t,i),a--,s&&a<=0&&s.call(r,u)},this);if(this.options.from=t,this.options.to=i,this._filterExistingFeatures(n,o,t,i),"server"===this.options.timeFilterMode)for(var h in this._activeCells){a++;var c=this._keyToCellCoords(h),p=this._cellCoordsToBounds(c);this._requestFeatures(p,h,l)}return this},refresh:function(){for(var t in this._activeCells){var e=this._keyToCellCoords(t),i=this._cellCoordsToBounds(e);this._requestFeatures(i,t)}this.redraw&&this.once("load",function(){this.eachFeature(function(t){this._redraw(t.feature.id)},this)},this)},_filterExistingFeatures:function(t,i,s,r){var n=t&&i?this._getFeaturesInTimeRange(t,i):this._currentSnapshot,o=this._getFeaturesInTimeRange(s,r);if(o.indexOf)for(var a=0;a<o.length;a++){var u=n.indexOf(o[a]);u>=0&&n.splice(u,1)}e.Util.requestAnimFrame(e.Util.bind(function(){this.removeLayers(n),this.addLayers(o)},this))},_getFeaturesInTimeRange:function(t,e){var i,s=[];if(this.options.timeField.start&&this.options.timeField.end){var r=this._startTimeIndex.between(t,e),n=this._endTimeIndex.between(t,e);i=r.concat(n)}else i=this._timeIndex.between(t,e);for(var o=i.length-1;o>=0;o--)s.push(i[o].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 n=[];for(e=t.length-1;e>=0;e--)i=t[e],n.push({id:i.id,value:new Date(i.properties[this.options.timeField])});this._timeIndex.bulkAdd(n)}},_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],n=+t.properties[this.options.timeField.end];return r>=e&&r<=i||n>=e&&n<=i}},_visibleZoom:function(){if(!this._map)return!1;var t=this._map.getZoom();return!(t>this.options.maxZoom||t<this.options.minZoom)},_handleZoomChange:function(){if(this._visibleZoom())for(var t in this._activeCells){var e=this._activeCells[t].coords,i=this._cacheKey(e);this._cache[i]&&this.addLayers(this._cache[i])}else this.removeLayers(this._currentSnapshot),this._currentSnapshot=[]},authenticate:function(t){return this.service.authenticate(t),this},metadata:function(t,e){return this.service.metadata(t,e),this},query:function(){return this.service.query()},_getMetadata:function(t){this._metadata?t(void 0,this._metadata):this.metadata(e.Util.bind(function(e,i){this._metadata=i,t(e,this._metadata)},this))},addFeature:function(t,e,i){this.addFeatures(t,e,i)},addFeatures:function(t,i,s){this._getMetadata(e.Util.bind(function(r,n){if(r)i&&i.call(this,r,null);else{var o=t.features?t.features:[t];this.service.addFeatures(t,e.Util.bind(function(t,e){if(!t){for(var r=o.length-1;r>=0;r--)o[r].properties[n.objectIdField]=o.length>1?e[r].objectId:e.objectId,o[r].id=o.length>1?e[r].objectId:e.objectId;this.createLayers(o)}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 n=s.length-1;n>=0;n--)this.removeLayers([s[n].id],!0);this.createLayers(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 n=r.length-1;n>=0;n--)this.removeLayers([r[n].objectId],!0);e&&e.call(i,t,s)},this)}}),yt=ft.extend({options:{cacheLayers:!0},initialize:function(t){ft.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 ft.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)}},createLayers:function(t){for(var e=t.length-1;e>=0;e--){var i,s=t[e],r=this._layers[s.id];this._visibleZoom()&&r&&!this._map.hasLayer(r)&&(this._map.addLayer(r),this.fire("addfeature",{feature:r.feature},!0)),r&&this.options.simplifyFactor>0&&(r.setLatLngs||r.setLatLng)&&this._updateLayer(r,s),r||((i=this.createNewLayer(s))?(i.feature=s,i.addEventParent(this),this.options.onEachFeature&&this.options.onEachFeature(i.feature,i),this._layers[i.feature.id]=i,this.setFeatureStyle(i.feature.id,this.options.style),this.fire("createfeature",{feature:i.feature},!0),this._visibleZoom()&&(!this.options.timeField||this.options.timeField&&this._featureWithinTimeRange(s))&&this._map.addLayer(i)):M("invalid GeoJSON encountered"))}},addLayers:function(t){for(var e=t.length-1;e>=0;e--){var i=this._layers[t[e]];i&&this._map.addLayer(i)}},removeLayers:function(t,e){for(var i=t.length-1;i>=0;i--){var s=t[i],r=this._layers[s];r&&(this.fire("removefeature",{feature:r.feature,permanent:e},!0),this._map.removeLayer(r)),r&&e&&delete this._layers[s]}},cellEnter:function(t,i){this._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 n=!0,o=0;o<s.length;o++){var a=this._layers[s[o]];a&&a.getBounds&&r.intersects(a.getBounds())&&(n=!1)}n&&this.removeLayers(s,!this.options.cacheLayers),!this.options.cacheLayers&&n&&(delete this._cache[t],delete this._cells[e],delete this._activeCells[e])}}},this))},resetStyle:function(){return this.options.style=this._originalStyle,this.eachFeature(function(t){this.resetFeatureStyle(t.feature.id)},this),this},setStyle:function(t){return this.options.style=t,this.eachFeature(function(e){this.setFeatureStyle(e.feature.id,t)},this),this},resetFeatureStyle:function(t){var i=this._layers[t],s=this._originalStyle||e.Path.prototype.options;return i&&(e.Util.extend(i.options,i.defaultOptions),this.setFeatureStyle(t,s)),this},setFeatureStyle:function(t,e){var i=this._layers[t];return"function"==typeof e&&(e=e(i.feature)),i.setStyle&&i.setStyle(e),this},eachActiveFeature:function(t,e){if(this._map){var i=this._map.getBounds();for(var s in this._layers)-1!==this._currentSnapshot.indexOf(this._layers[s].feature.id)&&("function"==typeof this._layers[s].getLatLng&&i.contains(this._layers[s].getLatLng())?t.call(e,this._layers[s]):"function"==typeof this._layers[s].getBounds&&i.intersects(this._layers[s].getBounds())&&t.call(e,this._layers[s]))}return this},eachFeature:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},getFeature:function(t){return this._layers[t]},bringToBack:function(){this.eachFeature(function(t){t.bringToBack&&t.bringToBack()})},bringToFront:function(){this.eachFeature(function(t){t.bringToFront&&t.bringToFront()})},redraw:function(t){return t&&this._redraw(t),this},_redraw:function(t){var i=this._layers[t],s=i.feature;if(i&&i.setIcon&&this.options.pointToLayer&&this.options.pointToLayer){var r=this.options.pointToLayer(s,e.latLng(s.geometry.coordinates[1],s.geometry.coordinates[0])).options.icon;i.setIcon(r)}if(i&&i.setStyle&&this.options.pointToLayer){var n=this.options.pointToLayer(s,e.latLng(s.geometry.coordinates[1],s.geometry.coordinates[0])).options;this.setFeatureStyle(s.id,n)}i&&i.setStyle&&this.options.style&&this.resetStyle(s.id)}});t.VERSION="2.2.1",t.Support=r,t.options=n,t.Util=N,t.get=m,t.post=l,t.request=c,t.Task=Z,t.task=function(t){return t=U(t),new Z(t)},t.Query=j,t.query=W,t.Find=J,t.find=Q,t.Identify=V,t.identify=function(t){return new V(t)},t.IdentifyFeatures=H,t.identifyFeatures=K,t.IdentifyImage=X,t.identifyImage=$,t.Service=Y,t.service=function(t){return t=U(t),new Y(t)},t.MapService=tt,t.mapService=et,t.ImageService=it,t.imageService=st,t.FeatureLayerService=rt,t.featureLayerService=nt,t.BasemapLayer=at,t.basemapLayer=function(t,e){return new at(t,e)},t.TiledMapLayer=ut,t.tiledMapLayer=function(t,e){return new ut(t,e)},t.RasterLayer=ht,t.ImageMapLayer=ct,t.imageMapLayer=function(t,e){return new ct(t,e)},t.DynamicMapLayer=pt,t.dynamicMapLayer=function(t,e){return new pt(t,e)},t.FeatureManager=ft,t.FeatureLayer=yt,t.featureLayer=function(t){return new yt(t)},Object.defineProperty(t,"__esModule",{value:!0})});
|
4
|
+
!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,g){"use strict";var e="3.0.4",i=window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest,s=""===document.documentElement.style.pointerEvents,a={cors:i,pointerEvents:s},r={attributionWidthOffset:55},n=0;function l(t){var e,i,s,r="";for(var o in t.f=t.f||"json",t){t.hasOwnProperty(o)&&(e=t[o],i=Object.prototype.toString.call(e),r.length&&(r+="&"),s="[object Array]"===i?"[object Object]"===Object.prototype.toString.call(e[0])?JSON.stringify(e):e.join(","):"[object Object]"===i?JSON.stringify(e):"[object Date]"===i?e.valueOf():e,r+=encodeURIComponent(o)+"="+encodeURIComponent(s))}return r}function u(s,r){var o=new window.XMLHttpRequest;return o.onerror=function(t){o.onreadystatechange=g.Util.falseFn,s.call(r,{error:{code:500,message:"XMLHttpRequest error"}},null)},o.onreadystatechange=function(){var e,i;if(4===o.readyState){try{e=JSON.parse(o.responseText)}catch(t){e=null,i={code:500,message:"Could not parse response as JSON. This could also be caused by a CORS or XMLHttpRequest error."}}!i&&e.error&&(i=e.error,e=null),o.onerror=g.Util.falseFn,s.call(r,i,e)}},o.ontimeout=function(){this.onerror()},o}function o(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 h(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 c(t,e,i,s){var r=l(e),o=u(i,s),n=(t+"?"+r).length;if(n<=2e3&&a.cors?o.open("GET",t+"?"+r):2e3<n&&a.cors&&(o.open("POST",t),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8")),null!=s&&void 0!==s.options&&(o.timeout=s.options.timeout,s.options.withCredentials&&(o.withCredentials=!0)),n<=2e3&&a.cors)o.send(null);else{if(!(2e3<n&&a.cors))return n<=2e3&&!a.cors?p(t,e,i,s):void m("a request to "+t+" was longer then 2000 characters and this browser cannot make a cross-domain post request. Please use a proxy http://esri.github.io/esri-leaflet/api-reference/request.html");o.send(r)}return o}function p(t,e,s,r){window._EsriLeafletCallbacks=window._EsriLeafletCallbacks||{};var o="c"+n;e.callback="window._EsriLeafletCallbacks."+o,window._EsriLeafletCallbacks[o]=function(t){var e,i;!0!==window._EsriLeafletCallbacks[o]&&("[object Object]"!==(i=Object.prototype.toString.call(t))&&"[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 i=g.DomUtil.create("script",null,document.body);return i.type="text/javascript",i.src=t+"?"+l(e),i.id=o,i.onerror=function(t){t&&!0!==window._EsriLeafletCallbacks[o]&&(s.call(r,{error:{code:500,message:"An unknown error occurred"}}),window._EsriLeafletCallbacks[o]=!0)},g.DomUtil.addClass(i,"esri-leaflet-jsonp"),n++,{id:o,url:i.src,abort:function(){window._EsriLeafletCallbacks._callback[o]({code:0,message:"Request aborted."})}}}var d=a.cors?h:p;function m(){console&&console.warn&&console.warn.apply(console,arguments)}d.CORS=h,d.JSONP=p;function y(t,e){for(var i=0;i<t.length-1;i++)for(var s=0;s<e.length-1;s++)if(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(0<=a&&a<=1&&0<=l&&l<=1)return!0}return!1}(t[i],t[i+1],e[s],e[s+1]))return!0;return!1}function _(t){return function(t,e){for(var i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}(t[0],t[t.length-1])||t.push(t[0]),t}function v(t){for(var e,i=0,s=0,r=t.length,o=t[s];s<r-1;s++)i+=((e=t[s+1])[0]-o[0])*(e[1]+o[1]),o=e;return 0<=i}function f(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function b(t){for(var e,i,s=[],r=[],o=0;o<t.length;o++){var n,a=_(t[o].slice(0));a.length<4||(v(a)?(n=[a.slice().reverse()],s.push(n)):r.push(a.slice().reverse()))}for(var l,u,h,c,p=[];r.length;){i=r.pop();for(var d=!1,m=s.length-1;0<=m;m--)if(e=s[m][0],h=void 0,h=y(l=e,u=i),c=function(t,e){for(var i=!1,s=-1,r=t.length,o=r-1;++s<r;o=s)(t[s][1]<=e[1]&&e[1]<t[o][1]||t[o][1]<=e[1]&&e[1]<t[s][1])&&e[0]<(t[o][0]-t[s][0])*(e[1]-t[s][1])/(t[o][1]-t[s][1])+t[s][0]&&(i=!i);return i}(l,u[0]),!h&&c){s[m].push(i),d=!0;break}d||p.push(i)}for(;p.length;){i=p.pop();var f=!1;for(m=s.length-1;0<=m;m--)if(e=s[m][0],y(e,i)){s[m].push(i),f=!0;break}f||s.push([i.reverse()])}return 1===s.length?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s}}function x(t){var e=[],i=t.slice(0),s=_(i.shift().slice(0));if(4<=s.length){v(s)||s.reverse(),e.push(s);for(var r=0;r<i.length;r++){var o=_(i[r].slice(0));4<=o.length&&(v(o)&&o.reverse(),e.push(o))}}return e}var S={request:c,get:d,post:o},L=function t(e,i){var s={};if(e.features){s.type="FeatureCollection",s.features=[];for(var r=0;r<e.features.length;r++)s.features.push(t(e.features[r],i))}if("number"==typeof e.x&&"number"==typeof e.y&&(s.type="Point",s.coordinates=[e.x,e.y],"number"==typeof e.z&&s.coordinates.push(e.z)),e.points&&(s.type="MultiPoint",s.coordinates=e.points.slice(0)),e.paths&&(1===e.paths.length?(s.type="LineString",s.coordinates=e.paths[0].slice(0)):(s.type="MultiLineString",s.coordinates=e.paths.slice(0))),e.rings&&(s=b(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?f(e.attributes):null,e.attributes))try{s.id=function(t,e){for(var i=e?[e,"OBJECTID","FID"]:["OBJECTID","FID"],s=0;s<i.length;s++){var r=i[s];if(r in t&&("string"==typeof t[r]||"number"==typeof t[r]))return t[r]}throw Error("No valid id attribute found")}(e.attributes,i)}catch(t){}return JSON.stringify(s.geometry)===JSON.stringify({})&&(s.geometry=null),e.spatialReference&&e.spatialReference.wkid&&4326!==e.spatialReference.wkid&&console.warn("Object converted in non-standard crs - "+JSON.stringify(e.spatialReference)),s},A=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],o.spatialReference=r;break;case"MultiPoint":o.points=e.coordinates.slice(0),o.spatialReference=r;break;case"LineString":o.paths=[e.coordinates.slice(0)],o.spatialReference=r;break;case"MultiLineString":o.paths=e.coordinates.slice(0),o.spatialReference=r;break;case"Polygon":o.rings=x(e.coordinates.slice(0)),o.spatialReference=r;break;case"MultiPolygon":o.rings=function(t){for(var e=[],i=0;i<t.length;i++)for(var s=x(t[i]),r=s.length-1;0<=r;r--){var o=s[r].slice(0);e.push(o)}return e}(e.coordinates.slice(0)),o.spatialReference=r;break;case"Feature":e.geometry&&(o.geometry=t(e.geometry,i)),o.attributes=e.properties?f(e.properties):{},e.id&&(o.attributes[i]=e.id);break;case"FeatureCollection":for(o=[],s=0;s<e.features.length;s++)o.push(t(e.features[s],i));break;case"GeometryCollection":for(o=[],s=0;s<e.geometries.length;s++)o.push(t(e.geometries[s],i))}return o},I='<a href="http://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>';
|
5
|
+
/* @preserve
|
6
|
+
* @terraformer/arcgis - v2.0.6 - MIT
|
7
|
+
* Copyright (c) 2012-2020 Environmental Systems Research Institute, Inc.
|
8
|
+
* Mon May 18 2020 14:30:35 GMT-0700 (Pacific Daylight Time)
|
9
|
+
*/
|
10
|
+
/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.
|
11
|
+
* Apache-2.0 */function T(t,e){return A(t,e)}function C(t,e){return L(t,e)}function w(t){if("NaN"===t.xmin||"NaN"===t.ymin||"NaN"===t.xmax||"NaN"===t.ymax)return null;var e=g.latLng(t.ymin,t.xmin),i=g.latLng(t.ymax,t.xmax);return g.latLngBounds(e,i)}function R(t){return{xmin:(t=g.latLngBounds(t)).getSouthWest().lng,ymin:t.getSouthWest().lat,xmax:t.getNorthEast().lng,ymax:t.getNorthEast().lat,spatialReference:{wkid:4326}}}var P=/^(OBJECTID|FID|OID|ID)$/i;function F(t){var e;if(t.objectIdFieldName)e=t.objectIdFieldName;else if(t.fields){for(var i=0;i<=t.fields.length-1;i++)if("esriFieldTypeOID"===t.fields[i].type){e=t.fields[i].name;break}if(!e)for(i=0;i<=t.fields.length-1;i++)if(t.fields[i].name.match(P)){e=t.fields[i].name;break}}return e}function O(t){for(var e in t.attributes)if(e.match(P))return e}function k(t,e){var i=t.features||t.results,s=i&&i.length,r=e||F(t),o={type:"FeatureCollection",features:[]};if(s)for(var n=i.length-1;0<=n;n--){var a=C(i[n],r||O(i[n]));o.features.push(a)}return o}function M(t){return"/"!==(t=g.Util.trim(t))[t.length-1]&&(t+="/"),t}function U(t){var e;return-1!==t.url.indexOf("?")&&(t.requestParams=t.requestParams||{},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,'":"')+'"}')),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 q(t){return t.getSize().x-r.attributionWidthOffset+"px"}function E(e){var t,i;e.attributionControl&&(e.attributionControl._esriAttributionLayerCount||(e.attributionControl._esriAttributionLayerCount=0),0===e.attributionControl._esriAttributionLayerCount&&(e.attributionControl._esriAttributionAddedOnce||((t=document.createElement("style")).type="text/css",t.innerHTML=".esri-truncated-attribution:hover {white-space: normal;}",document.getElementsByTagName("head")[0].appendChild(t),(i=document.createElement("style")).type="text/css",i.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: "+q(e)+";}",document.getElementsByTagName("head")[0].appendChild(i),e.on("resize",function(t){e.attributionControl&&(e.attributionControl._container.style.maxWidth=q(t.target))}),e.attributionControl._esriAttributionAddedOnce=!0),e.attributionControl.setPrefix(I+' | Powered by <a href="https://www.esri.com">Esri</a>'),g.DomUtil.addClass(e.attributionControl._container,"esri-truncated-attribution:hover"),g.DomUtil.addClass(e.attributionControl._container,"esri-truncated-attribution")),e.attributionControl._esriAttributionLayerCount=e.attributionControl._esriAttributionLayerCount+1)}function B(t){t.attributionControl&&(t.attributionControl._esriAttributionLayerCount&&1===t.attributionControl._esriAttributionLayerCount&&(t.attributionControl.setPrefix(I),g.DomUtil.removeClass(t.attributionControl._container,"esri-truncated-attribution:hover"),g.DomUtil.removeClass(t.attributionControl._container,"esri-truncated-attribution")),t.attributionControl._esriAttributionLayerCount=t.attributionControl._esriAttributionLayerCount-1)}function z(t){var e={geometry:null,geometryType:null};return t instanceof g.LatLngBounds?(e.geometry=R(t),e.geometryType="esriGeometryEnvelope",e):(t.getLatLng&&(t=t.getLatLng()),t instanceof g.LatLng&&(t={type:"Point",coordinates:[t.lng,t.lat]}),t instanceof g.GeoJSON&&(t=t.getLayers()[0].feature.geometry,e.geometry=T(t),e.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?(e.geometry=T(t),e.geometryType=D(t.type),e):void m("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,l){a.cors&&c(t,{},g.Util.bind(function(t,e){if(!t){l._esriAttributions=[];for(var i=0;i<e.contributors.length;i++)for(var s=e.contributors[i],r=0;r<s.coverageAreas.length;r++){var o=s.coverageAreas[r],n=g.latLng(o.bbox[0],o.bbox[1]),a=g.latLng(o.bbox[2],o.bbox[3]);l._esriAttributions.push({attribution:s.attribution,score:o.score,bounds:g.latLngBounds(n,a),minZoom:o.zoomMin,maxZoom:o.zoomMax})}l._esriAttributions.sort(function(t,e){return e.score-t.score}),N({target:l})}},this))}function N(t){var e=t.target,i=e._esriAttributions;if(e&&e.attributionControl){var s=e.attributionControl._container.querySelector(".esri-dynamic-attribution");if(s&&i){for(var r="",o=e.getBounds(),n=g.latLngBounds(o.getSouthWest().wrap(),o.getNorthEast().wrap()),a=e.getZoom(),l=0;l<i.length;l++){var u=i[l],h=u.attribution;!r.match(h)&&u.bounds.intersects(n)&&a>=u.minZoom&&a<=u.maxZoom&&(r+=", "+h)}r=r.substr(2),s.innerHTML=r,s.style.maxWidth=q(e),e.fire("attributionupdated",{attribution:r})}}}var j={warn:m,cleanUrl:M,getUrlParams:U,isArcgisOnline:G,geojsonTypeToArcGIS:D,responseToFeatureCollection:k,geojsonToArcGIS:T,arcgisToGeoJSON:C,boundsToExtent:R,extentToBounds:w,calcAttributionWidth:q,setEsriAttribution:E,_setGeometry:z,_getAttributionData:Z,_updateMapAttribution:N,_findIdAttributeFromFeature:O,_findIdAttributeFromResponse:F},W=g.Class.extend({options:{proxy:!1,useCors:i},generateSetter:function(e,t){return g.Util.bind(function(t){return this.params[e]=t,this},t)},initialize:function(t){if(t.request&&t.options?(this._service=t,g.Util.setOptions(this,t.options)):(g.Util.setOptions(this,t),this.options.url=M(t.url)),this.params=g.Util.extend({},this.params||{}),this.setters)for(var e in this.setters){var i=this.setters[e];this[e]=this.generateSetter(i,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,e){return this.options.requestParams&&g.Util.extend(this.params,this.options.requestParams),this._service?this._service.request(this.path,this.params,t,e):this._request("request",this.path,this.params,t,e)},_request:function(t,e,i,s,r){var o=this.options.proxy?this.options.proxy+"?"+this.options.url+e:this.options.url+e;return"get"!==t&&"request"!==t||this.options.useCors?S[t](o,i,s,r):S.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,e){return t=g.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=e,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(i,s){return this._cleanParams(),this.options.isModern||G(this.options.url)&&void 0===this.options.isModern?(this.params.f="geojson",this.request(function(t,e){this._trapSQLerrors(t),i.call(s,t,e,e)},this)):this.request(function(t,e){this._trapSQLerrors(t),i.call(s,t,e&&k(e),e)},this)},count:function(i,t){return this._cleanParams(),this.params.returnCountOnly=!0,this.request(function(t,e){i.call(this,t,e&&e.count,e)},t)},ids:function(i,t){return this._cleanParams(),this.params.returnIdsOnly=!0,this.request(function(t,e){i.call(this,t,e&&e.objectIds,e)},t)},bounds:function(i,s){return this._cleanParams(),this.params.returnExtentOnly=!0,this.request(function(t,e){e&&e.extent&&w(e.extent)?i.call(s,t,w(e.extent),e):(t={message:"Invalid Bounds"},i.call(s,t,null,e))},s)},distinct:function(){return this.params.returnGeometry=!1,this.params.returnDistinctValues=!0,this},pixelSize:function(t){var e=g.point(t);return this.params.pixelSize=[e.x,e.y],this},layer:function(t){return this.path=t+"/query",this},_trapSQLerrors:function(t){t&&"400"===t.code&&m("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(i,s){return this.request(function(t,e){i.call(s,t,e&&k(e),e)},s)}});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=g.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(r,o){return this.request(function(t,e){if(t)r.call(o,t,void 0,e);else{var i=k(e);e.results=e.results.reverse();for(var s=0;s<i.features.length;s++){i.features[s].layerId=e.results[s].layerId}r.call(o,void 0,i,e)}})},_setGeometryParams:function(t){var e=z(t);this.params.geometry=e.geometry,this.params.geometryType=e.geometryType}});function Y(t){return new X(t)}var $=H.extend({setters:{setMosaicRule:"mosaicRule",setRenderingRule:"renderingRule",setPixelSize:"pixelSize",returnCatalogItems:"returnCatalogItems",returnGeometry:"returnGeometry"},params:{returnGeometry:!1},at:function(t){return t=g.latLng(t),this.params.geometry=JSON.stringify({x:t.lng,y:t.lat,spatialReference:{wkid:4326}}),this.params.geometryType="esriGeometryPoint",this},getMosaicRule:function(){return this.params.mosaicRule},getRenderingRule:function(){return this.params.renderingRule},getPixelSize:function(){return this.params.pixelSize},run:function(i,s){return this.request(function(t,e){i.call(s,t,e&&this._responseToGeoJSON(e),e)},this)},_responseToGeoJSON:function(t){var e=t.location,i=t.catalogItems,s=t.catalogItemVisibilities,r={pixel:{type:"Feature",geometry:{type:"Point",coordinates:[e.x,e.y]},crs:{type:"EPSG",properties:{code:e.spatialReference.wkid}},properties:{OBJECTID:t.objectId,name:t.name,value:t.value},id:t.objectId}};if(t.properties&&t.properties.Values&&(r.pixel.properties.values=t.properties.Values),i&&i.features&&(r.catalogItems=k(i),s&&s.length===r.catalogItems.features.length))for(var o=s.length-1;0<=o;o--)r.catalogItems.features[o].properties.catalogItemVisibility=s[o];return r}});function tt(t){return new $(t)}var et=g.Evented.extend({options:{proxy:!1,useCors:i,timeout:0},initialize:function(t){t=t||{},this._requestQueue=[],this._authenticating=!1,g.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,e,i,s,r){this.fire("requeststart",{url:this.options.url+e,params:i,method:t},!0);var o=this._createServiceCallback(t,e,i,s,r);if(this.options.token&&(i.token=this.options.token),this.options.requestParams&&g.Util.extend(i,this.options.requestParams),!this._authenticating){var n=this.options.proxy?this.options.proxy+"?"+this.options.url+e:this.options.url+e;return"get"!==t&&"request"!==t||this.options.useCors?S[t](n,i,o,r):S.get.JSONP(n,i,o,r)}this._requestQueue.push([t,e,i,s,r])},_createServiceCallback:function(i,s,r,o,n){return g.Util.bind(function(t,e){!t||499!==t.code&&498!==t.code||(this._authenticating=!0,this._requestQueue.push([i,s,r,o,n]),this.fire("authenticationrequired",{authenticate:g.Util.bind(this.authenticate,this)},!0),t.authenticate=g.Util.bind(this.authenticate,this)),o.call(n,t,e),t?this.fire("requesterror",{url:this.options.url+s,params:r,message:t.message,code:t.code,method:i},!0):this.fire("requestsuccess",{url:this.options.url+s,params:r,response:e,method:i},!0),this.fire("requestend",{url:this.options.url+s,params:r,method:i},!0)},this)},_runQueue:function(){for(var t=this._requestQueue.length-1;0<=t;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,s,r){for(var e=t.features?t.features:[t],i=e.length-1;0<=i;i--)delete e[i].id;return t=T(t),t=1<e.length?t:[t],this.post("addFeatures",{features:t},function(t,e){var i=e&&e.addResults?1<e.addResults.length?e.addResults:e.addResults[0]:void 0;s&&s.call(r,t||e.addResults[0].error,i)},r)},updateFeature:function(t,e,i){this.updateFeatures(t,e,i)},updateFeatures:function(t,s,r){var e=t.features?t.features:[t];return t=T(t,this.options.idAttribute),t=1<e.length?t:[t],this.post("updateFeatures",{features:t},function(t,e){var i=e&&e.updateResults?1<e.updateResults.length?e.updateResults:e.updateResults[0]:void 0;s&&s.call(r,t||e.updateResults[0].error,i)},r)},deleteFeature:function(t,e,i){this.deleteFeatures(t,e,i)},deleteFeatures:function(t,s,r){return this.post("deleteFeatures",{objectIds:t},function(t,e){var i=e&&e.deleteResults?1<e.deleteResults.length?e.deleteResults:e.deleteResults[0]:void 0;s&&s.call(r,t||e.deleteResults[0].error,i)},r)}});function at(t){return new nt(t)}var lt="https:"!==window.location.protocol?"http:":"https:",ut=g.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:s?"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:s?"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:s?"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:s?"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:s?"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:s?"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:s?"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,e){var i;if("object"==typeof t&&t.urlTemplate&&t.options)i=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"');i=ut.TILES[t]}var s=g.Util.extend(i.options,e);g.Util.setOptions(this,s),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===i.urlTemplate.indexOf("token=")&&(i.urlTemplate+="?token="+this.options.token),this.options.proxy&&(i.urlTemplate=this.options.proxy+"?"+i.urlTemplate),g.TileLayer.prototype.initialize.call(this,i.urlTemplate,s)},onAdd:function(t){E(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),g.TileLayer.prototype.onAdd.call(this,t)},onRemove:function(t){B(t),t.off("moveend",N),g.TileLayer.prototype.onRemove.call(this,t)},_initPane:function(){var t;this._map.getPane(this.options.pane)||((t=this._map.createPane(this.options.pane)).style.pointerEvents="none",t.style.zIndex=500)},getAttribution:function(){var t;return this.options.attribution&&(t='<span class="esri-dynamic-attribution">'+this.options.attribution+"</span>"),t}});var ht=g.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=g.Util.setOptions(this,t)),this.tileUrl=(t.proxy?t.proxy+"?":"")+t.url+"tile/{z}/{y}/{x}"+(t.requestParams&&0<Object.keys(t.requestParams).length?g.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),g.TileLayer.prototype.initialize.call(this,this.tileUrl,t)},getTileUrl:function(t){var e=this._getZoomForUrl();return g.Util.template(this.tileUrl,g.Util.extend({s:this._getSubdomain(t),x:t.x,y:t.y,z:this._lodMap&&this._lodMap[e]?this._lodMap[e]:e},this.options))},createTile:function(t,e){var i=document.createElement("img");return g.DomEvent.on(i,"load",g.Util.bind(this._tileOnLoad,this,e,i)),g.DomEvent.on(i,"error",g.Util.bind(this._tileOnError,this,e,i)),this.options.crossOrigin&&(i.crossOrigin=""),i.alt="",!this._lodMap||this._lodMap&&this._lodMap[this._getZoomForUrl()]?i.src=this.getTileUrl(t):this.once("lodmap",function(){i.src=this.getTileUrl(t)},this),i},onAdd:function(u){E(u),this._lodMap||this.metadata(function(t,e){if(!t&&e.spatialReference){var i=e.spatialReference.latestWkid||e.spatialReference.wkid;if(!this.options.attribution&&u.attributionControl&&e.copyrightText&&(this.options.attribution=e.copyrightText,u.attributionControl.addAttribution(this.getAttribution())),u.options.crs!==g.CRS.EPSG3857||102100!==i&&3857!==i)u.options.crs&&u.options.crs.code&&-1<u.options.crs.code.indexOf(i)||m("L.esri.TiledMapLayer is using a non-mercator spatial reference. Support may be available through Proj4Leaflet http://esri.github.io/esri-leaflet/examples/non-mercator-projection.html");else{this._lodMap={};for(var s=e.tileInfo.lods,r=ht.MercatorZoomLevels,o=0;o<s.length;o++){var n=s[o];for(var a in r){var l=r[a];if(this._withinPercentage(n.resolution,l,this.options.zoomOffsetAllowance)){this._lodMap[a]=n.level;break}}}this.fire("lodmap")}}},this),g.TileLayer.prototype.onAdd.call(this,u)},onRemove:function(t){B(t),g.TileLayer.prototype.onRemove.call(this,t)},metadata:function(t,e){return this.service.metadata(t,e),this},identify:function(){return this.service.identify()},find:function(){return this.service.find()},query:function(){return this.service.query()},authenticate:function(t){var e="?token="+t;return this.tileUrl=this.options.token?this.tileUrl.replace(/\?token=(.+)/g,e):this.tileUrl+e,this.options.token=t,this.service.authenticate(t),this},_withinPercentage:function(t,e,i){return Math.abs(t/e-1)<i}});var ct=g.ImageOverlay.extend({onAdd:function(t){this._topLeft=t.getPixelBounds().min,g.ImageOverlay.prototype.onAdd.call(this,t)},_reset:function(){this._map.options.crs===g.CRS.EPSG3857?g.ImageOverlay.prototype._reset.call(this):g.DomUtil.setPosition(this._image,this._topLeft.subtract(this._map.getPixelOrigin()))}}),pt=g.Layer.extend({options:{opacity:1,position:"front",f:"image",useCors:i,attribution:null,interactive:!1,alt:""},onAdd:function(i){E(i),this.options.zIndex&&(this.options.position=null),this._update=g.Util.throttle(this._update,this.options.updateInterval,this),i.on("moveend",this._update,this),this._currentImage&&this._currentImage._bounds.equals(this._map.getBounds())?i.addLayer(this._currentImage):this._currentImage&&(this._map.removeLayer(this._currentImage),this._currentImage=null),this._update(),this._popup&&(this._map.on("click",this._getPopupData,this),this._map.on("dblclick",this._resetPopupState,this)),this.metadata(function(t,e){!t&&!this.options.attribution&&i.attributionControl&&e.copyrightText&&(this.options.attribution=e.copyrightText,i.attributionControl.addAttribution(this.getAttribution()))},this)},onRemove:function(t){B(t),this._currentImage&&this._map.removeLayer(this._currentImage),this._popup&&(this._map.off("click",this._getPopupData,this),this._map.off("dblclick",this._resetPopupState,this)),this._map.off("moveend",this._update,this)},bindPopup:function(t,e){return this._shouldRenderPopup=!1,this._lastClick=!1,this._popup=g.popup(e),this._popupFunction=t,this._map&&(this._map.on("click",this._getPopupData,this),this._map.on("dblclick",this._resetPopupState,this)),this},unbindPopup:function(){return this._map&&(this._map.closePopup(this._popup),this._map.off("click",this._getPopupData,this),this._map.off("dblclick",this._resetPopupState,this)),this._popup=!1,this},bringToFront:function(){return this.options.position="front",this._currentImage&&(this._currentImage.bringToFront(),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this.options.position="back",this._currentImage&&(this._currentImage.bringToBack(),this._setAutoZIndex(Math.min)),this},setZIndex:function(t){return this.options.zIndex=t,this._currentImage&&this._currentImage.setZIndex(t),this},_setAutoZIndex:function(t){if(this._currentImage){for(var e,i=this._currentImage.getPane().children,s=-t(-1/0,1/0),r=0,o=i.length;r<o;r++)e=i[r].style.zIndex,i[r]!==this._currentImage._image&&e&&(s=t(s,+e));isFinite(s)&&(this.options.zIndex=s+t(-1,1),this.setZIndex(this.options.zIndex))}},getAttribution:function(){return this.options.attribution},getOpacity:function(){return this.options.opacity},setOpacity:function(t){return this.options.opacity=t,this._currentImage&&this._currentImage.setOpacity(t),this},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(t,e){return this.options.from=t,this.options.to=e,this._update(),this},metadata:function(t,e){return this.service.metadata(t,e),this},authenticate:function(t){return this.service.authenticate(t),this},redraw:function(){this._update()},_renderImage:function(t,s,e){if(this._map){if(e&&(t="data:"+e+";base64,"+t),!t)return;var r=new ct(t,s,{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),o=function(t){var e,i;r.off("error",o,this),this._map&&(e=t.target,i=this._currentImage,e._bounds.equals(s)&&e._bounds.equals(this._map.getBounds())?(this._currentImage=e,"front"===this.options.position?this.bringToFront():"back"===this.options.position&&this.bringToBack(),this.options.zIndex&&this.setZIndex(this.options.zIndex),this._map&&this._currentImage._map?this._currentImage.setOpacity(this.options.opacity):this._currentImage._map.removeLayer(this._currentImage),i&&this._map&&this._map.removeLayer(i),i&&i._map&&i._map.removeLayer(i)):this._map.removeLayer(e)),this.fire("load",{bounds:s})};r.once("error",function(){this._map.removeLayer(r),this.fire("error"),r.off("load",o,this)},this),r.once("load",o,this)}},_update:function(){var t,e,i;this._map&&(t=this._map.getZoom(),e=this._map.getBounds(),this._animatingZoom||this._map._panTransition&&this._map._panTransition._inProgress||(t>this.options.maxZoom||t<this.options.minZoom?this._currentImage&&(this._currentImage._map.removeLayer(this._currentImage),this._currentImage=null):(i=this._buildExportParams(),g.Util.extend(i,this.options.requestParams),i?(this._requestExport(i,e),this.fire("loading",{bounds:e})):this._currentImage&&(this._currentImage._map.removeLayer(this._currentImage),this._currentImage=null))))},_renderPopup:function(t,e,i,s){var r;t=g.latLng(t),this._shouldRenderPopup&&this._lastClick.equals(t)&&((r=this._popupFunction(e,i,s))&&this._popup.setLatLng(t).setContent(r).openOn(this._map))},_resetPopupState:function(t){this._shouldRenderPopup=!1,this._lastClick=t.latlng},_calculateBbox:function(){var t=this._map.getPixelBounds(),e=this._map.unproject(t.getBottomLeft()),i=this._map.unproject(t.getTopRight()),s=this._map.options.crs.project(i),r=this._map.options.crs.project(e),o=g.bounds(s,r);return[o.getBottomLeft().x,o.getBottomLeft().y,o.getTopRight().x,o.getTopRight().y].join(",")},_calculateImageSize:function(){var t=this._map.getPixelBounds(),e=this._map.getSize(),i=this._map.unproject(t.getBottomLeft()),s=this._map.unproject(t.getTopRight()),r=this._map.latLngToLayerPoint(s).y,o=this._map.latLngToLayerPoint(i).y;return(0<r||o<e.y)&&(e.y=o-r),e.x+","+e.y}}),dt=pt.extend({options:{updateInterval:150,format:"jpgpng",transparent:!0,f:"image"},query:function(){return this.service.query()},identify:function(){return this.service.identify()},initialize:function(t){t=U(t),this.service=ot(t),this.service.addEventParent(this),g.Util.setOptions(this,t)},setPixelType:function(t){return this.options.pixelType=t,this._update(),this},getPixelType:function(){return this.options.pixelType},setBandIds:function(t){return g.Util.isArray(t)?this.options.bandIds=t.join(","):this.options.bandIds=t.toString(),this._update(),this},getBandIds:function(){return this.options.bandIds},setNoData:function(t,e){return g.Util.isArray(t)?this.options.noData=t.join(","):this.options.noData=t.toString(),e&&(this.options.noDataInterpretation=e),this._update(),this},getNoData:function(){return this.options.noData},getNoDataInterpretation:function(){return this.options.noDataInterpretation},setRenderingRule:function(t){this.options.renderingRule=t,this._update()},getRenderingRule:function(){return this.options.renderingRule},setMosaicRule:function(t){this.options.mosaicRule=t,this._update()},getMosaicRule:function(){return this.options.mosaicRule},_getPopupData:function(s){var t=g.Util.bind(function(t,e,i){t||setTimeout(g.Util.bind(function(){this._renderPopup(s.latlng,t,e,i)},this),300)},this),e=this.identify().at(s.latlng);this.options.mosaicRule&&e.setMosaicRule(this.options.mosaicRule),e.run(t),this._shouldRenderPopup=!0,this._lastClick=s.latlng},_buildExportParams:function(){var t=parseInt(this._map.options.crs.code.split(":")[1],10),e={bbox:this._calculateBbox(),size:this._calculateImageSize(),format:this.options.format,transparent:this.options.transparent,bboxSR:t,imageSR:t};return this.options.from&&this.options.to&&(e.time=this.options.from.valueOf()+","+this.options.to.valueOf()),this.options.pixelType&&(e.pixelType=this.options.pixelType),this.options.interpolation&&(e.interpolation=this.options.interpolation),this.options.compressionQuality&&(e.compressionQuality=this.options.compressionQuality),this.options.bandIds&&(e.bandIds=this.options.bandIds),0!==this.options.noData&&!this.options.noData||(e.noData=this.options.noData),this.options.noDataInterpretation&&(e.noDataInterpretation=this.options.noDataInterpretation),this.service.options.token&&(e.token=this.service.options.token),this.options.renderingRule&&(e.renderingRule=JSON.stringify(this.options.renderingRule)),this.options.mosaicRule&&(e.mosaicRule=JSON.stringify(this.options.mosaicRule)),e},_requestExport:function(t,i){var e;"json"===this.options.f?this.service.request("exportImage",t,function(t,e){t||(this.options.token&&(e.href+="?token="+this.options.token),this.options.proxy&&(e.href=this.options.proxy+"?"+e.href),this._renderImage(e.href,i))},this):(t.f="image",e=this.options.url+"exportImage"+g.Util.getParamString(t),this.options.proxy&&(e=this.options.proxy+"?"+e),this._renderImage(e,i))}});var mt=pt.extend({options:{updateInterval:150,layers:!1,layerDefs:!1,timeOptions:!1,format:"png32",transparent:!0,f:"json"},initialize:function(t){t=U(t),this.service=st(t),this.service.addEventParent(this),g.Util.setOptions(this,t)},getDynamicLayers:function(){return this.options.dynamicLayers},setDynamicLayers:function(t){return this.options.dynamicLayers=t,this._update(),this},getLayers:function(){return this.options.layers},setLayers:function(t){return this.options.layers=t,this._update(),this},getLayerDefs:function(){return this.options.layerDefs},setLayerDefs:function(t){return this.options.layerDefs=t,this._update(),this},getTimeOptions:function(){return this.options.timeOptions},setTimeOptions:function(t){return this.options.timeOptions=t,this._update(),this},query:function(){return this.service.query()},identify:function(){return this.service.identify()},find:function(){return this.service.find()},_getPopupData:function(s){var t=g.Util.bind(function(t,e,i){t||setTimeout(g.Util.bind(function(){this._renderPopup(s.latlng,t,e,i)},this),300)},this),e=this.options.popup?this.options.popup.on(this._map).at(s.latlng):this.identify().on(this._map).at(s.latlng);if(e.params.maxAllowableOffset||e.simplify(this._map,.5),this.options.popup&&this.options.popup.params&&this.options.popup.params.layers||(this.options.layers?e.layers("visible:"+this.options.layers.join(",")):e.layers("visible")),this.options.layerDefs&&"string"!=typeof this.options.layerDefs&&!e.params.layerDefs)for(var i in this.options.layerDefs)this.options.layerDefs.hasOwnProperty(i)&&e.layerDef(i,this.options.layerDefs[i]);e.run(t),this._shouldRenderPopup=!0,this._lastClick=s.latlng},_buildExportParams:function(){var t=parseInt(this._map.options.crs.code.split(":")[1],10),e={bbox:this._calculateBbox(),size:this._calculateImageSize(),dpi:96,format:this.options.format,transparent:this.options.transparent,bboxSR:t,imageSR:t};if(this.options.dynamicLayers&&(e.dynamicLayers=this.options.dynamicLayers),this.options.layers){if(0===this.options.layers.length)return;e.layers="show:"+this.options.layers.join(",")}return this.options.layerDefs&&(e.layerDefs="string"==typeof this.options.layerDefs?this.options.layerDefs:JSON.stringify(this.options.layerDefs)),this.options.timeOptions&&(e.timeOptions=JSON.stringify(this.options.timeOptions)),this.options.from&&this.options.to&&(e.time=this.options.from.valueOf()+","+this.options.to.valueOf()),this.service.options.token&&(e.token=this.service.options.token),this.options.proxy&&(e.proxy=this.options.proxy),this.options.disableCache&&(e._ts=Date.now()),e},_requestExport:function(t,i){var e;"json"===this.options.f?this.service.request("export",t,function(t,e){t||(this.options.token&&e.href&&(e.href+="?token="+this.options.token),this.options.proxy&&e.href&&(e.href=this.options.proxy+"?"+e.href),e.href?this._renderImage(e.href,i):this._renderImage(e.imageData,i,e.contentType))},this):(t.f="image",e=this.options.url+"export"+g.Util.getParamString(t),this.options.proxy&&(e=this.options.proxy+"?"+e),this._renderImage(e,i))}});var ft=g.Layer.extend({options:{cellSize:512,updateWhenIdle:g.Browser.mobile,updateInterval:150,noWrap:!1,keepBuffer:1.5},initialize:function(t){g.Util.setOptions(this,t)},onAdd:function(t){this._cells={},this._activeCells={},this._resetView(),this._update()},onRemove:function(t){this._removeAllCells(),this._cellZoom=void 0},isLoading:function(){return this._loading},redraw:function(){return this._map&&(this._removeAllCells(),this._update()),this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=g.Util.throttle(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),t},createCell:function(){return document.createElement("div")},removeCell:function(){},reuseCell:function(){},cellLeave:function(){},cellEnter:function(){},getCellSize:function(){var t=this.options.cellSize;return t instanceof g.Point?t:new g.Point(t,t)},_pruneCells:function(){if(this._map){var t,e,i;for(t in this._cells)(i=this._cells[t]).retain=i.current;for(t in this._cells){(i=this._cells[t]).current&&!i.active&&(e=i.coords,this._retainParent(e.x,e.y,e.z,e.z-5)||this._retainChildren(e.x,e.y,e.z,e.z+2))}for(t in this._cells)this._cells[t].retain||this._removeCell(t)}},_removeAllCells:function(){for(var t in this._cells)this._removeCell(t)},_invalidateAll:function(){this._removeAllCells(),this._cellZoom=void 0},_retainParent:function(t,e,i,s){var r=Math.floor(t/2),o=Math.floor(e/2),n=i-1,a=new g.Point(+r,+o);a.z=+n;var l=this._cellCoordsToKey(a),u=this._cells[l];return u&&u.active?u.retain=!0:(u&&u.loaded&&(u.retain=!0),s<n&&this._retainParent(r,o,n,s))},_retainChildren:function(t,e,i,s){for(var r=2*t;r<2*t+2;r++)for(var o=2*e;o<2*e+2;o++){var n=new g.Point(r,o);n.z=i+1;var a=this._cellCoordsToKey(n),l=this._cells[a];l&&l.active?l.retain=!0:(l&&l.loaded&&(l.retain=!0),i+1<s&&this._retainChildren(r,o,i+1,s))}},_resetView:function(t){var e=t&&(t.pinch||t.flyTo);e||this._setView(this._map.getCenter(),this._map.getZoom(),e,e)},_setView:function(t,e,i,s){var r=Math.round(e);s||(this._cellZoom=r,this._abortLoading&&this._abortLoading(),this._resetGrid(),void 0!==r&&this._update(t),i||this._pruneCells(),this._noPrune=!!i)},_resetGrid:function(){var t=this._map,e=t.options.crs,i=this._cellSize=this.getCellSize(),s=this._cellZoom,r=this._map.getPixelWorldBounds(this._cellZoom);r&&(this._globalCellRange=this._pxBoundsToCellRange(r)),this._wrapX=e.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,e.wrapLng[0]],s).x/i.x),Math.ceil(t.project([0,e.wrapLng[1]],s).x/i.y)],this._wrapY=e.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([e.wrapLat[0],0],s).y/i.x),Math.ceil(t.project([e.wrapLat[1],0],s).y/i.y)]},_onMoveEnd:function(t){t&&(t.pinch||t.flyTo)||!this._map||this._map._animatingZoom||this._update()},_getCelldPixelBounds:function(t){var e=this._map,i=e._animatingZoom?Math.max(e._animateToZoom,e.getZoom()):e.getZoom(),s=e.getZoomScale(i,this._cellZoom),r=e.project(t,this._cellZoom).floor(),o=e.getSize().divideBy(2*s);return new g.Bounds(r.subtract(o),r.add(o))},_update:function(t){var e=this._map;if(e){var i=Math.round(e.getZoom());void 0===t&&(t=e.getCenter());var s=this._getCelldPixelBounds(t),r=this._pxBoundsToCellRange(s),o=r.getCenter(),n=[],a=this.options.keepBuffer,l=new g.Bounds(r.getBottomLeft().subtract([a,-a]),r.getTopRight().add([a,-a]));if(!(isFinite(r.min.x)&&isFinite(r.min.y)&&isFinite(r.max.x)&&isFinite(r.max.y)))throw new Error("Attempted to load an infinite number of cells");for(var u in this._cells){var h=this._cells[u].coords;h.z===this._cellZoom&&l.contains(new g.Point(h.x,h.y))||(this._cells[u].current=!1)}if(1<Math.abs(i-this._cellZoom))this._setView(t,i);else{for(var c=r.min.y;c<=r.max.y;c++)for(var p=r.min.x;p<=r.max.x;p++){var d,m=new g.Point(p,c);m.z=this._cellZoom,this._isValidCell(m)&&((d=this._cells[this._cellCoordsToKey(m)])?d.current=!0:n.push(m))}if(n.sort(function(t,e){return t.distanceTo(o)-e.distanceTo(o)}),0!==n.length)for(this._loading||(this._loading=!0),p=0;p<n.length;p++){var f=this._cellCoordsToKey(n[p]),y=this._keyToCellCoords(f);this._activeCells[y]?this._reuseCell(n[p]):this._createCell(n[p])}}}},_isValidCell:function(t){var e=this._map.options.crs;if(!e.infinite){var i=this._globalCellRange;if(!e.wrapLng&&(t.x<i.min.x||t.x>i.max.x)||!e.wrapLat&&(t.y<i.min.y||t.y>i.max.y))return!1}if(!this.options.bounds)return!0;var s=this._cellCoordsToBounds(t);return g.toLatLngBounds(this.options.bounds).overlaps(s)},_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 e=this._cellCoordsToNwSe(t),i=new g.LatLngBounds(e[0],e[1]);return this.options.noWrap||(i=this._map.wrapLatLngBounds(i)),i},_cellCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToCellCoords:function(t){var e=t.split(":"),i=new g.Point(+e[0],+e[1]);return i.z=+e[2],i},_removeCell:function(t){var e,i,s,r=this._cells[t];r&&(e=this._keyToCellCoords(t),i=this._wrapCoords(e),s=this._cellCoordsToBounds(this._wrapCoords(e)),r.current=!1,delete this._cells[t],this._activeCells[t]=r,this.cellLeave(s,i,t),this.fire("cellleave",{key:t,coords:i,bounds:s}))},_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 e=this._cellCoordsToKey(t),i=this._wrapCoords(t),s=this._cellCoordsToBounds(this._wrapCoords(t));this.createCell(s,i,e),this.fire("cellcreate",{key:e,coords:i,bounds:s}),this._cells[e]={coords:t,current:!0},g.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 e=new g.Point(this._wrapX?g.Util.wrapNum(t.x,this._wrapX):t.x,this._wrapY?g.Util.wrapNum(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToCellRange:function(t){var e=this.getCellSize();return new g.Bounds(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).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=1+e;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=g.Util.setOptions(this,t),this.service=at(t),this.service.addEventParent(this),"*"!==this.options.fields[0]){for(var e=!1,i=0;i<this.options.fields.length;i++)this.options.fields[i].match(/^(OBJECTID|FID|OID|ID)$/i)&&(e=!0);!1===e&&m("no known esriFieldTypeOID field detected in fields Array. Please add an attribute field containing unique IDs to ensure the layer can be drawn correctly.")}this.options.timeField.start&&this.options.timeField.end?(this._startTimeIndex=new yt,this._endTimeIndex=new yt):this.options.timeField&&(this._timeIndex=new yt),this._cache={},this._currentSnapshot=[],this._activeRequests=0},onAdd:function(r){return E(r),this.service.metadata(function(t,e){var i,s;t||(i=e.supportedQueryFormats,(s=!1)!==this.service.options.isModern&&!this.options.fetchAllFeatures||(s=!0),!s&&i&&-1!==i.indexOf("geoJSON")&&(this.service.options.isModern=!0),e.objectIdField&&(this.service.options.idAttribute=e.objectIdField),!this.options.attribution&&r.attributionControl&&e.copyrightText&&(this.options.attribution=e.copyrightText,r.attributionControl.addAttribution(this.getAttribution())))},this),r.on("zoomend",this._handleZoomChange,this),ft.prototype.onAdd.call(this,r)},onRemove:function(t){return B(t),t.off("zoomend",this._handleZoomChange,this),ft.prototype.onRemove.call(this,t)},getAttribution:function(){return this.options.attribution},createCell:function(t,e){this._visibleZoom()&&this._requestFeatures(t,e)},_requestFeatures:function(s,r,o,n){this._activeRequests++,n=n||0;var a=this.options.where;return 1===this._activeRequests&&this.fire("loading",{bounds:s},!0),this._buildQuery(s,n).run(function(t,e,i){i&&i.exceededTransferLimit&&this.fire("drawlimitexceeded"),this.options.where===a&&(!t&&e&&e.features.length&&g.Util.requestAnimFrame(g.Util.bind(function(){this._addFeatures(e.features,r),this._postProcessFeatures(s)},this)),t||!e||e.features.length||this._postProcessFeatures(s),t&&this._postProcessFeatures(s),o&&o.call(this,t,e),i&&(i.exceededTransferLimit||i.properties&&i.properties.exceededTransferLimit)&&this.options.fetchAllFeatures&&this._requestFeatures(s,r,o,n+e.features.length))},this)},_postProcessFeatures:function(t){this._activeRequests--,this._activeRequests<=0&&this.fire("load",{bounds:t})},_cacheKey:function(t){return t.z+":"+t.x+":"+t.y},_addFeatures:function(t,e){var i;e&&(i=this._cacheKey(e),this._cache[i]=this._cache[i]||[]);for(var s=t.length-1;0<=s;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,e){var i=this.service.query().intersects(t).where(this.options.where).fields(this.options.fields).precision(this.options.precision);return this.options.fetchAllFeatures&&!isNaN(parseInt(e))&&(i=i.offset(e)),i.params.resultType="tile",this.options.requestParams&&g.Util.extend(i.params,this.options.requestParams),this.options.simplifyFactor&&i.simplify(this._map,this.options.simplifyFactor),"server"===this.options.timeFilterMode&&this.options.from&&this.options.to&&i.between(this.options.from,this.options.to),i},setWhere:function(s,r,o){this.options.where=s&&s.length?s:"1=1";for(var n=[],a=[],l=0,u=null,t=g.Util.bind(function(t,e){if(t&&(u=t),e)for(var i=e.features.length-1;0<=i;i--)a.push(e.features[i].id);--l<=0&&this._visibleZoom()&&s===this.options.where&&(this._currentSnapshot=a,g.Util.requestAnimFrame(g.Util.bind(function(){this.removeLayers(n),this.addLayers(a),r&&r.call(o,u)},this)))},this),e=this._currentSnapshot.length-1;0<=e;e--)n.push(this._currentSnapshot[e]);for(var i in this._cache={},this._cells){l++;var h=this._keyToCellCoords(i),c=this._cellCoordsToBounds(h);this._requestFeatures(c,h,t)}return this},getWhere:function(){return this.options.where},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(e,i,s,r){var o=this.options.from,n=this.options.to,a=0,l=null,t=g.Util.bind(function(t){t&&(l=t),this._filterExistingFeatures(o,n,e,i),a--,s&&a<=0&&s.call(r,l)},this);if(this.options.from=e,this.options.to=i,this._filterExistingFeatures(o,n,e,i),"server"===this.options.timeFilterMode)for(var u in this._cells){a++;var h=this._keyToCellCoords(u),c=this._cellCoordsToBounds(h);this._requestFeatures(c,h,t)}return this},refresh:function(){this.setWhere(this.options.where)},_filterExistingFeatures:function(t,e,i,s){var r=t&&e?this._getFeaturesInTimeRange(t,e):this._currentSnapshot,o=this._getFeaturesInTimeRange(i,s);if(o.indexOf)for(var n=0;n<o.length;n++){var a=r.indexOf(o[n]);0<=a&&r.splice(a,1)}g.Util.requestAnimFrame(g.Util.bind(function(){this.removeLayers(r),this.addLayers(o)},this))},_getFeaturesInTimeRange:function(t,e){var i=[];if(this.options.timeField.start&&this.options.timeField.end)var s=this._startTimeIndex.between(t,e),r=this._endTimeIndex.between(t,e),o=s.concat(r);else{if(!this._timeIndex)return m("You must set timeField in the layer constructor in order to manipulate the start and end time filter."),[];o=this._timeIndex.between(t,e)}for(var n=o.length-1;0<=n;n--)i.push(o[n].id);return i},_buildTimeIndexes:function(t){var e;if(this.options.timeField.start&&this.options.timeField.end){for(var i=[],s=[],r=t.length-1;0<=r;r--)e=t[r],i.push({id:e.id,value:new Date(e.properties[this.options.timeField.start])}),s.push({id:e.id,value:new Date(e.properties[this.options.timeField.end])});this._startTimeIndex.bulkAdd(i),this._endTimeIndex.bulkAdd(s)}else{var o=[];for(r=t.length-1;0<=r;r--)e=t[r],o.push({id:e.id,value:new Date(e.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 e<=s&&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 e<=r&&r<=i||e<=o&&o<=i||r<=e&&i<=o}},_visibleZoom:function(){if(!this._map)return!1;var t=this._map.getZoom();return!(t>this.options.maxZoom||t<this.options.minZoom)},_handleZoomChange:function(){if(this._visibleZoom())for(var t in this._cells){var e=this._cells[t].coords,i=this._cacheKey(e);this._cache[i]&&this.addLayers(this._cache[i])}else this.removeLayers(this._currentSnapshot),this._currentSnapshot=[]},authenticate:function(t){return this.service.authenticate(t),this},metadata:function(t,e){return this.service.metadata(t,e),this},query:function(){return this.service.query()},_getMetadata:function(i){this._metadata?i(void 0,this._metadata):this.metadata(g.Util.bind(function(t,e){this._metadata=e,i(t,this._metadata)},this))},addFeature:function(t,e,i){this.addFeatures(t,e,i)},addFeatures:function(e,o,n){this._getMetadata(g.Util.bind(function(t,s){var r;t?o&&o.call(this,t,null):(r=e.features?e.features:[e],this.service.addFeatures(e,g.Util.bind(function(t,e){if(!t){for(var i=r.length-1;0<=i;i--)r[i].properties[s.objectIdField]=1<r.length?e[i].objectId:e.objectId,r[i].id=1<r.length?e[i].objectId:e.objectId;this._addFeatures(r)}o&&o.call(n,t,e)},this)))},this))},updateFeature:function(t,e,i){this.updateFeatures(t,e,i)},updateFeatures:function(t,s,r){var o=t.features?t.features:[t];this.service.updateFeatures(t,function(t,e){if(!t){for(var i=o.length-1;0<=i;i--)this.removeLayers([o[i].id],!0);this._addFeatures(o)}s&&s.call(r,t,e)},this)},deleteFeature:function(t,e,i){this.deleteFeatures(t,e,i)},deleteFeatures:function(t,r,o){return this.service.deleteFeatures(t,function(t,e){var i=e.length?e:[e];if(!t&&0<i.length)for(var s=i.length-1;0<=s;s--)this.removeLayers([i[s].objectId],!0);r&&r.call(o,t,e)},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 e=g.GeoJSON.geometryToLayer(t,this.options);return e&&(e.defaultOptions=e.options),e},_updateLayer:function(t,e){var i=[],s=this.options.coordsToLatLng||g.GeoJSON.coordsToLatLng;switch(e.properties&&(t.feature.properties=e.properties),e.geometry.type){case"Point":i=g.GeoJSON.coordsToLatLng(e.geometry.coordinates),t.setLatLng(i);break;case"LineString":i=g.GeoJSON.coordsToLatLngs(e.geometry.coordinates,0,s),t.setLatLngs(i);break;case"MultiLineString":case"Polygon":i=g.GeoJSON.coordsToLatLngs(e.geometry.coordinates,1,s),t.setLatLngs(i);break;case"MultiPolygon":i=g.GeoJSON.coordsToLatLngs(e.geometry.coordinates,2,s),t.setLatLngs(i)}},createLayers:function(t){for(var e=t.length-1;0<=e;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&&0<this.options.simplifyFactor&&(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)):m("invalid GeoJSON encountered"))}},addLayers:function(t){for(var e=t.length-1;0<=e;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;0<=i;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,s){this._visibleZoom()&&!this._zooming&&this._map&&g.Util.requestAnimFrame(g.Util.bind(function(){var t=this._cacheKey(s),e=this._cellCoordsToKey(s),i=this._cache[t];this._activeCells[e]&&i&&this.addLayers(i)},this))},cellLeave:function(t,a){this._zooming||g.Util.requestAnimFrame(g.Util.bind(function(){if(this._map){var t=this._cacheKey(a),e=this._cellCoordsToKey(a),i=this._cache[t],s=this._map.getBounds();if(!this._activeCells[e]&&i){for(var r=!0,o=0;o<i.length;o++){var n=this._layers[i[o]];n&&n.getBounds&&s.intersects(n.getBounds())&&(r=!1)}r&&this.removeLayers(i,!this.options.cacheLayers),!this.options.cacheLayers&&r&&(delete this._cache[t],delete this._cells[e],delete this._activeCells[e])}}},this))},resetStyle:function(){return this.options.style=this._originalStyle,this.eachFeature(function(t){this.resetFeatureStyle(t.feature.id)},this),this},setStyle:function(e){return this.options.style=e,this.eachFeature(function(t){this.setFeatureStyle(t.feature.id,e)},this),this},resetFeatureStyle:function(t){var e=this._layers[t],i=this._originalStyle||g.Path.prototype.options;return e&&(g.Util.extend(e.options,e.defaultOptions),this.setFeatureStyle(t,i)),this},setFeatureStyle:function(t,e){var i=this._layers[t];return"function"==typeof e&&(e=e(i.feature)),i.setStyle&&i.setStyle(e),this},eachActiveFeature:function(t,e){if(this._map){var i=this._map.getBounds();for(var s in this._layers)-1!==this._currentSnapshot.indexOf(this._layers[s].feature.id)&&("function"==typeof this._layers[s].getLatLng&&i.contains(this._layers[s].getLatLng())||"function"==typeof this._layers[s].getBounds&&i.intersects(this._layers[s].getBounds()))&&t.call(e,this._layers[s])}return this},eachFeature:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},getFeature:function(t){return this._layers[t]},bringToBack:function(){this.eachFeature(function(t){t.bringToBack&&t.bringToBack()})},bringToFront:function(){this.eachFeature(function(t){t.bringToFront&&t.bringToFront()})},redraw:function(t){return t&&this._redraw(t),this},_redraw:function(t){var e,i,s=this._layers[t],r=s.feature;s&&s.setIcon&&this.options.pointToLayer&&this.options.pointToLayer&&(e=this.options.pointToLayer(r,g.latLng(r.geometry.coordinates[1],r.geometry.coordinates[0])).options.icon,s.setIcon(e)),s&&s.setStyle&&this.options.pointToLayer&&(i=this.options.pointToLayer(r,g.latLng(r.geometry.coordinates[1],r.geometry.coordinates[0])).options,this.setFeatureStyle(r.id,i)),s&&s.setStyle&&this.options.style&&this.resetStyle(r.id)}});var vt=e;t.BasemapLayer=ut,t.DynamicMapLayer=mt,t.FeatureLayer=_t,t.FeatureLayerService=nt,t.FeatureManager=gt,t.Find=Q,t.Identify=H,t.IdentifyFeatures=X,t.IdentifyImage=$,t.ImageMapLayer=dt,t.ImageService=rt,t.MapService=it,t.Query=J,t.RasterLayer=pt,t.Service=et,t.Support=a,t.Task=W,t.TiledMapLayer=ht,t.Util=j,t.VERSION=vt,t.basemapLayer=function(t,e){return new ut(t,e)},t.dynamicMapLayer=function(t,e){return new mt(t,e)},t.featureLayer=function(t){return new _t(t)},t.featureLayerService=at,t.find=K,t.get=d,t.identify=function(t){return new H(t)},t.identifyFeatures=Y,t.identifyImage=tt,t.imageMapLayer=function(t,e){return new dt(t,e)},t.imageService=ot,t.mapService=st,t.options=r,t.post=o,t.query=V,t.request=c,t.service=function(t){return t=U(t),new et(t)},t.task=function(t){return t=U(t),new W(t)},t.tiledMapLayer=function(t,e){return new ht(t,e)},Object.defineProperty(t,"__esModule",{value:!0})});
|
5
12
|
//# sourceMappingURL=esri-leaflet.js.map
|