From 74db811a76d50d3c64bba72536953b3243f56d57 Mon Sep 17 00:00:00 2001 From: Patrick Arlt Date: Thu, 7 Nov 2013 11:10:37 -0800 Subject: [PATCH] rebuild --- dist/esri-leaflet-src.js | 2 +- dist/esri-leaflet.js | 2 +- dist/extras/esri-basemaps-src.js | 2 +- dist/extras/esri-basemaps.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/esri-leaflet-src.js b/dist/esri-leaflet-src.js index 8ea50319d..55a7b06d5 100644 --- a/dist/esri-leaflet-src.js +++ b/dist/esri-leaflet-src.js @@ -3075,7 +3075,7 @@ L.esri.Mixins.identifiableLayer = { } else if(typeof key === "string" && L.esri.BasemapLayer.TILES[key]){ config = L.esri.BasemapLayer.TILES[key]; } else { - throw new Error("L.esri.BasemapLayer: Invalid parameter. Use one of 'Streets', 'Topographic', 'Oceans', 'NationalGeographic', 'Gray', 'GrayLabels', 'Imagery', 'ImageryLabels', 'ImageryTransportation', 'ImageryAlternateLabels' or 'ShadedRelief'"); + throw new Error("L.esri.BasemapLayer: Invalid parameter. Use one of 'Streets', 'Topographic', 'Oceans', 'NationalGeographic', 'Gray', 'GrayLabels', 'Imagery', 'ImageryLabels', 'ImageryTransportation', 'ShadedRelief' or 'ShadedReliefLabels'"); } // merge passed options into the config options diff --git a/dist/esri-leaflet.js b/dist/esri-leaflet.js index 37c67d46f..09799553e 100644 --- a/dist/esri-leaflet.js +++ b/dist/esri-leaflet.js @@ -2,7 +2,7 @@ * Copyright (c) 2013 Environmental Systems Research Institute, Inc. * Apache License*/ !function(a,b){"object"==typeof module&&"object"==typeof module.exports&&(exports=module.exports=b()),"object"==typeof window&&(a.Terraformer=b())}(this,function(){function a(){var a=Array.prototype.slice.apply(arguments);void 0!==typeof console&&console.warn&&console.warn.apply(console,a)}function b(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function c(a){switch(a.type){case"Point":return[a.coordinates[0],a.coordinates[1],a.coordinates[0],a.coordinates[1]];case"MultiPoint":return f(a.coordinates);case"LineString":return f(a.coordinates);case"MultiLineString":return d(a.coordinates);case"Polygon":return d(a.coordinates);case"MultiPolygon":return e(a.coordinates);case"Feature":return c(a.geometry);case"FeatureCollection":return g(a);case"GeometryCollection":return h(a);default:throw new Error("Unknown type: "+a.type)}}function d(a){for(var b=null,c=null,d=null,e=null,f=0;fj&&(b=j),null===c?c=j:j>c&&(c=j),null===d?d=k:d>k&&(d=k),null===e?e=k:k>e&&(e=k)}return[b,d,c,e]}function e(a){for(var b=null,c=null,d=null,e=null,f=0;fl&&(b=l),null===c?c=l:l>c&&(c=l),null===d?d=m:d>m&&(d=m),null===e?e=m:m>e&&(e=m)}return[b,d,c,e]}function f(a){for(var b=null,c=null,d=null,e=null,f=0;fh&&(b=h),null===c?c=h:h>c&&(c=h),null===d?d=i:d>i&&(d=i),null===e?e=i:i>e&&(e=i)}return[b,d,c,e]}function g(a){for(var b,d=[],e=a.features.length-1;e>=0;e--)b=c(a.features[e].geometry),d.push([b[0],b[1]]),d.push([b[2],b[3]]);return f(d)}function h(a){for(var b,d=[],e=a.geometries.length-1;e>=0;e--)b=c(a.geometries[e]),d.push([b[0],b[1]]),d.push([b[2],b[3]]);return f(d)}function i(a){var b=c(a);return{x:b[0],y:b[1],w:Math.abs(b[0]-b[2]),h:Math.abs(b[1]-b[3])}}function k(a){return a*Y}function l(a){return a*Z}function m(a,b){for(var c=0;ca?-1:a>b?1:0}function t(a,b){return a[0]-b[0]>a[1]-b[1]?1:a[0]-b[0]v(b,c))&&(c=a[d])}return c}function x(a){if(0===a.length)return[];if(1===a.length)return a;for(var b=[a.sort(t)[0]],c=0;c=0&&1>=h&&i>=0&&1>=i)return!0}return!1}function B(a,b){for(var c=0;c=2))throw"Terraformer: invalid input for Terraformer.Point";this.coordinates=c}this.type="Point"}function M(a){if(a&&"MultiPoint"===a.type&&a.coordinates)b(this,a);else{if(!Array.isArray(a))throw"Terraformer: invalid input for Terraformer.MultiPoint";this.coordinates=a}this.type="MultiPoint"}function N(a){if(a&&"LineString"===a.type&&a.coordinates)b(this,a);else{if(!Array.isArray(a))throw"Terraformer: invalid input for Terraformer.LineString";this.coordinates=a}this.type="LineString"}function O(a){if(a&&"MultiLineString"===a.type&&a.coordinates)b(this,a);else{if(!Array.isArray(a))throw"Terraformer: invalid input for Terraformer.MultiLineString";this.coordinates=a}this.type="MultiLineString"}function P(a){if(a&&"Polygon"===a.type&&a.coordinates)b(this,a);else{if(!Array.isArray(a))throw"Terraformer: invalid input for Terraformer.Polygon";this.coordinates=a}this.type="Polygon"}function Q(a){if(a&&"MultiPolygon"===a.type&&a.coordinates)b(this,a);else{if(!Array.isArray(a))throw"Terraformer: invalid input for Terraformer.MultiPolygon";this.coordinates=a}this.type="MultiPolygon"}function R(a){if(a&&"Feature"===a.type&&a.geometry)b(this,a);else{if(!(a&&a.type&&a.coordinates))throw"Terraformer: invalid input for Terraformer.Feature";this.geometry=a}this.type="Feature"}function S(a){if(a&&"FeatureCollection"===a.type&&a.features)b(this,a);else{if(!Array.isArray(a))throw"Terraformer: invalid input for Terraformer.FeatureCollection";this.features=a}this.type="FeatureCollection"}function T(a){if(a&&"GeometryCollection"===a.type&&a.geometries)b(this,a);else if(Array.isArray(a))this.geometries=a;else{if(!a.coordinates||!a.type)throw"Terraformer: invalid input for Terraformer.GeometryCollection";this.type="GeometryCollection",this.geometries=[a]}this.type="GeometryCollection"}function U(a,b,c){for(var d=o(a),e=c||64,f={type:"Polygon",coordinates:[[]]},g=1;e>=g;g++){var h=g*(360/e)*Math.PI/180;f.coordinates[0].push([d[0]+b*Math.cos(h),d[1]+b*Math.sin(h)])}return r(f)}function V(a,c,d){var e=d||64,f=c||250;if(!a||a.length<2||!f||!e)throw new Error("Terraformer: missing parameter for Terraformer.Circle");b(this,new R({type:"Feature",geometry:U(a,f,e),properties:{radius:f,center:a,steps:e}}))}var W={},X=6378137,Y=57.29577951308232,Z=.017453292519943,$={type:"link",properties:{href:"http://spatialreference.org/ref/sr-org/6928/ogcwkt/",type:"ogcwkt"}},_={type:"link",properties:{href:"http://spatialreference.org/ref/epsg/4326/ogcwkt/",type:"ogcwkt"}},ab=["length"];return K.prototype.toMercator=function(){return q(this)},K.prototype.toGeographic=function(){return r(this)},K.prototype.envelope=function(){return i(this)},K.prototype.bbox=function(){return c(this)},K.prototype.convexHull=function(){var a,b,c=[];if("Point"===this.type)return this.coordinates&&this.coordinates.length>0?[this.coordinates]:[];if("LineString"===this.type||"MultiPoint"===this.type){if(!(this.coordinates&&this.coordinates.length>0))return[];c=this.coordinates}else if("Polygon"===this.type||"MultiLineString"===this.type){if(!(this.coordinates&&this.coordinates.length>0))return[];for(a=0;a0))return[];for(a=0;ad;d++)b=a[d+1],c+=(b[0]-f[0])*(b[1]+f[1]),f=b;return c>=0}function c(a){var c=[],d=a.slice(0),e=d.shift().slice(0);b(e)||e.reverse(),c.push(e);for(var f=0;f=0;f--){var g=e[f].slice(0);b.push(g)}return b}function e(a,b){var c=Terraformer.Tools.arrayIntersectsArray(a,b),d=Terraformer.Tools.coordinatesContainPoint(a,b[0]);return!c&&d?!0:!1}function f(a){for(var c=[],d=[],f=0;f=0;k--){var l=c[k][0];if(e(l,i)){c[k].push(i),j=!0;break}}j||c.push([i.reverse()])}return 1===c.length?{type:"Polygon",coordinates:c[0]}:{type:"MultiPolygon",coordinates:c}}function g(b){var c={};b.x&&b.y&&(c.type="Point",c.coordinates=[b.x,b.y]),b.points&&(c.type="MultiPoint",c.coordinates=b.points.slice(0)),b.paths&&(1===b.paths.length?(c.type="LineString",c.coordinates=b.paths[0].slice(0)):(c.type="MultiLineString",c.coordinates=b.paths.slice(0))),b.rings&&(c=f(b.rings.slice(0))),b.geometry&&(c.type="Feature",c.geometry=g(b.geometry),c.properties=a(b.attributes)||{});var d=b.geometry?b.geometry.spatialReference:b.spatialReference;return d&&102100===d.wkid&&(c=Terraformer.toGeographic(c)),new Terraformer.Primitive(c)}function h(b,e){var f;f=e?e:b&&b.crs===Terraformer.MercatorCRS?{wkid:102100}:{wkid:4326};var g,i={};switch(b.type){case"Point":i.x=b.coordinates[0],i.y=b.coordinates[1],i.spatialReference=f;break;case"MultiPoint":i.points=b.coordinates.slice(0),i.spatialReference=f;break;case"LineString":i.paths=[b.coordinates.slice(0)],i.spatialReference=f;break;case"MultiLineString":i.paths=b.coordinates.slice(0),i.spatialReference=f;break;case"Polygon":i.rings=c(b.coordinates.slice(0)),i.spatialReference=f;break;case"MultiPolygon":i.rings=d(b.coordinates.slice(0)),i.spatialReference=f;break;case"Feature":i.geometry=h(b.geometry),i.attributes=a(b.properties);break;case"FeatureCollection":for(i=[],g=0;g=0;){var n=k.nodes[l];if(c.Rectangle.overlap_rectangle(j,n)){if(j.target&&"leaf"in n&&n.leaf===j.target||!j.target&&("leaf"in n||c.Rectangle.contains_rectangle(n,j))){"nodes"in n?(h=m(n,!0,[],n),k.nodes.splice(l,1)):h=k.nodes.splice(l,1),c.Rectangle.make_MBR(k.nodes,k),delete j.target,k.nodes.length0&&c.Rectangle.make_MBR(k.nodes,k);for(var p=0;p0&&k.nodes.length0);return h},h=function(a,b){var d,e=-1,f=[];f.push(b);var g=b.nodes;do{-1!==e&&(f.push(g[e]),g=g[e].nodes,e=-1);for(var h=g.length-1;h>=0;h--){var i=g[h];if("leaf"in i){e=-1;break}var j=c.Rectangle.squarified_ratio(i.w,i.h,i.nodes.length+1),k=Math.max(i.x+i.w,a.x+a.w)-Math.min(i.x,a.x),l=Math.max(i.y+i.h,a.y+a.h)-Math.min(i.y,a.y),m=c.Rectangle.squarified_ratio(k,l,i.nodes.length+2);(0>e||Math.abs(m-j)0;)j(a,b[0],b[1]);return b},j=function(a,b,e){for(var f,g,h,i=c.Rectangle.squarified_ratio(b.w,b.h,b.nodes.length+1),j=c.Rectangle.squarified_ratio(e.w,e.h,e.nodes.length+1),k=a.length-1;k>=0;k--){var l=a[k],m={};m.x=Math.min(b.x,l.x),m.y=Math.min(b.y,l.y),m.w=Math.max(b.x+b.w,l.x+l.w)-m.x,m.h=Math.max(b.y+b.h,l.y+l.h)-m.y;var n=Math.abs(c.Rectangle.squarified_ratio(m.w,m.h,b.nodes.length+2)-i),o={};o.x=Math.min(e.x,l.x),o.y=Math.min(e.y,l.y),o.w=Math.max(e.x+e.w,l.x+l.w)-o.x,o.h=Math.max(e.y+e.h,l.y+l.h)-o.y;var p=Math.abs(c.Rectangle.squarified_ratio(o.w,o.h,e.nodes.length+2)-j);(!g||!f||Math.abs(p-n)p?e:b)}var q=a.splice(g,1)[0];b.nodes.length+a.length+1<=d?(b.nodes.push(q),c.Rectangle.expand_rectangle(b,q)):e.nodes.length+a.length+1<=d?(e.nodes.push(q),c.Rectangle.expand_rectangle(e,q)):(h.nodes.push(q),c.Rectangle.expand_rectangle(h,q))},k=function(a){for(var b,c,d=a.length-1,e=0,f=a.length-1,g=0,h=a.length-2;h>=0;h--){var i=a[h];i.x>a[e].x?e=h:i.x+i.wa[g].y?g=h:i.y+i.hk?d>e?(b=a.splice(d,1)[0],c=a.splice(e,1)[0]):(c=a.splice(e,1)[0],b=a.splice(d,1)[0]):f>g?(b=a.splice(f,1)[0],c=a.splice(g,1)[0]):(c=a.splice(g,1)[0],b=a.splice(f,1)[0]),[{x:b.x,y:b.y,w:b.w,h:b.h,nodes:[b]},{x:c.x,y:c.y,w:c.w,h:c.h,nodes:[c]}]},l=function(a,b){return a.nodes=b.nodes,a.x=b.x,a.y=b.y,a.w=b.w,a.h=b.h,a},m=function(a,b,d,e){var f=[];if(!c.Rectangle.overlap_rectangle(a,e))return d;f.push(e.nodes);do for(var g=f.pop(),h=g.length-1;h>=0;h--){var i=g[h];c.Rectangle.overlap_rectangle(a,i)&&("nodes"in i?f.push(i.nodes):"leaf"in i&&(b?d.push(i):d.push(i.leaf)))}while(f.length>0);return d},n=function(a,b,d,e){var f=[];if(!c.Rectangle.overlap_rectangle(e,a))return d;f.push(e.nodes);do for(var g=f.pop(),h=g.length-1;h>=0;h--){var i=g[h];c.Rectangle.overlap_rectangle(i,a)&&("nodes"in i?f.push(i.nodes):"leaf"in i&&(b?d.push(i):d.push(i.leaf)))}while(f.length>0);return d},o=function(b,d){var f;if(0===d.nodes.length)return d.x=b.x,d.y=b.y,d.w=b.w,d.h=b.h,d.nodes.push(b),void 0;var g=h(b,d),j=b;do{if(f&&"nodes"in f&&0===f.nodes.length){var k=f;f=g.pop();for(var l=0;l0)};this.serialize=function(a){a(null,f)},this.deserialize=function(a,b,c){var d=Array.prototype.slice.call(arguments);switch(d.length){case 1:b=f;break;case 2:"function"==typeof d[1]&&(b=f,c=d[1])}var e=l(b,a);c&&c(null,e)},this.search=function(a,b){var c;if(a.type){var d=Terraformer.Tools.calculateBounds(a);c={x:d[0],y:d[1],w:Math.abs(d[0]-d[2]),h:Math.abs(d[1]-d[3])}}else c=a;var e=[c,!1,[],f];if(void 0===c)throw"Wrong number of arguments. RT.Search requires at least a bounding rectangle.";var g=m.apply(this,e);b&&b(null,g)},this.within=function(a,b){var c;if(a.type){var d=Terraformer.Tools.calculateBounds(a);c={x:d[0],y:d[1],w:Math.abs(d[0]-d[2]),h:Math.abs(d[1]-d[3])}}else c=a;var e=[c,!1,[],f];if(void 0===c)throw"Wrong number of arguments. RT.Search requires at least a bounding rectangle.";var g=n.apply(this,e);b&&b(null,g)},this.remove=function(a,b,c){var d=Array.prototype.slice.call(arguments);if(1===d.length&&d.push(!1),3===d.length&&(c=d.pop()),d&&d[0]&&d[0].type){var e=Terraformer.Tools.calculateBounds(d[0]);d[0]={x:e[0],y:e[1],w:Math.abs(e[0]-e[2]),h:Math.abs(e[1]-e[3])}}if(d.push(f),b===!1){var h=0,i=[];do h=i.length,i=i.concat(g.apply(this,d));while(h!==i.length);c&&c(null,i)}else{var j=g.apply(this,d);c&&c(null,j)}},this.insert=function(a,b,c){var d;if(a.type){var e=Terraformer.Tools.calculateBounds(a);d={x:e[0],y:e[1],w:Math.abs(e[0]-e[2]),h:Math.abs(e[1]-e[3])}}else d=a;if(arguments.length<2)throw"Wrong number of arguments. RT.Insert requires at least a bounding rectangle or GeoJSON and an object.";var g=o({x:d.x,y:d.y,w:d.w,h:d.h,leaf:b},f);c&&c(null,g)}};return c.Rectangle=function(a,b,c,d){var e,f,g,h,i,j;a.x?(e=a.x,g=a.y,0!==a.w&&!a.w&&a.x2?(i=a.x2-a.x,j=a.y2-a.y):(i=a.w,j=a.h),f=e+i,h=g+j):(e=a,g=b,i=c,j=d,f=e+i,h=g+j),this.x1=this.x=function(){return e},this.y1=this.y=function(){return g},this.x2=function(){return f},this.y2=function(){return h},this.w=function(){return i},this.h=function(){return j},this.toJSON=function(){return'{"x":'+e.toString()+', "y":'+g.toString()+', "w":'+i.toString()+', "h":'+j.toString()+"}"},this.overlap=function(a){return this.x()a.x()&&this.y()a.y()},this.expand=function(a){var b=Math.min(this.x(),a.x()),c=Math.min(this.y(),a.y());return i=Math.max(this.x2(),a.x2())-b,j=Math.max(this.y2(),a.y2())-c,e=b,g=c,this},this.setRect=function(a,b,c,d){var e,f,g,h,i,j;a.x?(e=a.x,g=a.y,0!==a.w&&!a.w&&a.x2?(i=a.x2-a.x,j=a.y2-a.y):(i=a.w,j=a.h),f=e+i,h=g+j):(e=a,g=b,i=c,j=d,f=e+i,h=g+j)}},c.Rectangle.overlap_rectangle=function(a,b){return a.xb.x&&a.yb.y},c.Rectangle.contains_rectangle=function(a,b){return a.x+a.w<=b.x+b.w&&a.x>=b.x&&a.y+a.h<=b.y+b.h&&a.y>=b.y},c.Rectangle.expand_rectangle=function(a,b){var c,d;return c=a.xb.x+b.w?a.x+a.w-c:b.x+b.w-c,a.h=a.y+a.h>b.y+b.h?a.y+a.h-d:b.y+b.h-d,a.x=c,a.y=d,a},c.Rectangle.make_MBR=function(a,b){if(a.length<1)return{x:0,y:0,w:0,h:0};b?(b.x=a[0].x,b.y=a[0].y,b.w=a[0].w,b.h=a[0].h):b={x:a[0].x,y:a[0].y,w:a[0].w,h:a[0].h};for(var d=a.length-1;d>0;d--)c.Rectangle.expand_rectangle(b,a[d]);return b},b.RTree=c,b}),L.esri={_callback:{}},L.esri.Support={CORS:!!(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest)},L.esri.RequestHandlers={CORS:function(a,b,c,d){var e=new XMLHttpRequest;b.f="json",e.onreadystatechange=function(){var a;if(4===e.readyState){try{a=JSON.parse(e.responseText)}catch(b){a={error:"Could not parse response as JSON."}}d?c.call(d,a):c(a)}},e.open("GET",a+L.esri.Util.serialize(b),!0),e.send(null)},JSONP:function(a,b,c,d){var e="c"+(1e9*Math.random()).toString(36).replace(".","_");b.f="json",b.callback="L.esri._callback."+e;var f=document.createElement("script");f.type="text/javascript",f.src=a+L.esri.Util.serialize(b),f.id=e,L.esri._callback[e]=function(a){d?c.call(d,a):c(a),document.body.removeChild(f),delete L.esri._callback[e]},document.body.appendChild(f)}},L.esri.get=L.esri.Support.CORS?L.esri.RequestHandlers.CORS:L.esri.RequestHandlers.JSONP,L.esri.Util={debounce:function(a,b){var c=null;return function(){var d=this||d,e=arguments;clearTimeout(c),c=setTimeout(function(){a.apply(d,e)},b)}},roundAwayFromZero:function(a){return a>0?Math.ceil(a):Math.floor(a)},trim:function(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},cleanUrl:function(a){return a=L.esri.Util.trim(a),"/"!==a[a.length-1]&&(a+="/"),a},serialize:function(a){var b="?";for(var c in a)if(a.hasOwnProperty(c)){var d=c,e=a[c];b+=encodeURIComponent(d),b+="=",b+=encodeURIComponent(e),b+="&"}return b.substring(0,b.length-1)},indexOf:function(a,b,c){if(c=c||0,a.indexOf)return a.indexOf(b,c);for(var d=c,e=a.length;e>d;d++)if(a[d]===b)return d;return-1},extentToBounds:function(a){var b=new L.LatLng(a.ymin,a.xmin),c=new L.LatLng(a.ymax,a.xmax);return new L.LatLngBounds(b,c)},boundsToExtent:function(a){return{xmin:a.getSouthWest().lng,ymin:a.getSouthWest().lat,xmax:a.getNorthEast().lng,ymax:a.getNorthEast().lat,spatialReference:{wkid:4326}}},boundsToEnvelope:function(a){var b=L.esri.Util.boundsToExtent(a);return{x:b.xmin,y:b.ymin,w:Math.abs(b.xmin-b.xmax),h:Math.abs(b.ymin-b.ymax)}}},L.esri.Mixins={},L.esri.Mixins.featureGrid={_activeRequests:0,_initializeFeatureGrid:function(a){this._map=a,this._previousCells=[],this.center=this._map.getCenter(),this.origin=this._map.project(this.center),this._moveHandler=L.esri.Util.debounce(function(a){"zoomend"===a.type&&(this.origin=this._map.project(this.center),this._previousCells=[]),this._requestFeatures(a.target.getBounds())},this.options.debounce,this),a.on("zoomend resize move",this._moveHandler,this),this._requestFeatures(a.getBounds())},_destroyFeatureGrid:function(a){a.off("zoomend resize move",this._moveHandler,this)},_requestFeatures:function(a){var b=this._cellsWithin(a);b&&this.fire("loading",{bounds:a});for(var c=0;cp;p++)for(var q=n;o>q;q++){var r="cell:"+p+":"+q,s=L.esri.Util.indexOf(this._previousCells,r)>=0;if(!s||!this.options.deduplicate){var t=this._cellExtent(p,q),u=t.getCenter(),v=u.distanceTo(t.getNorthWest()),w=u.distanceTo(this.center),x={row:p,col:q,id:r,center:u,bounds:t,distance:w,radius:v};e.push(x),this._previousCells.push(r)}}return e.sort(function(a,b){return a.distance-b.distance}),e},_cellExtent:function(a,b){var c=this._cellPoint(a,b),d=this._cellPoint(a+1,b+1),e=this._map.unproject(c),f=this._map.unproject(d);return L.latLngBounds(e,f)},_cellPoint:function(a,b){var c=this.origin.x+a*this.options.cellSize,d=this.origin.y+b*this.options.cellSize;return[c,d]}},L.esri.Mixins.identifiableLayer={identify:function(a,b,c){var d={sr:"4265",mapExtent:JSON.stringify(L.esri.Util.boundsToExtent(this._map.getBounds())),tolerance:5,geometryType:"esriGeometryPoint",imageDisplay:this._map._size.x+","+this._map._size.y+",96",geometry:JSON.stringify({x:a.lng,y:a.lat,spatialReference:{wkid:4265}})}; -this.options.layers&&(d.layers=this.options.layers);var e;"function"==typeof b&&"undefined"==typeof c?(c=b,e=d):"object"==typeof b&&(b.layerDefs&&(b.layerDefs=this.parseLayerDefs(b.layerDefs)),e=L.Util.extend(d,b)),L.esri.get(this.serviceUrl+"/identify",e,c)},parseLayerDefs:function(a){return a instanceof Array?"":"object"==typeof a?JSON.stringify(a):a}},function(a){var b="https:"!==window.location.protocol?"http:":"https:",c="line-height:9px; text-overflow:ellipsis; white-space:nowrap;overflow:hidden; display:inline-block;",d="position:absolute; top:-38px; right:2px;",e="",f=function(a){return""+a+""};a.esri.BasemapLayer=a.TileLayer.extend({statics:{TILES:{Streets:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}/",attributionUrl:"https://static.arcgis.com/attribution/World_Street_Map",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:f("Esri")+e}},Topographic:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}/",attributionUrl:"https://static.arcgis.com/attribution/World_Topo_Map",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:f("Esri")+e}},Oceans:{urlTemplate:"https://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/tile/{z}/{y}/{x}/",attributionUrl:"https://static.arcgis.com/attribution/Ocean_Basemap",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:f("Esri")+e}},NationalGeographic:{urlTemplate:"https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:f("Esri")+e}},Gray:{urlTemplate:b+"//{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:f("Esri, NAVTEQ, DeLorme")+e}},GrayLabels:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:16,subdomains:["server","services"]}},Imagery:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:f("Esri, DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community")+e}},ImageryLabels:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:19,subdomains:["server","services"]}},ImageryTransportation:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:19,subdomains:["server","services"]}},ShadedRelief:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:13,subdomains:["server","services"],attribution:f("ESRI, NAVTEQ, DeLorme")+e}},ShadedReliefLabels:{urlTemplate:b+"//{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"]}}}},initialize:function(b,c){var d;if("object"==typeof b&&b.urlTemplate&&b.options)d=b;else{if("string"!=typeof b||!a.esri.BasemapLayer.TILES[b])throw new Error("L.esri.BasemapLayer: Invalid parameter. Use one of 'Streets', 'Topographic', 'Oceans', 'NationalGeographic', 'Gray', 'GrayLabels', 'Imagery', 'ImageryLabels', 'ImageryTransportation', 'ImageryAlternateLabels' or 'ShadedRelief'");d=a.esri.BasemapLayer.TILES[b]}var e=a.Util.extend(d.options,c),f=a.esri.Util.cleanUrl(d.urlTemplate);if(a.TileLayer.prototype.initialize.call(this,f,a.Util.setOptions(this,e)),d.attributionUrl){var g=d.attributionUrl;this._dynamicAttribution=!0,this._getAttributionData(g)}},_dynamicAttribution:!1,bounds:null,zoom:null,onAdd:function(b){a.TileLayer.prototype.onAdd.call(this,b),this._dynamicAttribution&&(this.on("load",this._handleTileUpdates,this),this._map.on("viewreset zoomend dragend",this._handleTileUpdates,this)),this._map.on("resize",this._resizeAttribution,this)},onRemove:function(b){this._dynamicAttribution&&(this.off("load",this._handleTileUpdates,this),this._map.off("viewreset zoomend dragend",this._handleTileUpdates,this)),this._map.off("resize",this._resizeAttribution,this),a.TileLayer.prototype.onRemove.call(this,b)},_handleTileUpdates:function(a){var b,c;"load"===a.type&&(b=this._map.getBounds(),c=this._map.getZoom()),("viewreset"===a.type||"dragend"===a.type||"zoomend"===a.type)&&(b=a.target.getBounds(),c=a.target.getZoom()),this.attributionBoundingBoxes&&b&&c&&(b.equals(this.bounds)&&c===this.zoom||(this.bounds=b,this.zoom=c,this._updateMapAttribution()))},_resizeAttribution:function(){var a=this._map.getSize().x;this._getAttributionLogo().style.display=600>a?"none":"block",this._getAttributionSpan().style.maxWidth=.75*a+"px"},_getAttributionData:function(b){this.attributionBoundingBoxes=[],a.esri.RequestHandlers.JSONP(b,{},this._processAttributionData,this)},_processAttributionData:function(b){for(var c=0;cb.score?1:0}),this.bounds&&this._updateMapAttribution()},_getAttributionSpan:function(){return this._map._container.querySelectorAll(".esri-attributions")[0]},_getAttributionLogo:function(){return this._map._container.querySelectorAll(".esri-attribution-logo")[0]},_updateMapAttribution:function(){for(var a="",b=0;b=c.minZoom&&this.zoom<=c.maxZoom){var d=this.attributionBoundingBoxes[b].attribution;-1===a.indexOf(d)&&(a.length>0&&(a+=", "),a+=d)}}this._getAttributionSpan().innerHTML=a,this._resizeAttribution()}}),a.esri.basemapLayer=function(b,c){return new a.esri.BasemapLayer(b,c)}}(L),function(a){function b(a,b){var c=b?"block":"none";if(a._icon&&(a._icon.style.display=c),a._shadow&&(a._shadow.style.display=c),a._layers)for(var d in a._layers)a._layers.hasOwnProperty(d)&&(a._layers[d]._container.style.display=c)}a.esri.FeatureLayer=a.GeoJSON.extend({includes:a.esri.Mixins.featureGrid,options:{cellSize:512,debounce:100,deduplicate:!0},initialize:function(b,c){this.index=new Terraformer.RTree,this.url=a.esri.Util.cleanUrl(b),a.Util.setOptions(this,c),a.esri.get(this.url,{},function(a){this.fire("metadata",{metadata:a})},this),a.GeoJSON.prototype.initialize.call(this,[],c)},onAdd:function(b){a.LayerGroup.prototype.onAdd.call(this,b),b.on("zoomend resize moveEnd",this._update,this),this._initializeFeatureGrid(b)},onRemove:function(b){b.off("zoomend resize moveEnd",this._update,this),a.LayerGroup.prototype.onRemove.call(this,b),this._destroyFeatureGrid(b)},getLayerId:function(a){return a.feature.id},_update:function(c){var d=a.esri.Util.boundsToEnvelope(c.target.getBounds());this.index.search(d,a.Util.bind(function(c,d){this.eachLayer(a.Util.bind(function(c){var e=c.feature.id;b(c,a.esri.Util.indexOf(d,e)>=0)},this))},this))},_render:function(a){if(a.objectIdFieldName&&a.features.length&&!a.error)for(var b=a.objectIdFieldName,c=a.features.length-1;c>=0;c--){var d=a.features[c],e=d.attributes[b];if(!this._layers[e]){var f=Terraformer.ArcGIS.parse(d);f.id=e,this.index.insert(f,f.id),this.addData(f)}}}}),a.esri.featureLayer=function(b,c){return new a.esri.FeatureLayer(b,c)}}(L),L.esri.TiledMapLayer=L.TileLayer.extend({includes:L.esri.Mixins.identifiableLayer,initialize:function(a,b){b=b||{},this.serviceUrl=L.esri.Util.cleanUrl(a),this.tileUrl=L.esri.Util.cleanUrl(a)+"tile/{z}/{y}/{x}",this.tileUrl.match("://tiles.arcgis.com")&&(this.tileUrl=this.tileUrl.replace("://tiles.arcgis.com","://tiles{s}.arcgis.com"),b.subdomains=["1","2","3","4"]),L.esri.get(this._url,{},function(a){this.fire("metadata",{metadata:a})},this),L.TileLayer.prototype.initialize.call(this,this.tileUrl,b)}}),L.esri.tiledMapLayer=function(a,b){return new L.esri.TiledMapLayer(a,b)},/*! +this.options.layers&&(d.layers=this.options.layers);var e;"function"==typeof b&&"undefined"==typeof c?(c=b,e=d):"object"==typeof b&&(b.layerDefs&&(b.layerDefs=this.parseLayerDefs(b.layerDefs)),e=L.Util.extend(d,b)),L.esri.get(this.serviceUrl+"/identify",e,c)},parseLayerDefs:function(a){return a instanceof Array?"":"object"==typeof a?JSON.stringify(a):a}},function(a){var b="https:"!==window.location.protocol?"http:":"https:",c="line-height:9px; text-overflow:ellipsis; white-space:nowrap;overflow:hidden; display:inline-block;",d="position:absolute; top:-38px; right:2px;",e="",f=function(a){return""+a+""};a.esri.BasemapLayer=a.TileLayer.extend({statics:{TILES:{Streets:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}/",attributionUrl:"https://static.arcgis.com/attribution/World_Street_Map",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:f("Esri")+e}},Topographic:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}/",attributionUrl:"https://static.arcgis.com/attribution/World_Topo_Map",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:f("Esri")+e}},Oceans:{urlTemplate:"https://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/tile/{z}/{y}/{x}/",attributionUrl:"https://static.arcgis.com/attribution/Ocean_Basemap",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:f("Esri")+e}},NationalGeographic:{urlTemplate:"https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:f("Esri")+e}},Gray:{urlTemplate:b+"//{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:f("Esri, NAVTEQ, DeLorme")+e}},GrayLabels:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:16,subdomains:["server","services"]}},Imagery:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:f("Esri, DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community")+e}},ImageryLabels:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:19,subdomains:["server","services"]}},ImageryTransportation:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:19,subdomains:["server","services"]}},ShadedRelief:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:13,subdomains:["server","services"],attribution:f("ESRI, NAVTEQ, DeLorme")+e}},ShadedReliefLabels:{urlTemplate:b+"//{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"]}}}},initialize:function(b,c){var d;if("object"==typeof b&&b.urlTemplate&&b.options)d=b;else{if("string"!=typeof b||!a.esri.BasemapLayer.TILES[b])throw new Error("L.esri.BasemapLayer: Invalid parameter. Use one of 'Streets', 'Topographic', 'Oceans', 'NationalGeographic', 'Gray', 'GrayLabels', 'Imagery', 'ImageryLabels', 'ImageryTransportation', 'ShadedRelief' or 'ShadedReliefLabels'");d=a.esri.BasemapLayer.TILES[b]}var e=a.Util.extend(d.options,c),f=a.esri.Util.cleanUrl(d.urlTemplate);if(a.TileLayer.prototype.initialize.call(this,f,a.Util.setOptions(this,e)),d.attributionUrl){var g=d.attributionUrl;this._dynamicAttribution=!0,this._getAttributionData(g)}},_dynamicAttribution:!1,bounds:null,zoom:null,onAdd:function(b){a.TileLayer.prototype.onAdd.call(this,b),this._dynamicAttribution&&(this.on("load",this._handleTileUpdates,this),this._map.on("viewreset zoomend dragend",this._handleTileUpdates,this)),this._map.on("resize",this._resizeAttribution,this)},onRemove:function(b){this._dynamicAttribution&&(this.off("load",this._handleTileUpdates,this),this._map.off("viewreset zoomend dragend",this._handleTileUpdates,this)),this._map.off("resize",this._resizeAttribution,this),a.TileLayer.prototype.onRemove.call(this,b)},_handleTileUpdates:function(a){var b,c;"load"===a.type&&(b=this._map.getBounds(),c=this._map.getZoom()),("viewreset"===a.type||"dragend"===a.type||"zoomend"===a.type)&&(b=a.target.getBounds(),c=a.target.getZoom()),this.attributionBoundingBoxes&&b&&c&&(b.equals(this.bounds)&&c===this.zoom||(this.bounds=b,this.zoom=c,this._updateMapAttribution()))},_resizeAttribution:function(){var a=this._map.getSize().x;this._getAttributionLogo().style.display=600>a?"none":"block",this._getAttributionSpan().style.maxWidth=.75*a+"px"},_getAttributionData:function(b){this.attributionBoundingBoxes=[],a.esri.RequestHandlers.JSONP(b,{},this._processAttributionData,this)},_processAttributionData:function(b){for(var c=0;cb.score?1:0}),this.bounds&&this._updateMapAttribution()},_getAttributionSpan:function(){return this._map._container.querySelectorAll(".esri-attributions")[0]},_getAttributionLogo:function(){return this._map._container.querySelectorAll(".esri-attribution-logo")[0]},_updateMapAttribution:function(){for(var a="",b=0;b=c.minZoom&&this.zoom<=c.maxZoom){var d=this.attributionBoundingBoxes[b].attribution;-1===a.indexOf(d)&&(a.length>0&&(a+=", "),a+=d)}}this._getAttributionSpan().innerHTML=a,this._resizeAttribution()}}),a.esri.basemapLayer=function(b,c){return new a.esri.BasemapLayer(b,c)}}(L),function(a){function b(a,b){var c=b?"block":"none";if(a._icon&&(a._icon.style.display=c),a._shadow&&(a._shadow.style.display=c),a._layers)for(var d in a._layers)a._layers.hasOwnProperty(d)&&(a._layers[d]._container.style.display=c)}a.esri.FeatureLayer=a.GeoJSON.extend({includes:a.esri.Mixins.featureGrid,options:{cellSize:512,debounce:100,deduplicate:!0},initialize:function(b,c){this.index=new Terraformer.RTree,this.url=a.esri.Util.cleanUrl(b),a.Util.setOptions(this,c),a.esri.get(this.url,{},function(a){this.fire("metadata",{metadata:a})},this),a.GeoJSON.prototype.initialize.call(this,[],c)},onAdd:function(b){a.LayerGroup.prototype.onAdd.call(this,b),b.on("zoomend resize moveEnd",this._update,this),this._initializeFeatureGrid(b)},onRemove:function(b){b.off("zoomend resize moveEnd",this._update,this),a.LayerGroup.prototype.onRemove.call(this,b),this._destroyFeatureGrid(b)},getLayerId:function(a){return a.feature.id},_update:function(c){var d=a.esri.Util.boundsToEnvelope(c.target.getBounds());this.index.search(d,a.Util.bind(function(c,d){this.eachLayer(a.Util.bind(function(c){var e=c.feature.id;b(c,a.esri.Util.indexOf(d,e)>=0)},this))},this))},_render:function(a){if(a.objectIdFieldName&&a.features.length&&!a.error)for(var b=a.objectIdFieldName,c=a.features.length-1;c>=0;c--){var d=a.features[c],e=d.attributes[b];if(!this._layers[e]){var f=Terraformer.ArcGIS.parse(d);f.id=e,this.index.insert(f,f.id),this.addData(f)}}}}),a.esri.featureLayer=function(b,c){return new a.esri.FeatureLayer(b,c)}}(L),L.esri.TiledMapLayer=L.TileLayer.extend({includes:L.esri.Mixins.identifiableLayer,initialize:function(a,b){b=b||{},this.serviceUrl=L.esri.Util.cleanUrl(a),this.tileUrl=L.esri.Util.cleanUrl(a)+"tile/{z}/{y}/{x}",this.tileUrl.match("://tiles.arcgis.com")&&(this.tileUrl=this.tileUrl.replace("://tiles.arcgis.com","://tiles{s}.arcgis.com"),b.subdomains=["1","2","3","4"]),L.esri.get(this._url,{},function(a){this.fire("metadata",{metadata:a})},this),L.TileLayer.prototype.initialize.call(this,this.tileUrl,b)}}),L.esri.tiledMapLayer=function(a,b){return new L.esri.TiledMapLayer(a,b)},/*! * The MIT License (MIT) * * Copyright (c) 2013 Sanborn Map Company, Inc. diff --git a/dist/extras/esri-basemaps-src.js b/dist/extras/esri-basemaps-src.js index 19510546f..323daeaf8 100644 --- a/dist/extras/esri-basemaps-src.js +++ b/dist/extras/esri-basemaps-src.js @@ -464,7 +464,7 @@ L.esri.Mixins.identifiableLayer = { } else if(typeof key === "string" && L.esri.BasemapLayer.TILES[key]){ config = L.esri.BasemapLayer.TILES[key]; } else { - throw new Error("L.esri.BasemapLayer: Invalid parameter. Use one of 'Streets', 'Topographic', 'Oceans', 'NationalGeographic', 'Gray', 'GrayLabels', 'Imagery', 'ImageryLabels', 'ImageryTransportation', 'ImageryAlternateLabels' or 'ShadedRelief'"); + throw new Error("L.esri.BasemapLayer: Invalid parameter. Use one of 'Streets', 'Topographic', 'Oceans', 'NationalGeographic', 'Gray', 'GrayLabels', 'Imagery', 'ImageryLabels', 'ImageryTransportation', 'ShadedRelief' or 'ShadedReliefLabels'"); } // merge passed options into the config options diff --git a/dist/extras/esri-basemaps.js b/dist/extras/esri-basemaps.js index 113d23cba..f70de3fc6 100644 --- a/dist/extras/esri-basemaps.js +++ b/dist/extras/esri-basemaps.js @@ -1,4 +1,4 @@ /*! Esri-Leaflet - v0.0.1 - 2013-11-07 * Copyright (c) 2013 Environmental Systems Research Institute, Inc. * Apache License*/ -L.esri={_callback:{}},L.esri.Support={CORS:!!(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest)},L.esri.RequestHandlers={CORS:function(a,b,c,d){var e=new XMLHttpRequest;b.f="json",e.onreadystatechange=function(){var a;if(4===e.readyState){try{a=JSON.parse(e.responseText)}catch(b){a={error:"Could not parse response as JSON."}}d?c.call(d,a):c(a)}},e.open("GET",a+L.esri.Util.serialize(b),!0),e.send(null)},JSONP:function(a,b,c,d){var e="c"+(1e9*Math.random()).toString(36).replace(".","_");b.f="json",b.callback="L.esri._callback."+e;var f=document.createElement("script");f.type="text/javascript",f.src=a+L.esri.Util.serialize(b),f.id=e,L.esri._callback[e]=function(a){d?c.call(d,a):c(a),document.body.removeChild(f),delete L.esri._callback[e]},document.body.appendChild(f)}},L.esri.get=L.esri.Support.CORS?L.esri.RequestHandlers.CORS:L.esri.RequestHandlers.JSONP,L.esri.Util={debounce:function(a,b){var c=null;return function(){var d=this||d,e=arguments;clearTimeout(c),c=setTimeout(function(){a.apply(d,e)},b)}},roundAwayFromZero:function(a){return a>0?Math.ceil(a):Math.floor(a)},trim:function(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},cleanUrl:function(a){return a=L.esri.Util.trim(a),"/"!==a[a.length-1]&&(a+="/"),a},serialize:function(a){var b="?";for(var c in a)if(a.hasOwnProperty(c)){var d=c,e=a[c];b+=encodeURIComponent(d),b+="=",b+=encodeURIComponent(e),b+="&"}return b.substring(0,b.length-1)},indexOf:function(a,b,c){if(c=c||0,a.indexOf)return a.indexOf(b,c);for(var d=c,e=a.length;e>d;d++)if(a[d]===b)return d;return-1},extentToBounds:function(a){var b=new L.LatLng(a.ymin,a.xmin),c=new L.LatLng(a.ymax,a.xmax);return new L.LatLngBounds(b,c)},boundsToExtent:function(a){return{xmin:a.getSouthWest().lng,ymin:a.getSouthWest().lat,xmax:a.getNorthEast().lng,ymax:a.getNorthEast().lat,spatialReference:{wkid:4326}}},boundsToEnvelope:function(a){var b=L.esri.Util.boundsToExtent(a);return{x:b.xmin,y:b.ymin,w:Math.abs(b.xmin-b.xmax),h:Math.abs(b.ymin-b.ymax)}}},L.esri.Mixins={},L.esri.Mixins.featureGrid={_activeRequests:0,_initializeFeatureGrid:function(a){this._map=a,this._previousCells=[],this.center=this._map.getCenter(),this.origin=this._map.project(this.center),this._moveHandler=L.esri.Util.debounce(function(a){"zoomend"===a.type&&(this.origin=this._map.project(this.center),this._previousCells=[]),this._requestFeatures(a.target.getBounds())},this.options.debounce,this),a.on("zoomend resize move",this._moveHandler,this),this._requestFeatures(a.getBounds())},_destroyFeatureGrid:function(a){a.off("zoomend resize move",this._moveHandler,this)},_requestFeatures:function(a){var b=this._cellsWithin(a);b&&this.fire("loading",{bounds:a});for(var c=0;cp;p++)for(var q=n;o>q;q++){var r="cell:"+p+":"+q,s=L.esri.Util.indexOf(this._previousCells,r)>=0;if(!s||!this.options.deduplicate){var t=this._cellExtent(p,q),u=t.getCenter(),v=u.distanceTo(t.getNorthWest()),w=u.distanceTo(this.center),x={row:p,col:q,id:r,center:u,bounds:t,distance:w,radius:v};e.push(x),this._previousCells.push(r)}}return e.sort(function(a,b){return a.distance-b.distance}),e},_cellExtent:function(a,b){var c=this._cellPoint(a,b),d=this._cellPoint(a+1,b+1),e=this._map.unproject(c),f=this._map.unproject(d);return L.latLngBounds(e,f)},_cellPoint:function(a,b){var c=this.origin.x+a*this.options.cellSize,d=this.origin.y+b*this.options.cellSize;return[c,d]}},L.esri.Mixins.identifiableLayer={identify:function(a,b,c){var d={sr:"4265",mapExtent:JSON.stringify(L.esri.Util.boundsToExtent(this._map.getBounds())),tolerance:5,geometryType:"esriGeometryPoint",imageDisplay:this._map._size.x+","+this._map._size.y+",96",geometry:JSON.stringify({x:a.lng,y:a.lat,spatialReference:{wkid:4265}})};this.options.layers&&(d.layers=this.options.layers);var e;"function"==typeof b&&"undefined"==typeof c?(c=b,e=d):"object"==typeof b&&(b.layerDefs&&(b.layerDefs=this.parseLayerDefs(b.layerDefs)),e=L.Util.extend(d,b)),L.esri.get(this.serviceUrl+"/identify",e,c)},parseLayerDefs:function(a){return a instanceof Array?"":"object"==typeof a?JSON.stringify(a):a}},function(a){var b="https:"!==window.location.protocol?"http:":"https:",c="line-height:9px; text-overflow:ellipsis; white-space:nowrap;overflow:hidden; display:inline-block;",d="position:absolute; top:-38px; right:2px;",e="",f=function(a){return""+a+""};a.esri.BasemapLayer=a.TileLayer.extend({statics:{TILES:{Streets:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}/",attributionUrl:"https://static.arcgis.com/attribution/World_Street_Map",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:f("Esri")+e}},Topographic:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}/",attributionUrl:"https://static.arcgis.com/attribution/World_Topo_Map",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:f("Esri")+e}},Oceans:{urlTemplate:"https://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/tile/{z}/{y}/{x}/",attributionUrl:"https://static.arcgis.com/attribution/Ocean_Basemap",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:f("Esri")+e}},NationalGeographic:{urlTemplate:"https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:f("Esri")+e}},Gray:{urlTemplate:b+"//{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:f("Esri, NAVTEQ, DeLorme")+e}},GrayLabels:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:16,subdomains:["server","services"]}},Imagery:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:f("Esri, DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community")+e}},ImageryLabels:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:19,subdomains:["server","services"]}},ImageryTransportation:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:19,subdomains:["server","services"]}},ShadedRelief:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:13,subdomains:["server","services"],attribution:f("ESRI, NAVTEQ, DeLorme")+e}},ShadedReliefLabels:{urlTemplate:b+"//{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"]}}}},initialize:function(b,c){var d;if("object"==typeof b&&b.urlTemplate&&b.options)d=b;else{if("string"!=typeof b||!a.esri.BasemapLayer.TILES[b])throw new Error("L.esri.BasemapLayer: Invalid parameter. Use one of 'Streets', 'Topographic', 'Oceans', 'NationalGeographic', 'Gray', 'GrayLabels', 'Imagery', 'ImageryLabels', 'ImageryTransportation', 'ImageryAlternateLabels' or 'ShadedRelief'");d=a.esri.BasemapLayer.TILES[b]}var e=a.Util.extend(d.options,c),f=a.esri.Util.cleanUrl(d.urlTemplate);if(a.TileLayer.prototype.initialize.call(this,f,a.Util.setOptions(this,e)),d.attributionUrl){var g=d.attributionUrl;this._dynamicAttribution=!0,this._getAttributionData(g)}},_dynamicAttribution:!1,bounds:null,zoom:null,onAdd:function(b){a.TileLayer.prototype.onAdd.call(this,b),this._dynamicAttribution&&(this.on("load",this._handleTileUpdates,this),this._map.on("viewreset zoomend dragend",this._handleTileUpdates,this)),this._map.on("resize",this._resizeAttribution,this)},onRemove:function(b){this._dynamicAttribution&&(this.off("load",this._handleTileUpdates,this),this._map.off("viewreset zoomend dragend",this._handleTileUpdates,this)),this._map.off("resize",this._resizeAttribution,this),a.TileLayer.prototype.onRemove.call(this,b)},_handleTileUpdates:function(a){var b,c;"load"===a.type&&(b=this._map.getBounds(),c=this._map.getZoom()),("viewreset"===a.type||"dragend"===a.type||"zoomend"===a.type)&&(b=a.target.getBounds(),c=a.target.getZoom()),this.attributionBoundingBoxes&&b&&c&&(b.equals(this.bounds)&&c===this.zoom||(this.bounds=b,this.zoom=c,this._updateMapAttribution()))},_resizeAttribution:function(){var a=this._map.getSize().x;this._getAttributionLogo().style.display=600>a?"none":"block",this._getAttributionSpan().style.maxWidth=.75*a+"px"},_getAttributionData:function(b){this.attributionBoundingBoxes=[],a.esri.RequestHandlers.JSONP(b,{},this._processAttributionData,this)},_processAttributionData:function(b){for(var c=0;cb.score?1:0}),this.bounds&&this._updateMapAttribution()},_getAttributionSpan:function(){return this._map._container.querySelectorAll(".esri-attributions")[0]},_getAttributionLogo:function(){return this._map._container.querySelectorAll(".esri-attribution-logo")[0]},_updateMapAttribution:function(){for(var a="",b=0;b=c.minZoom&&this.zoom<=c.maxZoom){var d=this.attributionBoundingBoxes[b].attribution;-1===a.indexOf(d)&&(a.length>0&&(a+=", "),a+=d)}}this._getAttributionSpan().innerHTML=a,this._resizeAttribution()}}),a.esri.basemapLayer=function(b,c){return new a.esri.BasemapLayer(b,c)}}(L); \ No newline at end of file +L.esri={_callback:{}},L.esri.Support={CORS:!!(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest)},L.esri.RequestHandlers={CORS:function(a,b,c,d){var e=new XMLHttpRequest;b.f="json",e.onreadystatechange=function(){var a;if(4===e.readyState){try{a=JSON.parse(e.responseText)}catch(b){a={error:"Could not parse response as JSON."}}d?c.call(d,a):c(a)}},e.open("GET",a+L.esri.Util.serialize(b),!0),e.send(null)},JSONP:function(a,b,c,d){var e="c"+(1e9*Math.random()).toString(36).replace(".","_");b.f="json",b.callback="L.esri._callback."+e;var f=document.createElement("script");f.type="text/javascript",f.src=a+L.esri.Util.serialize(b),f.id=e,L.esri._callback[e]=function(a){d?c.call(d,a):c(a),document.body.removeChild(f),delete L.esri._callback[e]},document.body.appendChild(f)}},L.esri.get=L.esri.Support.CORS?L.esri.RequestHandlers.CORS:L.esri.RequestHandlers.JSONP,L.esri.Util={debounce:function(a,b){var c=null;return function(){var d=this||d,e=arguments;clearTimeout(c),c=setTimeout(function(){a.apply(d,e)},b)}},roundAwayFromZero:function(a){return a>0?Math.ceil(a):Math.floor(a)},trim:function(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},cleanUrl:function(a){return a=L.esri.Util.trim(a),"/"!==a[a.length-1]&&(a+="/"),a},serialize:function(a){var b="?";for(var c in a)if(a.hasOwnProperty(c)){var d=c,e=a[c];b+=encodeURIComponent(d),b+="=",b+=encodeURIComponent(e),b+="&"}return b.substring(0,b.length-1)},indexOf:function(a,b,c){if(c=c||0,a.indexOf)return a.indexOf(b,c);for(var d=c,e=a.length;e>d;d++)if(a[d]===b)return d;return-1},extentToBounds:function(a){var b=new L.LatLng(a.ymin,a.xmin),c=new L.LatLng(a.ymax,a.xmax);return new L.LatLngBounds(b,c)},boundsToExtent:function(a){return{xmin:a.getSouthWest().lng,ymin:a.getSouthWest().lat,xmax:a.getNorthEast().lng,ymax:a.getNorthEast().lat,spatialReference:{wkid:4326}}},boundsToEnvelope:function(a){var b=L.esri.Util.boundsToExtent(a);return{x:b.xmin,y:b.ymin,w:Math.abs(b.xmin-b.xmax),h:Math.abs(b.ymin-b.ymax)}}},L.esri.Mixins={},L.esri.Mixins.featureGrid={_activeRequests:0,_initializeFeatureGrid:function(a){this._map=a,this._previousCells=[],this.center=this._map.getCenter(),this.origin=this._map.project(this.center),this._moveHandler=L.esri.Util.debounce(function(a){"zoomend"===a.type&&(this.origin=this._map.project(this.center),this._previousCells=[]),this._requestFeatures(a.target.getBounds())},this.options.debounce,this),a.on("zoomend resize move",this._moveHandler,this),this._requestFeatures(a.getBounds())},_destroyFeatureGrid:function(a){a.off("zoomend resize move",this._moveHandler,this)},_requestFeatures:function(a){var b=this._cellsWithin(a);b&&this.fire("loading",{bounds:a});for(var c=0;cp;p++)for(var q=n;o>q;q++){var r="cell:"+p+":"+q,s=L.esri.Util.indexOf(this._previousCells,r)>=0;if(!s||!this.options.deduplicate){var t=this._cellExtent(p,q),u=t.getCenter(),v=u.distanceTo(t.getNorthWest()),w=u.distanceTo(this.center),x={row:p,col:q,id:r,center:u,bounds:t,distance:w,radius:v};e.push(x),this._previousCells.push(r)}}return e.sort(function(a,b){return a.distance-b.distance}),e},_cellExtent:function(a,b){var c=this._cellPoint(a,b),d=this._cellPoint(a+1,b+1),e=this._map.unproject(c),f=this._map.unproject(d);return L.latLngBounds(e,f)},_cellPoint:function(a,b){var c=this.origin.x+a*this.options.cellSize,d=this.origin.y+b*this.options.cellSize;return[c,d]}},L.esri.Mixins.identifiableLayer={identify:function(a,b,c){var d={sr:"4265",mapExtent:JSON.stringify(L.esri.Util.boundsToExtent(this._map.getBounds())),tolerance:5,geometryType:"esriGeometryPoint",imageDisplay:this._map._size.x+","+this._map._size.y+",96",geometry:JSON.stringify({x:a.lng,y:a.lat,spatialReference:{wkid:4265}})};this.options.layers&&(d.layers=this.options.layers);var e;"function"==typeof b&&"undefined"==typeof c?(c=b,e=d):"object"==typeof b&&(b.layerDefs&&(b.layerDefs=this.parseLayerDefs(b.layerDefs)),e=L.Util.extend(d,b)),L.esri.get(this.serviceUrl+"/identify",e,c)},parseLayerDefs:function(a){return a instanceof Array?"":"object"==typeof a?JSON.stringify(a):a}},function(a){var b="https:"!==window.location.protocol?"http:":"https:",c="line-height:9px; text-overflow:ellipsis; white-space:nowrap;overflow:hidden; display:inline-block;",d="position:absolute; top:-38px; right:2px;",e="",f=function(a){return""+a+""};a.esri.BasemapLayer=a.TileLayer.extend({statics:{TILES:{Streets:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}/",attributionUrl:"https://static.arcgis.com/attribution/World_Street_Map",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:f("Esri")+e}},Topographic:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}/",attributionUrl:"https://static.arcgis.com/attribution/World_Topo_Map",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:f("Esri")+e}},Oceans:{urlTemplate:"https://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/tile/{z}/{y}/{x}/",attributionUrl:"https://static.arcgis.com/attribution/Ocean_Basemap",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:f("Esri")+e}},NationalGeographic:{urlTemplate:"https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:f("Esri")+e}},Gray:{urlTemplate:b+"//{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:f("Esri, NAVTEQ, DeLorme")+e}},GrayLabels:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:16,subdomains:["server","services"]}},Imagery:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:f("Esri, DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community")+e}},ImageryLabels:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:19,subdomains:["server","services"]}},ImageryTransportation:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:19,subdomains:["server","services"]}},ShadedRelief:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}/",options:{minZoom:1,maxZoom:13,subdomains:["server","services"],attribution:f("ESRI, NAVTEQ, DeLorme")+e}},ShadedReliefLabels:{urlTemplate:b+"//{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"]}}}},initialize:function(b,c){var d;if("object"==typeof b&&b.urlTemplate&&b.options)d=b;else{if("string"!=typeof b||!a.esri.BasemapLayer.TILES[b])throw new Error("L.esri.BasemapLayer: Invalid parameter. Use one of 'Streets', 'Topographic', 'Oceans', 'NationalGeographic', 'Gray', 'GrayLabels', 'Imagery', 'ImageryLabels', 'ImageryTransportation', 'ShadedRelief' or 'ShadedReliefLabels'");d=a.esri.BasemapLayer.TILES[b]}var e=a.Util.extend(d.options,c),f=a.esri.Util.cleanUrl(d.urlTemplate);if(a.TileLayer.prototype.initialize.call(this,f,a.Util.setOptions(this,e)),d.attributionUrl){var g=d.attributionUrl;this._dynamicAttribution=!0,this._getAttributionData(g)}},_dynamicAttribution:!1,bounds:null,zoom:null,onAdd:function(b){a.TileLayer.prototype.onAdd.call(this,b),this._dynamicAttribution&&(this.on("load",this._handleTileUpdates,this),this._map.on("viewreset zoomend dragend",this._handleTileUpdates,this)),this._map.on("resize",this._resizeAttribution,this)},onRemove:function(b){this._dynamicAttribution&&(this.off("load",this._handleTileUpdates,this),this._map.off("viewreset zoomend dragend",this._handleTileUpdates,this)),this._map.off("resize",this._resizeAttribution,this),a.TileLayer.prototype.onRemove.call(this,b)},_handleTileUpdates:function(a){var b,c;"load"===a.type&&(b=this._map.getBounds(),c=this._map.getZoom()),("viewreset"===a.type||"dragend"===a.type||"zoomend"===a.type)&&(b=a.target.getBounds(),c=a.target.getZoom()),this.attributionBoundingBoxes&&b&&c&&(b.equals(this.bounds)&&c===this.zoom||(this.bounds=b,this.zoom=c,this._updateMapAttribution()))},_resizeAttribution:function(){var a=this._map.getSize().x;this._getAttributionLogo().style.display=600>a?"none":"block",this._getAttributionSpan().style.maxWidth=.75*a+"px"},_getAttributionData:function(b){this.attributionBoundingBoxes=[],a.esri.RequestHandlers.JSONP(b,{},this._processAttributionData,this)},_processAttributionData:function(b){for(var c=0;cb.score?1:0}),this.bounds&&this._updateMapAttribution()},_getAttributionSpan:function(){return this._map._container.querySelectorAll(".esri-attributions")[0]},_getAttributionLogo:function(){return this._map._container.querySelectorAll(".esri-attribution-logo")[0]},_updateMapAttribution:function(){for(var a="",b=0;b=c.minZoom&&this.zoom<=c.maxZoom){var d=this.attributionBoundingBoxes[b].attribution;-1===a.indexOf(d)&&(a.length>0&&(a+=", "),a+=d)}}this._getAttributionSpan().innerHTML=a,this._resizeAttribution()}}),a.esri.basemapLayer=function(b,c){return new a.esri.BasemapLayer(b,c)}}(L); \ No newline at end of file