Skip to content

Instantly share code, notes, and snippets.

@JimShady
Last active August 29, 2015 14:16
Show Gist options
  • Save JimShady/c4600f5b3900aea93524 to your computer and use it in GitHub Desktop.
Save JimShady/c4600f5b3900aea93524 to your computer and use it in GitHub Desktop.
3D Buildings + Pollution
/*! esri-leaflet - v1.0.0-rc.2 - 2014-10-20
* Copyright (c) 2014 Environmental Systems Research Institute, Inc.
* Apache License*/
(function (factory) {
//define an AMD module that relies on 'leaflet'
if (typeof define === 'function' && define.amd) {
define(['leaflet'], function (L) {
return factory(L);
});
//define a common js module that relies on 'leaflet'
} else if (typeof module === 'object' && typeof module.exports === 'object') {
module.exports = factory(require('leaflet'));
}
if(typeof window !== 'undefined' && window.L){
factory(window.L);
}
}(function (L) {
var EsriLeaflet={VERSION:"1.0.0-rc.2",Layers:{},Services:{},Controls:{},Tasks:{},Util:{},Support:{CORS:!!(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),pointerEvents:""===document.documentElement.style.pointerEvents}};"undefined"!=typeof window&&window.L&&(window.L.esri=EsriLeaflet),function(a){function b(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function c(a,b){for(var c=0;c<a.length;c++)if(a[c]!==b[c])return!1;return!0}function d(a){return c(a[0],a[a.length-1])||a.push(a[0]),a}function e(a){var b,c=0,d=0,e=a.length,f=a[d];for(d;e-1>d;d++)b=a[d+1],c+=(b[0]-f[0])*(b[1]+f[1]),f=b;return c>=0}function f(a,b,c,d){var e=(d[0]-c[0])*(a[1]-c[1])-(d[1]-c[1])*(a[0]-c[0]),f=(b[0]-a[0])*(a[1]-c[1])-(b[1]-a[1])*(a[0]-c[0]),g=(d[1]-c[1])*(b[0]-a[0])-(d[0]-c[0])*(b[1]-a[1]);if(0!==g){var h=e/g,i=f/g;if(h>=0&&1>=h&&i>=0&&1>=i)return!0}return!1}function g(a,b){for(var c=0;c<a.length-1;c++)for(var d=0;d<b.length-1;d++)if(f(a[c],a[c+1],b[d],b[d+1]))return!0;return!1}function h(a,b){for(var c=!1,d=-1,e=a.length,f=e-1;++d<e;f=d)(a[d][1]<=b[1]&&b[1]<a[f][1]||a[f][1]<=b[1]&&b[1]<a[d][1])&&b[0]<(a[f][0]-a[d][0])*(b[1]-a[d][1])/(a[f][1]-a[d][1])+a[d][0]&&(c=!c);return c}function i(a,b){var c=g(a,b),d=h(a,b[0]);return!c&&d?!0:!1}function j(a){for(var b,c,f,h=[],j=[],k=0;k<a.length;k++){var l=d(a[k].slice(0));if(!(l.length<4))if(e(l)){var m=[l];h.push(m)}else j.push(l)}for(var n=[];j.length;){f=j.pop();var o=!1;for(b=h.length-1;b>=0;b--)if(c=h[b][0],i(c,f)){h[b].push(f),o=!0;break}o||n.push(f)}for(;n.length;){f=n.pop();var p=!1;for(b=h.length-1;b>=0;b--)if(c=h[b][0],g(c,f)){h[b].push(f),p=!0;break}p||h.push([f.reverse()])}return 1===h.length?{type:"Polygon",coordinates:h[0]}:{type:"MultiPolygon",coordinates:h}}function k(a){var b=[],c=a.slice(0),f=d(c.shift().slice(0));if(f.length>=4){e(f)||f.reverse(),b.push(f);for(var g=0;g<c.length;g++){var h=d(c[g].slice(0));h.length>=4&&(e(h)&&h.reverse(),b.push(h))}}return b}function l(a){for(var b=[],c=0;c<a.length;c++)for(var d=k(a[c]),e=d.length-1;e>=0;e--){var f=d[e].slice(0);b.push(f)}return b}a.Util.extentToBounds=function(a){var b=new L.LatLng(a.ymin,a.xmin),c=new L.LatLng(a.ymax,a.xmax);return new L.LatLngBounds(b,c)},a.Util.boundsToExtent=function(a){return a=L.latLngBounds(a),{xmin:a.getSouthWest().lng,ymin:a.getSouthWest().lat,xmax:a.getNorthEast().lng,ymax:a.getNorthEast().lat,spatialReference:{wkid:4326}}},a.Util.arcgisToGeojson=function(c,d){var e={};return"number"==typeof c.x&&"number"==typeof c.y&&(e.type="Point",e.coordinates=[c.x,c.y]),c.points&&(e.type="MultiPoint",e.coordinates=c.points.slice(0)),c.paths&&(1===c.paths.length?(e.type="LineString",e.coordinates=c.paths[0].slice(0)):(e.type="MultiLineString",e.coordinates=c.paths.slice(0))),c.rings&&(e=j(c.rings.slice(0))),(c.geometry||c.attributes)&&(e.type="Feature",e.geometry=c.geometry?a.Util.arcgisToGeojson(c.geometry):null,e.properties=c.attributes?b(c.attributes):null,c.attributes&&(e.id=c.attributes[d]||c.attributes.OBJECTID||c.attributes.FID)),e},a.Util.geojsonToArcGIS=function(c,d){d=d||"OBJECTID";var e,f={wkid:4326},g={};switch(c.type){case"Point":g.x=c.coordinates[0],g.y=c.coordinates[1],g.spatialReference=f;break;case"MultiPoint":g.points=c.coordinates.slice(0),g.spatialReference=f;break;case"LineString":g.paths=[c.coordinates.slice(0)],g.spatialReference=f;break;case"MultiLineString":g.paths=c.coordinates.slice(0),g.spatialReference=f;break;case"Polygon":g.rings=k(c.coordinates.slice(0)),g.spatialReference=f;break;case"MultiPolygon":g.rings=l(c.coordinates.slice(0)),g.spatialReference=f;break;case"Feature":c.geometry&&(g.geometry=a.Util.geojsonToArcGIS(c.geometry,d)),g.attributes=c.properties?b(c.properties):{},c.id&&(g.attributes[d]=c.id);break;case"FeatureCollection":for(g=[],e=0;e<c.features.length;e++)g.push(a.Util.geojsonToArcGIS(c.features[e],d));break;case"GeometryCollection":for(g=[],e=0;e<c.geometries.length;e++)g.push(a.Util.geojsonToArcGIS(c.geometries[e],d))}return g},a.Util.responseToFeatureCollection=function(b,c){var d;if(c)d=c;else if(b.objectIdFieldName)d=b.objectIdFieldName;else if(b.fields){for(var e=0;e<=b.fields.length-1;e++)if("esriFieldTypeOID"===b.fields[e].type){d=b.fields[e].name;break}}else d="OBJECTID";var f={type:"FeatureCollection",features:[]},g=b.features||b.results;if(g.length)for(var h=g.length-1;h>=0;h--)f.features.push(a.Util.arcgisToGeojson(g[h],d));return f},a.Util.cleanUrl=function(a){return a=a.replace(/\s\s*/g,""),"/"!==a[a.length-1]&&(a+="/"),a},a.Util.geojsonTypeToArcGIS=function(a){var b;switch(a){case"Point":b="esriGeometryPoint";break;case"MultiPoint":b="esriGeometryMultipoint";break;case"LineString":b="esriGeometryPolyline";break;case"MultiLineString":b="esriGeometryPolyline";break;case"Polygon":b="esriGeometryPolygon";break;case"MultiPolygon":b="esriGeometryPolygon"}return b}}(EsriLeaflet),function(a){function b(a){var b="";a.f="json";for(var c in a)if(a.hasOwnProperty(c)){var d,e=a[c],f=Object.prototype.toString.call(e);b.length&&(b+="&"),d="[object Array]"===f||"[object Object]"===f?JSON.stringify(e):"[object Date]"===f?e.valueOf():e,b+=encodeURIComponent(c)+"="+encodeURIComponent(d)}return b}function c(a,b){var c=new XMLHttpRequest;return c.onerror=function(){a.call(b,{error:{code:500,message:"XMLHttpRequest error"}},null)},c.onreadystatechange=function(){var d,e;if(4===c.readyState){try{d=JSON.parse(c.responseText)}catch(f){d=null,e={code:500,message:"Could not parse response as JSON."}}!e&&d.error&&(e=d.error,d=null),a.call(b,e,d)}},c}var d=0;window._EsriLeafletCallbacks={},a.Request={request:function(a,d,e,f){var g=b(d),h=c(e,f),i=(a+"?"+g).length;if(2e3>=i&&L.esri.Support.CORS)h.open("GET",a+"?"+g),h.send(null);else if(i>2e3&&L.esri.Support.CORS)h.open("POST",a),h.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),h.send(g);else{if(2e3>=i&&!L.esri.Support.CORS)return L.esri.Request.get.JSONP(a,d,e,f);if(console&&console.warn)return void console.warn("a request to "+a+" was longer then 2000 characters and this browser cannot make a cross-domain post request. Please use a proxy http://esri.github.io/esri-leaflet/api-reference/request.html")}return h},post:{XMLHTTP:function(a,d,e,f){var g=c(e,f);return g.open("POST",a),g.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),g.send(b(d)),g}},get:{CORS:function(a,d,e,f){var g=c(e,f);return g.open("GET",a+"?"+b(d),!0),g.send(null),g},JSONP:function(a,c,e,f){var g="c"+d;c.callback="window._EsriLeafletCallbacks."+g;var h=L.DomUtil.create("script",null,document.body);return h.type="text/javascript",h.src=a+"?"+b(c),h.id=g,window._EsriLeafletCallbacks[g]=function(a){if(window._EsriLeafletCallbacks[g]!==!0){var b,c=Object.prototype.toString.call(a);"[object Object]"!==c&&"[object Array]"!==c&&(b={error:{code:500,message:"Expected array or object as JSONP response"}},a=null),!b&&a.error&&(b=a,a=null),e.call(f,b,a),window._EsriLeafletCallbacks[g]=!0}},d++,{id:g,url:h.src,abort:function(){window._EsriLeafletCallbacks._callback[g]({code:0,message:"Request aborted."})}}}}},a.get=a.Support.CORS?a.Request.get.CORS:a.Request.get.JSONP,a.post=a.Request.post.XMLHTTP,a.request=a.Request.request}(EsriLeaflet),EsriLeaflet.Services.Service=L.Class.extend({includes:L.Mixin.Events,options:{proxy:!1,useCors:EsriLeaflet.Support.CORS},initialize:function(a,b){this.url=EsriLeaflet.Util.cleanUrl(a),this._requestQueue=[],this._authenticating=!1,L.Util.setOptions(this,b)},get:function(a,b,c,d){return this._request("get",a,b,c,d)},post:function(a,b,c,d){return this._request("post",a,b,c,d)},request:function(a,b,c,d){return this._request("request",a,b,c,d)},metadata:function(a,b){return this._request("get","",{},a,b)},authenticate:function(a){return this._authenticating=!1,this.options.token=a,this._runQueue(),this},_request:function(a,b,c,d,e){this.fire("requeststart",{url:this.url+b,params:c,method:a});var f=this._createServiceCallback(a,b,c,d,e);if(this.options.token&&(c.token=this.options.token),this._authenticating)return void this._requestQueue.push([a,b,c,d,e]);var g=this.options.proxy?this.options.proxy+"?"+this.url+b:this.url+b;return"get"!==a&&"request"!==a||this.options.useCors?EsriLeaflet[a](g,c,f):EsriLeaflet.Request.get.JSONP(g,c,f)},_createServiceCallback:function(a,b,c,d,e){var f=[a,b,c,d,e];return L.Util.bind(function(g,h){!g||499!==g.code&&498!==g.code?(d.call(e,g,h),g?this.fire("requesterror",{url:this.url+b,params:c,message:g.message,code:g.code,method:a}):this.fire("requestsuccess",{url:this.url+b,params:c,response:h,method:a}),this.fire("requestend",{url:this.url+b,params:c,method:a})):(this._authenticating=!0,this._requestQueue.push(f),this.fire("authenticationrequired",{authenticate:L.Util.bind(this.authenticate,this)}))},this)},_runQueue:function(){for(var a=this._requestQueue.length-1;a>=0;a--){var b=this._requestQueue[a],c=b.shift();this[c].apply(this,b)}this._requestQueue=[]}}),EsriLeaflet.Services.service=function(a,b){return new EsriLeaflet.Services.Service(a,b)},EsriLeaflet.Services.FeatureLayer=EsriLeaflet.Services.Service.extend({options:{idAttribute:"OBJECTID"},query:function(){return new EsriLeaflet.Tasks.Query(this)},addFeature:function(a,b,c){return delete a.id,a=EsriLeaflet.Util.geojsonToArcGIS(a),this.post("addFeatures",{features:[a]},function(a,c){var d=c&&c.addResults?c.addResults[0]:void 0;b&&b.call(this,a||c.addResults[0].error,d)},c)},updateFeature:function(a,b,c){return a=EsriLeaflet.Util.geojsonToArcGIS(a,this.options.idAttribute),this.post("updateFeatures",{features:[a]},function(a,d){var e=d&&d.updateResults?d.updateResults[0]:void 0;b&&b.call(c,a||d.updateResults[0].error,e)},c)},deleteFeature:function(a,b,c){return this.post("deleteFeatures",{objectIds:a},function(a,d){var e=d&&d.deleteResults?d.deleteResults[0]:void 0;b&&b.call(c,a||d.deleteResults[0].error,e)},c)}}),EsriLeaflet.Services.featureLayer=function(a,b){return new EsriLeaflet.Services.FeatureLayer(a,b)},EsriLeaflet.Services.MapService=EsriLeaflet.Services.Service.extend({identify:function(){return new EsriLeaflet.Tasks.identifyFeatures(this)},find:function(){return new EsriLeaflet.Tasks.Find(this)},query:function(){return new EsriLeaflet.Tasks.Query(this)}}),EsriLeaflet.Services.mapService=function(a,b){return new EsriLeaflet.Services.MapService(a,b)},EsriLeaflet.Services.ImageService=EsriLeaflet.Services.Service.extend({query:function(){return new EsriLeaflet.Tasks.Query(this)},identify:function(){return new EsriLeaflet.Tasks.IdentifyImage(this)}}),EsriLeaflet.Services.imageService=function(a,b){return new EsriLeaflet.Services.ImageService(a,b)},EsriLeaflet.Tasks.Task=L.Class.extend({options:{proxy:!1,useCors:EsriLeaflet.Support.CORS},generateSetter:function(a,b){var c=a.match(/([a-zA-Z]+)\[\]/);return a=c?c[1]:a,c?L.Util.bind(function(b){return this.params[a]=L.Util.isArray(b)?b.join(","):b,this},b):L.Util.bind(function(b){return this.params[a]=b,this},b)},initialize:function(a,b){if(a.url&&a.request?(this._service=a,this.url=a.url):this.url=EsriLeaflet.Util.cleanUrl(a),this.params=L.Util.extend({},this.params||{}),this.setters)for(var c in this.setters){var d=this.setters[c];this[c]=this.generateSetter(d,this)}L.Util.setOptions(this,b)},token:function(a){return this._service?this._service.authenticate(a):this.params.token=a,this},request:function(a,b){return this._service?this._service.request(this.path,this.params,a,b):this._request("request",this.path,this.params,a,b)},_request:function(a,b,c,d,e){var f=this.options.proxy?this.options.proxy+"?"+this.url+b:this.url+b;return"get"!==a&&"request"!==a||this.options.useCors?EsriLeaflet[a](f,c,d,e):EsriLeaflet.Request.get.JSONP(f,c,d,e)}}),EsriLeaflet.Tasks.Query=EsriLeaflet.Tasks.Task.extend({setters:{offset:"offset",limit:"limit",outFields:"fields[]",precision:"geometryPrecision",featureIds:"objectIds[]",returnGeometry:"returnGeometry",token:"token"},path:"query",params:{returnGeometry:!0,where:"1=1",outSr:4326,outFields:"*"},within:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelContains",this},intersects:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelIntersects",this},contains:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelWithin",this},overlaps:function(a){return this._setGeometry(a),this.params.spatialRel="esriSpatialRelOverlaps",this},nearby:function(a,b){return a=L.latLng(a),this.params.geometry=[a.lng,a.lat].join(","),this.params.geometryType="esriGeometryPoint",this.params.spatialRel="esriSpatialRelIntersects",this.params.units="esriSRUnit_Meter",this.params.distance=b,this.params.inSr=4326,this},where:function(a){return this.params.where=a.replace(/"/g,"'"),this},between:function(a,b){return this.params.time=[a.valueOf(),b.valueOf()].join(),this},fields:function(a){return this.params.outFields=L.Util.isArray(a)?a.join(","):a,this},simplify:function(a,b){var c=Math.abs(a.getBounds().getWest()-a.getBounds().getEast());return this.params.maxAllowableOffset=c/a.getSize().y*b,this},orderBy:function(a,b){return b=b||"ASC",this.params.orderByFields=this.params.orderByFields?this.params.orderByFields+",":"",this.params.orderByFields+=[a,b].join(" "),this},returnGeometry:function(a){return this.params.returnGeometry=a,this},run:function(a,b){return this._cleanParams(),this.request(function(c,d){a.call(b,c,d&&EsriLeaflet.Util.responseToFeatureCollection(d),d)},b)},count:function(a,b){return this._cleanParams(),this.params.returnCountOnly=!0,this.request(function(b,c){a.call(this,b,c&&c.count,c)},b)},ids:function(a,b){return this._cleanParams(),this.params.returnIdsOnly=!0,this.request(function(b,c){a.call(this,b,c&&c.objectIds,c)},b)},bounds:function(a,b){return this._cleanParams(),this.params.returnExtentOnly=!0,this.request(function(c,d){a.call(b,c,d&&d.extent&&EsriLeaflet.Util.extentToBounds(d.extent),d)},b)},pixelSize:function(a){return a=L.point(a),this.params.pixelSize=[a.x,a.y].join(","),this},layer:function(a){return this.path=a+"/query",this},_cleanParams:function(){delete this.params.returnIdsOnly,delete this.params.returnExtentOnly,delete this.params.returnCountOnly},_setGeometry:function(a){return this.params.inSr=4326,a instanceof L.LatLngBounds?(this.params.geometry=EsriLeaflet.Util.boundsToExtent(a),void(this.params.geometryType="esriGeometryEnvelope")):(a.getLatLng&&(a=a.getLatLng()),a instanceof L.LatLng&&(a={type:"Point",coordinates:[a.lng,a.lat]}),a instanceof L.GeoJSON&&(a=a.getLayers()[0].feature.geometry,this.params.geometry=EsriLeaflet.Util.geojsonToArcGIS(a),this.params.geometryType=EsriLeaflet.Util.geojsonTypeToArcGIS(a.type)),a.toGeoJSON&&(a=a.toGeoJSON()),"Feature"===a.type&&(a=a.geometry),"Point"===a.type||"LineString"===a.type||"Polygon"===a.type?(this.params.geometry=EsriLeaflet.Util.geojsonToArcGIS(a),void(this.params.geometryType=EsriLeaflet.Util.geojsonTypeToArcGIS(a.type))):void(console&&console.warn&&console.warn("invalid geometry passed to spatial query. Should be an L.LatLng, L.LatLngBounds or L.Marker or a GeoJSON Point Line or Polygon object")))}}),EsriLeaflet.Tasks.query=function(a,b){return new EsriLeaflet.Tasks.Query(a,b)},EsriLeaflet.Tasks.Find=EsriLeaflet.Tasks.Task.extend({setters:{contains:"contains",text:"searchText",fields:"searchFields[]",spatialReference:"spatialReference",sr:"spatialReference",layers:"layers[]",returnGeometry:"returnGeometry",maxAllowableOffset:"maxAllowableOffset",precision:"geometryPrecision",dynamicLayers:"dynamicLayers",returnZ:"returnZ",returnM:"returnM",gdbVersion:"gdbVersion",token:"token"},path:"find",params:{sr:4326,contains:!0,returnGeometry:!0,returnZ:!0,returnM:!1},layerDefs:function(a,b){return this.params.layerDefs=this.params.layerDefs?this.params.layerDefs+";":"",this.params.layerDefs+=[a,b].join(":"),this},simplify:function(a,b){var c=Math.abs(a.getBounds().getWest()-a.getBounds().getEast());return this.params.maxAllowableOffset=c/a.getSize().y*b,this},run:function(a,b){return this.request(function(c,d){a.call(b,c,d&&EsriLeaflet.Util.responseToFeatureCollection(d),d)},b)}}),EsriLeaflet.Tasks.find=function(a,b){return new EsriLeaflet.Tasks.Find(a,b)},EsriLeaflet.Tasks.Identify=EsriLeaflet.Tasks.Task.extend({path:"identify",between:function(a,b){return this.params.time=[a.valueOf(),b.valueOf()].join(","),this},returnGeometry:function(a){return this.params.returnGeometry=a,this}}),EsriLeaflet.Tasks.IdentifyImage=EsriLeaflet.Tasks.Identify.extend({setters:{setMosaicRule:"mosaicRule",setRenderingRule:"renderingRule",returnCatalogItems:"returnCatalogItems"},params:{returnGeometry:!1},at:function(a){return a=L.latLng(a),this.params.geometry=JSON.stringify({x:a.lng,y:a.lat,spatialReference:{wkid:4326}}),this.params.geometryType="esriGeometryPoint",this},getMosaicRule:function(){return this.params.mosaicRule},getRenderingRule:function(){return this.params.renderingRule},setPixelSize:function(a){return this.params.pixelSize=a.join?a.join(","):a,this},getPixelSize:function(){return this.params.pixelSize},run:function(a,b){return this.request(function(c,d){a.call(b,c,d&&this._responseToGeoJSON(d),d)},this)},_responseToGeoJSON:function(a){var b=a.location,c=a.catalogItems,d=a.catalogItemVisibilities,e={pixel:{type:"Feature",geometry:{type:"Point",coordinates:[b.x,b.y]},crs:{type:"EPSG",properties:{code:b.spatialReference.wkid}},properties:{OBJECTID:a.objectId,name:a.name,value:a.value},id:a.objectId}};if(a.properties&&a.properties.Values&&(e.pixel.properties.values=a.properties.Values),c&&c.features&&(e.catalogItems=EsriLeaflet.Util.responseToFeatureCollection(c),d&&d.length===e.catalogItems.features.length))for(var f=d.length-1;f>=0;f--)e.catalogItems.features[f].properties.catalogItemVisibility=d[f];return e}}),EsriLeaflet.Tasks.identifyImage=function(a,b){return new EsriLeaflet.Tasks.IdentifyImage(a,b)},EsriLeaflet.Tasks.IdentifyFeatures=EsriLeaflet.Tasks.Identify.extend({setters:{layers:"layers",precision:"geometryPrecision",tolerance:"tolerance"},params:{sr:4326,layers:"all",tolerance:3,returnGeometry:!0},on:function(a){var b=EsriLeaflet.Util.boundsToExtent(a.getBounds()),c=a.getSize();return this.params.imageDisplay=[c.x,c.y,96].join(","),this.params.mapExtent=[b.xmin,b.ymin,b.xmax,b.ymax].join(","),this},at:function(a){return a=L.latLng(a),this.params.geometry=[a.lng,a.lat].join(","),this.params.geometryType="esriGeometryPoint",this},layerDef:function(a,b){return this.params.layerDefs=this.params.layerDefs?this.params.layerDefs+";":"",this.params.layerDefs+=[a,b].join(":"),this},simplify:function(a,b){var c=Math.abs(a.getBounds().getWest()-a.getBounds().getEast());return this.params.maxAllowableOffset=c/a.getSize().y*(1-b),this},run:function(a,b){return this.request(function(c,d){a.call(b,c,d&&EsriLeaflet.Util.responseToFeatureCollection(d),d)},b)}}),EsriLeaflet.Tasks.identifyFeatures=function(a,b){return new EsriLeaflet.Tasks.IdentifyFeatures(a,b)},function(a){var b="https:"!==window.location.protocol?"http:":"https:";a.Layers.BasemapLayer=L.TileLayer.extend({statics:{TILES:{Streets:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}",attributionUrl:"https://static.arcgis.com/attribution/World_Street_Map",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"Esri"}},Topographic:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}",attributionUrl:"https://static.arcgis.com/attribution/World_Topo_Map",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"Esri"}},Oceans:{urlTemplate:b+"//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}",attributionUrl:"https://static.arcgis.com/attribution/Ocean_Basemap",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"Esri"}},OceansLabels:{urlTemplate:b+"//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"]}},NationalGeographic:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"Esri"}},DarkGray:{urlTemplate:b+"//tiles{s}.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Dark_Gray_Base_Beta/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:10,subdomains:["1","2"],attribution:"Esri, DeLorme, HERE"}},DarkGrayLabels:{urlTemplate:b+"//tiles{s}.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Dark_Gray_Reference_Beta/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:10,subdomains:["1","2"]}},Gray:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"Esri, NAVTEQ, DeLorme"}},GrayLabels:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:16,subdomains:["server","services"]}},Imagery:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"Esri, DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community"}},ImageryLabels:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:19,subdomains:["server","services"]}},ImageryTransportation:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:19,subdomains:["server","services"]}},ShadedRelief:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:13,subdomains:["server","services"],attribution:"ESRI, NAVTEQ, DeLorme"}},ShadedReliefLabels:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:12,subdomains:["server","services"]}},Terrain:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!1,logoPosition:"bottomright",minZoom:1,maxZoom:13,subdomains:["server","services"],attribution:"Esri, USGS, NOAA"}},TerrainLabels:{urlTemplate:b+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}",options:{hideLogo:!0,logoPosition:"bottomright",minZoom:1,maxZoom:13,subdomains:["server","services"]}}}},initialize:function(b,c){var d;if("object"==typeof b&&b.urlTemplate&&b.options)d=b;else{if("string"!=typeof b||!a.BasemapLayer.TILES[b])throw new Error('L.esri.BasemapLayer: Invalid parameter. Use one of "Streets", "Topographic", "Oceans", "OceansLabels", "NationalGeographic", "Gray", "GrayLabels", "DarkGray", "DarkGrayLabels", "Imagery", "ImageryLabels", "ImageryTransportation", "ShadedRelief", "ShadedReliefLabels", "Terrain" or "TerrainLabels"');d=a.BasemapLayer.TILES[b]}var e=L.Util.extend(d.options,c);L.TileLayer.prototype.initialize.call(this,d.urlTemplate,L.Util.setOptions(this,e)),d.attributionUrl&&this._getAttributionData(d.attributionUrl)},onAdd:function(b){this.options.hideLogo||(this._logo=new a.Controls.Logo({position:this.options.logoPosition}).addTo(b)),L.TileLayer.prototype.onAdd.call(this,b),b.on("moveend",this._updateMapAttribution,this)},onRemove:function(a){this._logo&&a.removeControl(this._logo),L.TileLayer.prototype.onRemove.call(this,a),a.off("moveend",this._updateMapAttribution,this)},getAttribution:function(){var a='<span class="esri-attributions" style="line-height:14px; vertical-align: -3px; text-overflow:ellipsis; white-space:nowrap; overflow:hidden; display:inline-block;">'+this.options.attribution+"</span>";return a},_getAttributionData:function(b){a.get(b,{},function(a,b){this._attributions=[];for(var c=0;c<b.contributors.length;c++)for(var d=b.contributors[c],e=0;e<d.coverageAreas.length;e++){var f=d.coverageAreas[e],g=new L.LatLng(f.bbox[0],f.bbox[1]),h=new L.LatLng(f.bbox[2],f.bbox[3]);this._attributions.push({attribution:d.attribution,score:f.score,bounds:new L.LatLngBounds(g,h),minZoom:f.zoomMin,maxZoom:f.zoomMax})}this._attributions.sort(function(a,b){return b.score-a.score}),this._updateMapAttribution()},this)},_updateMapAttribution:function(){if(this._map&&this._map.attributionControl&&this._attributions){for(var a="",b=this._map.getBounds(),c=this._map.getZoom(),d=0;d<this._attributions.length;d++){var e=this._attributions[d],f=e.attribution;!a.match(f)&&b.intersects(e.bounds)&&c>=e.minZoom&&c<=e.maxZoom&&(a+=", "+f)}a=a.substr(2);var g=this._map.attributionControl._container.querySelector(".esri-attributions");g.innerHTML=a,g.style.maxWidth=.65*this._map.getSize().x+"px",this.fire("attributionupdated",{attribution:a})}}}),a.BasemapLayer=a.Layers.BasemapLayer,a.Layers.basemapLayer=function(b,c){return new a.Layers.BasemapLayer(b,c)},a.basemapLayer=function(b,c){return new a.Layers.BasemapLayer(b,c)}}(EsriLeaflet),EsriLeaflet.Layers.RasterLayer=L.Class.extend({includes:L.Mixin.Events,options:{opacity:1,position:"front",f:"image"},onAdd:function(a){if(this._map=a,this._update=L.Util.limitExecByInterval(this._update,this.options.updateInterval,this),a.options.crs&&a.options.crs.code){var b=a.options.crs.code.split(":")[1];this.options.bboxSR=b,this.options.imageSR=b}this._map.addEventListener(this.getEvents(),this),this._update(),this._popup&&(this._map.on("click",this._getPopupData,this),this._map.on("dblclick",this._resetPopupState,this))},bindPopup:function(a,b){return this._shouldRenderPopup=!1,this._lastClick=!1,this._popup=L.popup(b),this._popupFunction=a,this._map&&(this._map.on("click",this._getPopupData,this),this._map.on("dblclick",this._resetPopupState,this)),this},unbindPopup:function(){return this._map&&(this._map.closePopup(this._popup),this._map.off("click",this._getPopupData,this),this._map.off("dblclick",this._resetPopupState,this)),this._popup=!1,this},onRemove:function(){this._currentImage&&this._map.removeLayer(this._currentImage),this._popup&&(this._map.off("click",this._getPopupData,this),this._map.off("dblclick",this._resetPopupState,this)),this._map.removeEventListener(this.getEvents(),this)},addTo:function(a){return a.addLayer(this),this},removeFrom:function(a){return a.removeLayer(this),this},getEvents:function(){return{moveend:this._update}},bringToFront:function(){return this.options.position="front",this._currentImage&&this._currentImage.bringToFront(),this},bringToBack:function(){return this.options.position="back",this._currentImage&&this._currentImage.bringToBack(),this},getAttribution:function(){return this.options.attribution},getOpacity:function(){return this.options.opacity},setOpacity:function(a){return this.options.opacity=a,this._currentImage.setOpacity(a),this},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(a,b){return this.options.from=a,this.options.to=b,this._update(),this},metadata:function(a,b){return this._service.metadata(a,b),this},authenticate:function(a){return this._service.authenticate(a),this},_renderImage:function(a,b){var c=new L.ImageOverlay(a,b,{opacity:0}).addTo(this._map);c.once("load",function(a){var c=a.target,d=this._currentImage;c._bounds.equals(b)?(this._currentImage=c,"front"===this.options.position?this.bringToFront():this.bringToBack(),this._currentImage.setOpacity(this.options.opacity),d&&this._map.removeLayer(d)):this._map.removeLayer(c),this.fire("load",{bounds:b})},this),this.fire("loading",{bounds:b})},_update:function(){if(this._map){var a=this._map.getZoom(),b=this._map.getBounds();if(!this._animatingZoom&&!(this._map._panTransition&&this._map._panTransition._inProgress||a>this.options.maxZoom||a<this.options.minZoom)){var c=this._buildExportParams();this._requestExport(c,b)}}},_renderPopup:function(a,b,c,d){if(a=L.latLng(a),this._shouldRenderPopup&&this._lastClick.equals(a)){var e=this._popupFunction(b,c,d);e&&this._popup.setLatLng(a).setContent(e).openOn(this._map)}},_resetPopupState:function(a){this._shouldRenderPopup=!1,this._lastClick=a.latlng},_propagateEvent:function(a){a=L.extend({layer:a.target,target:this},a),this.fire(a.type,a)}}),EsriLeaflet.Layers.DynamicMapLayer=EsriLeaflet.Layers.RasterLayer.extend({options:{updateInterval:150,layers:!1,layerDefs:!1,timeOptions:!1,format:"png24",transparent:!0},initialize:function(a,b){this.url=EsriLeaflet.Util.cleanUrl(a),this._service=new EsriLeaflet.Services.MapService(this.url,b),this._service.on("authenticationrequired requeststart requestend requesterror requestsuccess",this._propagateEvent,this),L.Util.setOptions(this,b)},getLayers:function(){return this.options.layers},setLayers:function(a){return this.options.layers=a,this._update(),this},getLayerDefs:function(){return this.options.layerDefs},setLayerDefs:function(a){return this.options.layerDefs=a,this._update(),this},getTimeOptions:function(){return this.options.timeOptions},setTimeOptions:function(a){return this.options.timeOptions=a,this._update(),this},query:function(){return this._service.query()},identify:function(){return this._service.identify()},find:function(){return this._service.find()},_getPopupData:function(a){var b=L.Util.bind(function(b,c,d){setTimeout(L.Util.bind(function(){this._renderPopup(a.latlng,b,c,d)},this),300)},this),c=this.identify().on(this._map).at(a.latlng);c.layers(this.options.layers?"visible:"+this.options.layers.join(","):"visible"),c.run(b),this._shouldRenderPopup=!0,this._lastClick=a.latlng},_buildExportParams:function(){var a=this._map.getBounds(),b=this._map.getSize(),c=this._map.options.crs.project(a._northEast),d=this._map.options.crs.project(a._southWest),e={bbox:[d.x,d.y,c.x,c.y].join(","),size:b.x+","+b.y,dpi:96,format:this.options.format,transparent:this.options.transparent,bboxSR:this.options.bboxSR,imageSR:this.options.imageSR};return this.options.layers&&(e.layers="show:"+this.options.layers.join(",")),this.options.layerDefs&&(e.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),e},_requestExport:function(a,b){"json"===this.options.f?this._service.get("export",a,function(a,c){this._renderImage(c.href,b)},this):(a.f="image",this._renderImage(this.url+"export"+L.Util.getParamString(a),b))}}),EsriLeaflet.DynamicMapLayer=EsriLeaflet.Layers.DynamicMapLayer,EsriLeaflet.Layers.dynamicMapLayer=function(a,b){return new EsriLeaflet.Layers.DynamicMapLayer(a,b)},EsriLeaflet.dynamicMapLayer=function(a,b){return new EsriLeaflet.Layers.DynamicMapLayer(a,b)},EsriLeaflet.Layers.ImageMapLayer=EsriLeaflet.Layers.RasterLayer.extend({options:{updateInterval:150,format:"jpgpng"},query:function(){return this._service.query()},identify:function(){return this._service.identify()},initialize:function(a,b){this.url=EsriLeaflet.Util.cleanUrl(a),this._service=new EsriLeaflet.Services.ImageService(this.url,b),this._service.on("authenticationrequired requeststart requestend requesterror requestsuccess",this._propagateEvent,this),L.Util.setOptions(this,b)
},setPixelType:function(a){return this.options.pixelType=a,this._update(),this},getPixelType:function(){return this.options.pixelType},setBandIds:function(a){return this.options.bandIds=L.Util.isArray(a)?a.join(","):a.toString(),this._update(),this},getBandIds:function(){return this.options.bandIds},setNoData:function(a,b){return this.options.noData=L.Util.isArray(a)?a.join(","):a.toString(),b&&(this.options.noDataInterpretation=b),this._update(),this},getNoData:function(){return this.options.noData},getNoDataInterpretation:function(){return this.options.noDataInterpretation},setRenderingRule:function(a){this.options.renderingRule=a,this._update()},getRenderingRule:function(){return this.options.renderingRule},setMosaicRule:function(a){this.options.mosaicRule=a,this._update()},getMosaicRule:function(){return this.options.mosaicRule},_getPopupData:function(a){var b=L.Util.bind(function(b,c,d){setTimeout(L.Util.bind(function(){this._renderPopup(a.latlng,b,c,d)},this),300)},this),c=this.identify().at(a.latlng);this.options.mosaicRule&&c.setMosaicRule(this.options.mosaicRule),c.run(b),this._shouldRenderPopup=!0,this._lastClick=a.latlng},_buildExportParams:function(){var a=this._map.getBounds(),b=this._map.getSize(),c=this._map.options.crs.project(a._northEast),d=this._map.options.crs.project(a._southWest),e={bbox:[d.x,d.y,c.x,c.y].join(","),size:b.x+","+b.y,format:this.options.format,bboxSR:this.options.bboxSR,imageSR:this.options.imageSR};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),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(a,b){"json"===this.options.f?this._service.get("exportImage",a,function(a,c){this._renderImage(c.href,b)},this):(a.f="image",this._renderImage(this.url+"exportImage"+L.Util.getParamString(a),b))}}),EsriLeaflet.ImageMapLayer=EsriLeaflet.Layers.ImageMapLayer,EsriLeaflet.Layers.imageMapLayer=function(a,b){return new EsriLeaflet.Layers.ImageMapLayer(a,b)},EsriLeaflet.imageMapLayer=function(a,b){return new EsriLeaflet.Layers.ImageMapLayer(a,b)},EsriLeaflet.Layers.TiledMapLayer=L.TileLayer.extend({initialize:function(a,b){b=L.Util.setOptions(this,b),this.url=L.esri.Util.cleanUrl(a),this.tileUrl=L.esri.Util.cleanUrl(a)+"tile/{z}/{y}/{x}",this._service=new L.esri.Services.MapService(this.url,b),this._service.on("authenticationrequired requeststart requestend requesterror requestsuccess",this._propagateEvent,this),this.tileUrl.match("://tiles.arcgisonline.com")&&(this.tileUrl=this.tileUrl.replace("://tiles.arcgisonline.com","://tiles{s}.arcgisonline.com"),b.subdomains=["1","2","3","4"]),L.TileLayer.prototype.initialize.call(this,this.tileUrl,b)},metadata:function(a,b){return this._service.metadata(a,b),this},identify:function(){return this._service.identify()},authenticate:function(a){return this._service.authenticate(a),this},_propagateEvent:function(a){a=L.extend({layer:a.target,target:this},a),this.fire(a.type,a)}}),L.esri.TiledMapLayer=L.esri.Layers.tiledMapLayer,L.esri.Layers.tiledMapLayer=function(a,b){return new L.esri.Layers.TiledMapLayer(a,b)},L.esri.tiledMapLayer=function(a,b){return new L.esri.Layers.TiledMapLayer(a,b)},EsriLeaflet.Layers.FeatureGrid=L.Class.extend({includes:L.Mixin.Events,options:{cellSize:512,updateInterval:150},initialize:function(a){a=L.setOptions(this,a)},onAdd:function(a){this._map=a,this._update=L.Util.limitExecByInterval(this._update,this.options.updateInterval,this),this._map.addEventListener(this.getEvents(),this),this._reset(),this._update()},onRemove:function(){this._map.removeEventListener(this.getEvents(),this),this._removeCells()},getEvents:function(){var a={viewreset:this._reset,moveend:this._update};return a},addTo:function(a){return a.addLayer(this),this},removeFrom:function(a){return a.removeLayer(this),this},_reset:function(){this._removeCells(),this._cells={},this._activeCells={},this._cellsToLoad=0,this._cellsTotal=0,this._resetWrap()},_resetWrap:function(){var a=this._map,b=a.options.crs;if(!b.infinite){var c=this._getCellSize();b.wrapLng&&(this._wrapLng=[Math.floor(a.project([0,b.wrapLng[0]]).x/c),Math.ceil(a.project([0,b.wrapLng[1]]).x/c)]),b.wrapLat&&(this._wrapLat=[Math.floor(a.project([b.wrapLat[0],0]).y/c),Math.ceil(a.project([b.wrapLat[1],0]).y/c)])}},_getCellSize:function(){return this.options.cellSize},_update:function(){if(this._map){var a=this._map.getPixelBounds(),b=this._map.getZoom(),c=this._getCellSize();if(!(b>this.options.maxZoom||b<this.options.minZoom)){var d=L.bounds(a.min.divideBy(c).floor(),a.max.divideBy(c).floor());this._addCells(d),this._removeOtherCells(d)}}},_addCells:function(a){var b,c,d,e=[],f=a.getCenter(),g=this._map.getZoom();for(b=a.min.y;b<=a.max.y;b++)for(c=a.min.x;c<=a.max.x;c++)d=new L.Point(c,b),d.z=g,e.push(d);var h=e.length;if(0!==h)for(this._cellsToLoad+=h,this._cellsTotal+=h,e.sort(function(a,b){return a.distanceTo(f)-b.distanceTo(f)}),c=0;h>c;c++)this._addCell(e[c])},_cellCoordsToBounds:function(a){var b=this._map,c=this.options.cellSize,d=a.multiplyBy(c),e=d.add([c,c]),f=b.unproject(d,a.z).wrap(),g=b.unproject(e,a.z).wrap();return new L.LatLngBounds(f,g)},_cellCoordsToKey:function(a){return a.x+":"+a.y},_keyToCellCoords:function(a){var b=a.split(":"),c=parseInt(b[0],10),d=parseInt(b[1],10);return new L.Point(c,d)},_removeOtherCells:function(a){for(var b in this._cells)a.contains(this._keyToCellCoords(b))||this._removeCell(b)},_removeCell:function(a){var b=this._activeCells[a];b&&(delete this._activeCells[a],this.cellLeave&&this.cellLeave(b.bounds,b.coords),this.fire("cellleave",{bounds:b.bounds,coords:b.coords}))},_removeCells:function(){for(var a in this._cells){var b=this._cells[a].bounds,c=this._cells[a].coords;this.cellLeave&&this.cellLeave(b,c),this.fire("cellleave",{bounds:b,coords:c})}},_addCell:function(a){this._wrapCoords(a);var b=this._cellCoordsToKey(a),c=this._cells[b];c&&!this._activeCells[b]&&(this.cellEnter&&this.cellEnter(c.bounds,a),this.fire("cellenter",{bounds:c.bounds,coords:a}),this._activeCells[b]=c),c||(c={coords:a,bounds:this._cellCoordsToBounds(a)},this._cells[b]=c,this._activeCells[b]=c,this.createCell&&this.createCell(c.bounds,a),this.fire("cellcreate",{bounds:c.bounds,coords:a}))},_wrapCoords:function(a){a.x=this._wrapLng?L.Util.wrapNum(a.x,this._wrapLng):a.x,a.y=this._wrapLat?L.Util.wrapNum(a.y,this._wrapLat):a.y}}),function(a){function b(a){this.values=a||[]}a.Layers.FeatureManager=a.Layers.FeatureGrid.extend({options:{where:"1=1",fields:["*"],from:!1,to:!1,timeField:!1,timeFilterMode:"server",simplifyFactor:0,precision:6},initialize:function(c,d){if(a.Layers.FeatureGrid.prototype.initialize.call(this,d),d=L.setOptions(this,d),this.url=a.Util.cleanUrl(c),this._service=new a.Services.FeatureLayer(this.url,d),"*"!==this.options.fields[0]){for(var e=!1,f=0;f<this.options.fields.length;f++)this.options.fields[f].match(/^(OBJECTID|FID|OID|ID)$/i)&&(e=!0);e===!1&&console&&console.warn&&console.warn("no known esriFieldTypeOID field detected in fields Array. Please add an attribute field containing unique IDs to ensure the layer can be drawn correctly.")}this._service.on("authenticationrequired requeststart requestend requesterror requestsuccess",function(a){a=L.extend({target:this},a),this.fire(a.type,a)},this),this.options.timeField.start&&this.options.timeField.end?(this._startTimeIndex=new b,this._endTimeIndex=new b):this.options.timeField&&(this._timeIndex=new b),this._currentSnapshot=[],this._activeRequests=0,this._pendingRequests=[]},onAdd:function(b){return a.Layers.FeatureGrid.prototype.onAdd.call(this,b)},onRemove:function(b){return a.Layers.FeatureGrid.prototype.onRemove.call(this,b)},getAttribution:function(){return this.options.attribution},createCell:function(a,b){this._requestFeatures(a,b)},_requestFeatures:function(a,b,c){return this._activeRequests++,1===this._activeRequests&&this.fire("loading",{bounds:a}),this._buildQuery(a).run(function(d,e,f){f&&f.exceededTransferLimit&&this.fire("drawlimitexceeded"),this._activeRequests--,!d&&e.features.length&&this._addFeatures(e.features,b),c&&c.call(this,d,e),this._activeRequests<=0&&this.fire("load",{bounds:a})},this)},_addFeatures:function(a){for(var b=a.length-1;b>=0;b--){var c=a[b].id;this._currentSnapshot.push(c)}this.options.timeField&&this._buildTimeIndexes(a),this.createLayers(a)},_buildQuery:function(a){var b=this._service.query().intersects(a).where(this.options.where).fields(this.options.fields).precision(this.options.precision);return this.options.simplifyFactor&&b.simplify(this._map,this.options.simplifyFactor),"server"===this.options.timeFilterMode&&this.options.from&&this.options.to&&b.between(this.options.from,this.options.to),b},setWhere:function(a,b,c){this.options.where=a&&a.length?a:"1=1";for(var d=[],e=[],f=0,g=null,h=L.Util.bind(function(a,h){if(a&&(g=a),h)for(var i=h.features.length-1;i>=0;i--)e.push(h.features[i].id);f--,0>=f&&(this._currentSnapshot=e,this.removeLayers(d),this.addLayers(e),b&&b.call(c,g))},this),i=this._currentSnapshot.length-1;i>=0;i--)d.push(this._currentSnapshot[i]);for(var j in this._activeCells){f++;var k=this._keyToCellCoords(j),l=this._cellCoordsToBounds(k);this._requestFeatures(l,j,h)}return this},getWhere:function(){return this.options.where},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(a,b,c,d){var e=this.options.from,f=this.options.to,g=0,h=null,i=L.Util.bind(function(i){i&&(h=i),this._filterExistingFeatures(e,f,a,b),g--,c&&0>=g&&c.call(d,h)},this);if(this.options.from=a,this.options.to=b,this._filterExistingFeatures(e,f,a,b),"server"===this.options.timeFilterMode)for(var j in this._activeCells){g++;var k=this._keyToCellCoords(j),l=this._cellCoordsToBounds(k);this._requestFeatures(l,j,i)}},refresh:function(){for(var a in this._activeCells){var b=this._keyToCellCoords(a),c=this._cellCoordsToBounds(b);this._requestFeatures(c,a)}},_filterExistingFeatures:function(a,b,c,d){var e=a&&b?this._getFeaturesInTimeRange(a,b):this._currentSnapshot,f=this._getFeaturesInTimeRange(c,d);if(f.indexOf)for(var g=0;g<f.length;g++){var h=e.indexOf(f[g]);h>=0&&e.splice(h,1)}this.removeLayers(e),this.addLayers(f)},_getFeaturesInTimeRange:function(a,b){var c,d=[];if(this.options.timeField.start&&this.options.timeField.end){var e=this._startTimeIndex.between(a,b),f=this._endTimeIndex.between(a,b);c=e.concat(f)}else c=this._timeIndex.between(a,b);for(var g=c.length-1;g>=0;g--)d.push(c[g].id);return d},_buildTimeIndexes:function(a){var b,c;if(this.options.timeField.start&&this.options.timeField.end){var d=[],e=[];for(b=a.length-1;b>=0;b--)c=a[b],d.push({id:c.id,value:new Date(c.properties[this.options.timeField.start])}),e.push({id:c.id,value:new Date(c.properties[this.options.timeField.end])});this._startTimeIndex.bulkAdd(d),this._endTimeIndex.bulkAdd(e)}else{var f=[];for(b=a.length-1;b>=0;b--)c=a[b],f.push({id:c.id,value:new Date(c.properties[this.options.timeField])});this._timeIndex.bulkAdd(f)}},_featureWithinTimeRange:function(a){if(!this.options.from||!this.options.to)return!0;var b=+this.options.from.valueOf(),c=+this.options.to.valueOf();if("string"==typeof this.options.timeField){var d=+a.properties[this.options.timeField];return d>=b&&c>=d}if(this.options.timeField.start&&this.options.timeField.end){var e=+a.properties[this.options.timeField.start],f=+a.properties[this.options.timeField.end];return e>=b&&c>=e||f>=b&&c>=f}},authenticate:function(a){return this._service.authenticate(a),this},metadata:function(a,b){return this._service.metadata(a,b),this},query:function(){return this._service.query()},addFeature:function(a,b,c){return this._service.addFeature(a,function(a,d){a||this.refresh(),b&&b.call(c,a,d)},this),this},updateFeature:function(a,b,c){return this._service.updateFeature(a,function(a,d){a||this.refresh(),b&&b.call(c,a,d)},this)},deleteFeature:function(a,b,c){return this._service.deleteFeature(a,function(a,d){!a&&d.objectId&&this.removeLayers([d.objectId],!0),b&&b.call(c,a,d)},this)}}),b.prototype._query=function(a){for(var b,c,d,e=0,f=this.values.length-1;f>=e;)if(d=b=(e+f)/2|0,c=this.values[Math.round(b)],+c.value<+a)e=b+1;else{if(!(+c.value>+a))return b;f=b-1}return~f},b.prototype.sort=function(){this.values.sort(function(a,b){return+b.value-+a.value}).reverse(),this.dirty=!1},b.prototype.between=function(a,b){this.dirty&&this.sort();var c=this._query(a),d=this._query(b);return 0===c&&0===d?[]:(c=Math.abs(c),d=0>d?Math.abs(d):d+1,this.values.slice(c,d))},b.prototype.bulkAdd=function(a){this.dirty=!0,this.values=this.values.concat(a)}}(EsriLeaflet),EsriLeaflet.Layers.FeatureLayer=EsriLeaflet.Layers.FeatureManager.extend({statics:{EVENTS:"click dblclick mouseover mouseout mousemove contextmenu popupopen popupclose"},initialize:function(a,b){EsriLeaflet.Layers.FeatureManager.prototype.initialize.call(this,a,b),b=L.setOptions(this,b),this._layers={},this._leafletIds={},this._key="c"+(1e9*Math.random()).toString(36).replace(".","_")},onAdd:function(a){return EsriLeaflet.Layers.FeatureManager.prototype.onAdd.call(this,a)},onRemove:function(a){for(var b in this._layers)a.removeLayer(this._layers[b]);return EsriLeaflet.Layers.FeatureManager.prototype.onRemove.call(this,a)},createNewLayer:function(a){return L.GeoJSON.geometryToLayer(a,this.options.pointToLayer,L.GeoJSON.coordsToLatLng,this.options)},createLayers:function(a){for(var b=a.length-1;b>=0;b--){var c,d=a[b],e=this._layers[d.id];if(e&&!this._map.hasLayer(e)&&this._map.addLayer(e),e&&e.setLatLngs){var f=this.createNewLayer(d);e.setLatLngs(f.getLatLngs())}e||(c=this.createNewLayer(d),c.feature=d,c.defaultOptions=c.options,c._leaflet_id=this._key+"_"+d.id,this._leafletIds[c._leaflet_id]=d.id,c.on(EsriLeaflet.Layers.FeatureLayer.EVENTS,this._propagateEvent,this),this._popup&&c.bindPopup&&c.bindPopup(this._popup(c.feature,c),this._popupOptions),this.options.onEachFeature&&this.options.onEachFeature(c.feature,c),this._layers[c.feature.id]=c,this.resetStyle(c.feature.id),this.fire("createfeature",{feature:c.feature}),(!this.options.timeField||this.options.timeField&&this._featureWithinTimeRange(d))&&this._map.addLayer(c))}},addLayers:function(a){for(var b=a.length-1;b>=0;b--){var c=this._layers[a[b]];c&&(this.fire("addfeature",{feature:c.feature}),this._map.addLayer(c))}},removeLayers:function(a,b){for(var c=a.length-1;c>=0;c--){var d=a[c],e=this._layers[d];e&&(this.fire("removefeature",{feature:e.feature,permanent:b}),this._map.removeLayer(e)),e&&b&&delete this._layers[d]}},resetStyle:function(a){var b=this._layers[a];return b&&(b.options=b.defaultOptions,this.setFeatureStyle(b.feature.id,this.options.style)),this},setStyle:function(a){return this.options.style=a,this.eachFeature(function(b){this.setFeatureStyle(b.feature.id,a)},this),this},setFeatureStyle:function(a,b){var c=this._layers[a];"function"==typeof b&&(b=b(c.feature)),c.setStyle&&c.setStyle(b)},bindPopup:function(a,b){this._popup=a,this._popupOptions=b;for(var c in this._layers){var d=this._layers[c],e=this._popup(d.feature,d);d.bindPopup(e,b)}return this},unbindPopup:function(){this._popup=!1;for(var a in this._layers){var b=this._layers[a];if(b.unbindPopup)b.unbindPopup();else if(b.getLayers){var c=b.getLayers();for(var d in c){var e=c[d];e.unbindPopup()}}}return this},eachFeature:function(a,b){for(var c in this._layers)a.call(b,this._layers[c]);return this},getFeature:function(a){return this._layers[a]},_propagateEvent:function(a){a.layer=this._layers[this._leafletIds[a.target._leaflet_id]],a.target=this,this.fire(a.type,a)}}),EsriLeaflet.FeatureLayer=EsriLeaflet.Layers.FeatureLayer,EsriLeaflet.Layers.featureLayer=function(a,b){return new EsriLeaflet.Layers.FeatureLayer(a,b)},EsriLeaflet.featureLayer=function(a,b){return new EsriLeaflet.Layers.FeatureLayer(a,b)},EsriLeaflet.Controls.Logo=L.Control.extend({options:{position:"bottomright",marginTop:0,marginLeft:0,marginBottom:0,marginRight:0},onAdd:function(){var a=L.DomUtil.create("div","esri-leaflet-logo");return a.style.marginTop=this.options.marginTop,a.style.marginLeft=this.options.marginLeft,a.style.marginBottom=this.options.marginBottom,a.style.marginRight=this.options.marginRight,a.innerHTML='<a href="https://developers.arcgis.com" style="border: none;"><img src="http://js.arcgis.com/3.10/js/esri/images/map/logo-med.png" style="border: none;"></a>',a}}),EsriLeaflet.Controls.logo=function(a){return new L.esri.Controls.Logo(a)};
//# sourceMappingURL=esri-leaflet.js.map
return EsriLeaflet;
}));
<html>
<head>
<meta charset=utf-8 />
<title>Air Pollution and Buildings</title>
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css">
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script src="OSMBuildings-Leaflet.js"></script>
<script src="esri-leaflet.js"></script>
</head>
<style>
body {margin:0;padding:0;}
#map {position: absolute;top:0;bottom:0;right:0;left:0;}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map = new L.Map('map').setView([51.507351, -0.127758], 15);
new L.TileLayer('http://api.tiles.mapbox.com/v4/therealjimshady.lehn5oj4/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoidGhlcmVhbGppbXNoYWR5IiwiYSI6InMxQzVRMmcifQ.pYrnwj-vP4-oLByGHu6RvA',
{ attribution: 'Map tiles &copy; <a href="http://mapbox.com">MapBox</a>', maxZoom: 17 }).addTo(map);
L.esri.dynamicMapLayer('http://webgis.erg.kcl.ac.uk/ArcGIS/rest/services/NO2now/MapServer', {
opacity: 0.9
}).bringToBack().addTo(map);
new OSMBuildings(map).load();
osmb.style({ color:'rgb(0, 0, 0)'});
</script>
</body>
</html>
(function(aa){function T(b,a){var c=b.x-a.x,d=b.y-a.y;return c*c+d*d}function wa(b){var a=b.length;if(16>a)return!1;var c,d=Infinity,f=-Infinity,h=Infinity,g=-Infinity;for(c=0;c<a-1;c+=2)d=Math.min(d,b[c]),f=Math.max(f,b[c]),h=Math.min(h,b[c+1]),g=Math.max(g,b[c+1]);c=f-d;g-=h;f=c/g;if(0.85>f||1.15<f)return!1;d={x:d+c/2,y:h+g/2};c=(c+g)/4;h=c*c;for(c=0;c<a-1;c+=2)if(g=T({x:b[c],y:b[c+1]},d),0.8>g/h||1.2<g/h)return!1;return!0}function ka(b,a){var c={};b/=U;a/=U;var d=xa,f;f=0>=a?90:1<=a?-90:(2*ya(za(F*
(1-2*a)))-J)/F*180;c[d]=f;c[Aa]=360*(1===b?1:(b%1+1)%1)-180;return c}function da(b,a){var c=V(1,K(0,0.5-Ba(la(Ca+J*b/180))/F/2));return{x:(a/360+0.5)*U<<0,y:c*U<<0}}function W(b){for(var a=D+q,c=B+n,d=0,f=b.length-3;d<f;d+=2)if(b[d]>q&&b[d]<a&&b[d+1]>n&&b[d+1]<c)return!0;return!1}function Da(){M||(M=setInterval(function(){for(var b=C.items,a=!1,c=0,d=b.length;c<d;c++)1>b[c].scale&&(b[c].scale+=0.1,1<b[c].scale&&(b[c].scale=1),a=!0);x.render();a||(clearInterval(M),M=null)},33))}function ea(b){N=X+
b.x;O=B+b.y;x.render(!0)}function ma(b){D=b.width;B=b.height;X=D/2<<0;fa=B/2<<0;N=X;O=B;x.setSize(D,B);ga=t-50}function na(b){z=b;U=Ea<<z;b=ka(q+X,n+fa);var a=da(b.latitude,0);oa=da(b.latitude,1).x-a.x;E=pa(0.95,z-G);ha=""+H.alpha(E);ba=""+ca.alpha(E);Y=""+P.alpha(E)}var v=Math,za=v.exp,Ba=v.log,Fa=v.sin,Ga=v.cos,la=v.tan,ya=v.atan,Q=v.atan2,V=v.min,K=v.max,qa=v.sqrt,ra=v.ceil,pa=v.pow,ia=document,sa=sa||Array,ta=ta||Array,v=/iP(ad|hone|od)/g.test(navigator.userAgent),r=!!~navigator.userAgent.indexOf("Trident"),
Ha=!aa.requestAnimationFrame||v||r?function(b){b()}:aa.requestAnimationFrame,I=function(b){function a(a,b,c){0>c&&(c+=1);1<c&&(c-=1);return c<1/6?a+6*(b-a)*c:0.5>c?b:c<2/3?a+(b-a)*(2/3-c)*6:a}var c={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",grey:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",orange:"#ffa500",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00"},d=function(a,b,
c,d){this.H=a;this.S=b;this.L=c;this.A=d};d.parse=function(a){var b=0,g=0,e=0,k=1,l;a=(""+a).toLowerCase();a=c[a]||a;if(l=a.match(/^#(\w{2})(\w{2})(\w{2})$/))b=parseInt(l[1],16),g=parseInt(l[2],16),e=parseInt(l[3],16);else if(l=a.match(/rgba?\((\d+)\D+(\d+)\D+(\d+)(\D+([\d.]+))?\)/))b=parseInt(l[1],10),g=parseInt(l[2],10),e=parseInt(l[3],10),k=l[4]?parseFloat(l[5]):1;else return;b/=255;g/=255;e/=255;a=Math.max(b,g,e);var m=Math.min(b,g,e),p;l=(a+m)/2;var y=a-m;if(y){m=0.5<l?y/(2-a-m):y/(a+m);switch(a){case b:p=
(g-e)/y+(g<e?6:0);break;case g:p=(e-b)/y+2;break;case e:p=(b-g)/y+4}p*=60}else p=m=0;return new d(p,m,l,k)};d.prototype={toRGBA:function(){var b=Math.min(360,Math.max(0,this.H)),c=Math.min(1,Math.max(0,this.S)),d=Math.min(1,Math.max(0,this.L)),e=Math.min(1,Math.max(0,this.A)),k;if(0===c)b=k=c=d;else{var l=0.5>d?d*(1+c):d+c-d*c,d=2*d-l,b=b/360,c=a(d,l,b+1/3);k=a(d,l,b);b=a(d,l,b-1/3)}return{r:Math.round(255*c),g:Math.round(255*k),b:Math.round(255*b),a:e}},toString:function(){var a=this.toRGBA();return 1===
a.a?"#"+(16777216+(a.r<<16)+(a.g<<8)+a.b).toString(16).slice(1,7):"rgba("+[a.r,a.g,a.b,a.a.toFixed(2)].join()+")"},hue:function(a){return new d(this.H*a,this.S,this.L,this.A)},saturation:function(a){return new d(this.H,this.S*a,this.L,this.A)},lightness:function(a){return new d(this.H,this.S,this.L*a,this.A)},alpha:function(a){return new d(this.H,this.S,this.L,this.A*a)}};return d}(this),Ia=function(){var b=Math,a=b.PI,c=b.sin,d=b.cos,f=b.tan,h=b.asin,g=b.atan2,e=a/180,k=23.4397*e;return function(b,
m,p){p=e*-p;m*=e;b=b.valueOf()/864E5-0.5+2440588-2451545;var y=e*(357.5291+0.98560028*b),w;w=e*(1.9148*c(y)+0.02*c(2*y)+3E-4*c(3*y));w=y+w+102.9372*e+a;y=h(c(0)*d(k)+d(0)*c(k)*c(w));w=g(c(w)*d(k)-f(0)*c(k),d(w));b=e*(280.16+360.9856235*b)-p-w;p=h(c(m)*c(y)+d(m)*d(y)*d(b));m=g(c(b),d(b)*c(m)-f(y)*d(m));return{altitude:p,azimuth:m-a/2}}}(),Ka=function(){function b(a){a=a.toLowerCase();return"#"===a[0]?a:c[d[a]||a]||null}function a(b){var c,d,e=[],k;switch(b.type){case "GeometryCollection":e=[];c=0;
for(d=b.geometries.length;c<d;c++)(k=a(b.geometries[c]))&&e.push.apply(e,k);return e;case "MultiPolygon":e=[];c=0;for(d=b.coordinates.length;c<d;c++)(k=a({type:"Polygon",coordinates:b.coordinates[c]}))&&e.push.apply(e,k);return e;case "Polygon":b=b.coordinates;break;default:return[]}var l,m=[],p=[];l=b[0];c=0;for(d=l.length;c<d;c++)m.push(l[c][1],l[c][0]);c=0;for(d=b.length-1;c<d;c++)for(l=b[c+1],p[c]=[],e=0,k=l.length;e<k;e++)p[c].push(l[e][1],l[e][0]);return[{outer:m,inner:p.length?p:null}]}var c=
{brick:"#cc7755",bronze:"#ffeecc",canvas:"#fff8f0",concrete:"#999999",copper:"#a0e0d0",glass:"#e8f8f8",gold:"#ffcc00",plants:"#009933",metal:"#aaaaaa",panel:"#fff8f0",plaster:"#999999",roof_tiles:"#f08060",silver:"#cccccc",slate:"#666666",stone:"#996666",tar_paper:"#333333",wood:"#deb887"},d={asphalt:"tar_paper",bitumen:"tar_paper",block:"stone",bricks:"brick",glas:"glass",glassfront:"glass",grass:"plants",masonry:"stone",granite:"stone",panels:"panel",paving_stones:"stone",plastered:"plaster",rooftiles:"roof_tiles",
roofingfelt:"tar_paper",sandstone:"stone",sheet:"canvas",sheets:"canvas",shingle:"tar_paper",shingles:"tar_paper",slates:"slate",steel:"metal",tar:"tar_paper",tent:"canvas",thatch:"plants",tile:"roof_tiles",tiles:"roof_tiles"};return{read:function(c){if(!c||"FeatureCollection"!==c.type)return[];c=c.features;var d,g,e,k,l=[],m,p,y,w;d=0;for(g=c.length;d<g;d++)if(m=c[d],"Feature"===m.type&&!1!==ua(m)){e=m.properties;k={};e=e||{};k.height=e.height||(e.levels?3*e.levels:Ja);k.minHeight=e.minHeight||(e.minLevel?
3*e.minLevel:0);if(p=e.material?b(e.material):e.wallColor||e.color)k.wallColor=p;if(p=e.roofMaterial?b(e.roofMaterial):e.roofColor)k.roofColor=p;switch(e.shape){case "cylinder":case "cone":case "dome":case "sphere":k.shape=e.shape;k.isRotational=!0;break;case "pyramid":k.shape=e.shape}switch(e.roofShape){case "cone":case "dome":k.roofShape=e.roofShape;k.isRotational=!0;break;case "pyramid":k.roofShape=e.roofShape}k.roofShape&&e.roofHeight?(k.roofHeight=e.roofHeight,k.height=K(0,k.height-k.roofHeight)):
k.roofHeight=0;y=k;p=a(m.geometry);e=0;for(k=p.length;e<k;e++){w=y;var q={},n=void 0;for(n in w)w.hasOwnProperty(n)&&(q[n]=w[n]);w=q;w.footprint=p[e].outer;if(w.isRotational){for(var q=w,n=w.footprint,t=180,r=-180,u=0,s=n.length;u<s;u+=2)t=V(t,n[u+1]),r=K(r,n[u+1]);q.radius=(r-t)/2}p[e].inner&&(w.holes=p[e].inner);if(m.id||m.properties.id)w.id=m.id||m.properties.id;m.properties.relationId&&(w.relationId=m.properties.relationId);l.push(w)}}return l}}}(),F=Math.PI,J=F/2,Ca=F/4,Ea=256,z,U,G=15,xa="latitude",
Aa="longitude",D=0,B=0,X=0,fa=0,q=0,n=0,H=I.parse("rgba(200, 190, 180)"),ca=H.lightness(0.8),P=H.lightness(1.2),ha=""+H,ba=""+ca,Y=""+P,oa=0,E=1,ga,Ja=5,N,O,t=450,R,La=function(){function b(a,b){if(f[a])b&&b(f[a]);else{var c=new XMLHttpRequest;c.onreadystatechange=function(){if(4===c.readyState&&c.status&&!(200>c.status||299<c.status)&&b&&c.responseText){var d;try{d=JSON.parse(c.responseText)}catch(k){}f[a]=d;h.push({url:a,size:c.responseText.length});for(g+=c.responseText.length;g>e;){var n=h.shift();
g-=n.size;delete f[n.url]}b(d)}};c.open("GET",a);c.send(null);return c}}function a(a,b){var c=a.x-b.x,d=a.y-b.y;return c*c+d*d}function c(a){a=a||{};d+=a.key||"anonymous";e=a.cacheSize||1048576}var d="http://data.osmbuildings.org/0.2/",f={},h=[],g=0,e=0;c.TILE_SIZE=256;c.ATTRIBUTION='Data Service &copy; <a href="http://bld.gs">BLD.GS</a>';var k=c.prototype;k.getTile=function(a,c,e,f){return b(d+"/tile/"+e+"/"+a+"/"+c+".json",f)};k.getFeature=function(a,c){return b(d+"/feature/"+a+".json",c)};k.getBBox=
function(a,c){var e=d+"/bbox.json?bbox="+[a.n.toFixed(5),a.e.toFixed(5),a.s.toFixed(5),a.w.toFixed(5)].join();return b(e,c)};k.getAllTiles=function(b,d,e,f,g,h){var k=c.TILE_SIZE,n=16<g?k<<g-16:k>>16-g;g=b/n<<0;var q=d/n<<0,t=Math.ceil((b+e)/n),n=Math.ceil((d+f)/n),u,r=[];for(u=q;u<=n;u++)for(q=g;q<=t;q++)r.push({x:q,y:u,z:16});var s={x:b+(e-k)/2,y:d+(f-k)/2};r.sort(function(b,c){return a(b,s)-a(c,s)});b=0;for(d=r.length;b<d;b++)this.getTile(r[b].x,r[b].y,r[b].z,h);return{abort:function(){for(var a=
0;a<r.length;a++)r[a].abort()}}};return c}(),C={loadedItems:{},items:[],getPixelFootprint:function(b){for(var a=new sa(b.length),c,d=0,f=b.length-1;d<f;d+=2)c=da(b[d],b[d+1]),a[d]=c.x,a[d+1]=c.y;b=a;a=b.length/2;c=new ta(a);var d=0,f=a-1,h,g,e,k,l=[],m=[],p=[];for(c[d]=c[f]=1;f;){g=0;for(h=d+1;h<f;h++){e=b[2*h];var n=b[2*h+1],q=b[2*d],r=b[2*d+1],t=b[2*f],u=b[2*f+1],s=t-q,v=u-r,x=void 0;if(0!==s||0!==v)x=((e-q)*s+(n-r)*v)/(s*s+v*v),1<x?(q=t,r=u):0<x&&(q+=s*x,r+=v*x);s=e-q;v=n-r;e=s*s+v*v;e>g&&(k=h,
g=e)}2<g&&(c[k]=1,l.push(d),m.push(k),l.push(k),m.push(f));d=l.pop();f=m.pop()}for(h=0;h<a;h++)c[h]&&p.push(b[2*h],b[2*h+1]);a=p;if(!(8>a.length))return a},resetItems:function(){this.items=[];this.loadedItems={};Z.reset()},addRenderItems:function(b,a){for(var c,d,f,h=Ka.read(b),g=0,e=h.length;g<e;g++)c=h[g],f=c.id||[c.footprint[0],c.footprint[1],c.height,c.minHeight].join(),!this.loadedItems[f]&&(d=this.scale(c))&&(d.scale=a?0:1,this.items.push(d),this.loadedItems[f]=1);Da()},scale:function(b){var a=
{},c=6/pa(2,z-G);b.id&&(a.id=b.id);a.height=V(b.height/c,ga);a.minHeight=isNaN(b.minHeight)?0:b.minHeight/c;if(!(a.minHeight>ga)&&(a.footprint=this.getPixelFootprint(b.footprint),a.footprint)){for(var d=a.footprint,f=Infinity,h=-Infinity,g=Infinity,e=-Infinity,k=0,l=d.length-3;k<l;k+=2)f=V(f,d[k]),h=K(h,d[k]),g=V(g,d[k+1]),e=K(e,d[k+1]);a.center={x:f+(h-f)/2<<0,y:g+(e-g)/2<<0};b.radius&&(a.radius=b.radius*oa);b.shape&&(a.shape=b.shape);b.roofShape&&(a.roofShape=b.roofShape);"cone"!==a.roofShape&&
"dome"!==a.roofShape||a.shape||!wa(a.footprint)||(a.shape="cylinder");if(b.holes){a.holes=[];for(var m,d=0,f=b.holes.length;d<f;d++)(m=this.getPixelFootprint(b.holes[d]))&&a.holes.push(m)}var p;b.wallColor&&(p=I.parse(b.wallColor))&&(p=p.alpha(E),a.altColor=""+p.lightness(0.8),a.wallColor=""+p);b.roofColor&&(p=I.parse(b.roofColor))&&(a.roofColor=""+p.alpha(E));b.relationId&&(a.relationId=b.relationId);a.hitColor=Z.idToColor(b.relationId||b.id);a.roofHeight=isNaN(b.roofHeight)?0:b.roofHeight/c;if(!(a.height+
a.roofHeight<=a.minHeight))return a}},set:function(b){this.isStatic=!0;this.resetItems();this._staticData=b;this.addRenderItems(this._staticData,!0)},load:function(b){this.provider=b||new La({key:"rkc8ywdl"});this.update()},update:function(){function b(a){g.addRenderItems(a)}this.resetItems();if(!(z<G))if(this.isStatic&&this._staticData)this.addRenderItems(this._staticData);else if(this.provider){var a=16<z?256<<z-16:256>>16-z,c=q/a<<0,d=n/a<<0,f=ra((q+D)/a),a=ra((n+B)/a),h,g=this;for(h=d;h<=a;h++)for(d=
c;d<=f;d++)this.provider.getTile(d,h,16,b)}}},$={draw:function(b,a,c,d,f,h,g,e){var k,l=this._extrude(b,a,d,f,h,g),m=[];if(c)for(a=0,k=c.length;a<k;a++)m[a]=this._extrude(b,c[a],d,f,h,g);b.fillStyle=e;b.beginPath();this._ring(b,l);if(c)for(a=0,k=m.length;a<k;a++)this._ring(b,m[a]);b.closePath();b.stroke();b.fill()},_extrude:function(b,a,c,d,f,h){c=t/(t-c);for(var g=t/(t-d),e={x:0,y:0},k={x:0,y:0},l,m,p=[],r=0,s=a.length-3;r<s;r+=2)e.x=a[r]-q,e.y=a[r+1]-n,k.x=a[r+2]-q,k.y=a[r+3]-n,l=u.project(e,c),
m=u.project(k,c),d&&(e=u.project(e,g),k=u.project(k,g)),(k.x-e.x)*(l.y-e.y)>(l.x-e.x)*(k.y-e.y)&&(b.fillStyle=e.x<k.x&&e.y<k.y||e.x>k.x&&e.y>k.y?h:f,b.beginPath(),this._ring(b,[k.x,k.y,e.x,e.y,l.x,l.y,m.x,m.y]),b.closePath(),b.fill()),p[r]=l.x,p[r+1]=l.y;return p},_ring:function(b,a){b.moveTo(a[0],a[1]);for(var c=2,d=a.length-1;c<d;c+=2)b.lineTo(a[c],a[c+1])},simplified:function(b,a,c){b.beginPath();this._ringAbs(b,a);if(c){a=0;for(var d=c.length;a<d;a++)this._ringAbs(b,c[a])}b.closePath();b.stroke();
b.fill()},_ringAbs:function(b,a){b.moveTo(a[0]-q,a[1]-n);for(var c=2,d=a.length-1;c<d;c+=2)b.lineTo(a[c]-q,a[c+1]-n)},shadow:function(b,a,c,d,f){for(var h=null,g={x:0,y:0},e={x:0,y:0},k,l,m=0,p=a.length-3;m<p;m+=2)g.x=a[m]-q,g.y=a[m+1]-n,e.x=a[m+2]-q,e.y=a[m+3]-n,k=A.project(g,d),l=A.project(e,d),f&&(g=A.project(g,f),e=A.project(e,f)),(e.x-g.x)*(k.y-g.y)>(k.x-g.x)*(e.y-g.y)?(1===h&&b.lineTo(g.x,g.y),h=0,m||b.moveTo(g.x,g.y),b.lineTo(e.x,e.y)):(0===h&&b.lineTo(k.x,k.y),h=1,m||b.moveTo(k.x,k.y),b.lineTo(l.x,
l.y));if(c)for(m=0,p=c.length;m<p;m++)this._ringAbs(b,c[m])},shadowMask:function(b,a,c){this._ringAbs(b,a);if(c){a=0;for(var d=c.length;a<d;a++)this._ringAbs(b,c[a])}},hitArea:function(b,a,c,d,f,h){c=null;var g={x:0,y:0},e={x:0,y:0};d=t/(t-d);var k=t/(t-f),l;b.fillStyle=h;b.beginPath();for(var m=0,p=a.length-3;m<p;m+=2)g.x=a[m]-q,g.y=a[m+1]-n,e.x=a[m+2]-q,e.y=a[m+3]-n,h=u.project(g,d),l=u.project(e,d),f&&(g=u.project(g,k),e=u.project(e,k)),(e.x-g.x)*(h.y-g.y)>(h.x-g.x)*(e.y-g.y)?(1===c&&b.lineTo(g.x,
g.y),c=0,m||b.moveTo(g.x,g.y),b.lineTo(e.x,e.y)):(0===c&&b.lineTo(h.x,h.y),c=1,m||b.moveTo(h.x,h.y),b.lineTo(l.x,l.y));b.closePath();b.fill()}},s={draw:function(b,a,c,d,f,h,g,e,k){a={x:a.x-q,y:a.y-n};var l=t/(t-f),m=t/(t-h);f=u.project(a,l);d*=l;h&&(a=u.project(a,m),c*=m);(l=this._tangents(a,c,f,d))?(h=Q(l[0].y1-a.y,l[0].x1-a.x),l=Q(l[1].y1-a.y,l[1].x1-a.x)):(h=1.5*F,l=1.5*F);b.fillStyle=g;b.beginPath();b.arc(f.x,f.y,d,J,h,!0);b.arc(a.x,a.y,c,h,J);b.closePath();b.fill();b.fillStyle=e;b.beginPath();
b.arc(f.x,f.y,d,l,J,!0);b.arc(a.x,a.y,c,J,l);b.closePath();b.fill();b.fillStyle=k;this._circle(b,f,d)},simplified:function(b,a,c){this._circle(b,{x:a.x-q,y:a.y-n},c)},shadow:function(b,a,c,d,f,h){a={x:a.x-q,y:a.y-n};f=A.project(a,f);var g;h&&(a=A.project(a,h));var e=this._tangents(a,c,f,d);e?(h=Q(e[0].y1-a.y,e[0].x1-a.x),g=Q(e[1].y1-a.y,e[1].x1-a.x),b.moveTo(e[1].x2,e[1].y2),b.arc(f.x,f.y,d,g,h),b.arc(a.x,a.y,c,h,g)):(b.moveTo(a.x+c,a.y),b.arc(a.x,a.y,c,0,2*F))},shadowMask:function(b,a,c){var d=a.x-
q;a=a.y-n;b.moveTo(d+c,a);b.arc(d,a,c,0,2*F)},hitArea:function(b,a,c,d,f,h,g){a={x:a.x-q,y:a.y-n};var e=t/(t-f),k=t/(t-h);f=u.project(a,e);d*=e;h&&(a=u.project(a,k),c*=k);h=this._tangents(a,c,f,d);b.fillStyle=g;b.beginPath();h?(g=Q(h[0].y1-a.y,h[0].x1-a.x),e=Q(h[1].y1-a.y,h[1].x1-a.x),b.moveTo(h[1].x2,h[1].y2),b.arc(f.x,f.y,d,e,g),b.arc(a.x,a.y,c,g,e)):(b.moveTo(a.x+c,a.y),b.arc(a.x,a.y,c,0,2*F));b.closePath();b.fill()},_circle:function(b,a,c){b.beginPath();b.arc(a.x,a.y,c,0,2*F);b.stroke();b.fill()},
_tangents:function(b,a,c,d){var f=b.x-c.x,h=b.y-c.y,g=a-d,e=f*f+h*h;if(!(e<=g*g)){var e=qa(e),f=-f/e,h=-h/e,g=g/e,e=[],k,l,m;k=qa(K(0,1-g*g));for(var p=1;-1<=p;p-=2)l=f*g-p*k*h,m=h*g+p*k*f,e.push({x1:b.x+a*l<<0,y1:b.y+a*m<<0,x2:c.x+d*l<<0,y2:c.y+d*m<<0});return e}}},S={draw:function(b,a,c,d,f,h,g){var e=t/(t-f);c=u.project({x:c.x-q,y:c.y-n},t/(t-d));d={x:0,y:0};for(var k={x:0,y:0},l=0,m=a.length-3;l<m;l+=2)d.x=a[l]-q,d.y=a[l+1]-n,k.x=a[l+2]-q,k.y=a[l+3]-n,f&&(d=u.project(d,e),k=u.project(k,e)),(k.x-
d.x)*(c.y-d.y)>(c.x-d.x)*(k.y-d.y)&&(b.fillStyle=d.x<k.x&&d.y<k.y||d.x>k.x&&d.y>k.y?g:h,b.beginPath(),this._triangle(b,d,k,c),b.closePath(),b.fill())},_triangle:function(b,a,c,d){b.moveTo(a.x,a.y);b.lineTo(c.x,c.y);b.lineTo(d.x,d.y)},_ring:function(b,a){b.moveTo(a[0]-q,a[1]-n);for(var c=2,d=a.length-1;c<d;c+=2)b.lineTo(a[c]-q,a[c+1]-n)},shadow:function(b,a,c,d,f){var h={x:0,y:0},g={x:0,y:0};c=A.project({x:c.x-q,y:c.y-n},d);d=0;for(var e=a.length-3;d<e;d+=2)h.x=a[d]-q,h.y=a[d+1]-n,g.x=a[d+2]-q,g.y=
a[d+3]-n,f&&(h=A.project(h,f),g=A.project(g,f)),(g.x-h.x)*(c.y-h.y)>(c.x-h.x)*(g.y-h.y)&&this._triangle(b,h,g,c)},shadowMask:function(b,a){this._ring(b,a)},hitArea:function(b,a,c,d,f,h){var g=t/(t-f);c=u.project({x:c.x-q,y:c.y-n},t/(t-d));d={x:0,y:0};var e={x:0,y:0};b.fillStyle=h;b.beginPath();h=0;for(var k=a.length-3;h<k;h+=2)d.x=a[h]-q,d.y=a[h+1]-n,e.x=a[h+2]-q,e.y=a[h+3]-n,f&&(d=u.project(d,g),e=u.project(e,g)),(e.x-d.x)*(c.y-d.y)>(c.x-d.x)*(e.y-d.y)&&this._triangle(b,d,e,c);b.closePath();b.fill()}},
u={project:function(b,a){return{x:(b.x-N)*a+N<<0,y:(b.y-O)*a+O<<0}},render:function(){var b=this.context;b.clearRect(0,0,D,B);if(!(z<G||R)){var a,c,d,f={x:N+q,y:O+n},h,g,e,k,l=C.items;l.sort(function(a,b){return a.minHeight-b.minHeight||T(b.center,f)-T(a.center,f)||b.height-a.height});for(var m=0,p=l.length;m<p;m++)if(a=l[m],!ja.isSimple(a)&&(h=a.footprint,W(h))){c=1>a.scale?a.height*a.scale:a.height;d=0;a.minHeight&&(d=1>a.scale?a.minHeight*a.scale:a.minHeight);g=a.wallColor||ha;e=a.altColor||ba;
k=a.roofColor||Y;b.strokeStyle=e;switch(a.shape){case "cylinder":s.draw(b,a.center,a.radius,a.radius,c,d,g,e,k);break;case "cone":s.draw(b,a.center,a.radius,0,c,d,g,e);break;case "dome":s.draw(b,a.center,a.radius,a.radius/2,c,d,g,e);break;case "sphere":s.draw(b,a.center,a.radius,a.radius,c,d,g,e,k);break;case "pyramid":S.draw(b,h,a.center,c,d,g,e);break;default:$.draw(b,h,a.holes,c,d,g,e,k)}switch(a.roofShape){case "cone":s.draw(b,a.center,a.radius,0,c+a.roofHeight,c,k,""+I.parse(k).lightness(0.9));
break;case "dome":s.draw(b,a.center,a.radius,a.radius/2,c+a.roofHeight,c,k,""+I.parse(k).lightness(0.9));break;case "pyramid":S.draw(b,h,a.center,c+a.roofHeight,c,k,I.parse(k).lightness(0.9))}}}}},ja={maxZoom:G+2,maxHeight:5,isSimple:function(b){return z<=this.maxZoom&&b.height+b.roofHeight<this.maxHeight},render:function(){var b=this.context;b.clearRect(0,0,D,B);if(!(z<G||R||z>this.maxZoom))for(var a,c,d=C.items,f=0,h=d.length;f<h;f++)if(a=d[f],!(a.height>=this.maxHeight)&&(c=a.footprint,W(c)))switch(b.strokeStyle=
a.altColor||ba,b.fillStyle=a.roofColor||Y,a.shape){case "cylinder":case "cone":case "dome":case "sphere":s.simplified(b,a.center,a.radius);break;default:$.simplified(b,c,a.holes)}}},A={enabled:!0,color:"#666666",blurColor:"#000000",blurSize:15,date:new Date,direction:{x:0,y:0},project:function(b,a){return{x:b.x+this.direction.x*a,y:b.y+this.direction.y*a}},render:function(){var b=this.context,a,c,d;b.clearRect(0,0,D,B);if(!(!this.enabled||z<G||R||(a=ka(X+q,fa+n),a=Ia(this.date,a.latitude,a.longitude),
0>=a.altitude))){c=1/la(a.altitude);d=5>c?0.75:1/c*5;this.direction.x=Ga(a.azimuth)*c;this.direction.y=Fa(a.azimuth)*c;var f,h,g,e;a=C.items;b.canvas.style.opacity=d/(2*E);b.shadowColor=this.blurColor;b.shadowBlur=E/2*this.blurSize;b.fillStyle=this.color;b.beginPath();d=0;for(c=a.length;d<c;d++)if(f=a[d],e=f.footprint,W(e)){h=1>f.scale?f.height*f.scale:f.height;g=0;f.minHeight&&(g=1>f.scale?f.minHeight*f.scale:f.minHeight);switch(f.shape){case "cylinder":s.shadow(b,f.center,f.radius,f.radius,h,g);
break;case "cone":s.shadow(b,f.center,f.radius,0,h,g);break;case "dome":s.shadow(b,f.center,f.radius,f.radius/2,h,g);break;case "sphere":s.shadow(b,f.center,f.radius,f.radius,h,g);break;case "pyramid":S.shadow(b,e,f.center,h,g);break;default:$.shadow(b,e,f.holes,h,g)}switch(f.roofShape){case "cone":s.shadow(b,f.center,f.radius,0,h+f.roofHeight,h);break;case "dome":s.shadow(b,f.center,f.radius,f.radius/2,h+f.roofHeight,h);break;case "pyramid":S.shadow(b,e,f.center,h+f.roofHeight,h)}}b.closePath();
b.fill();b.shadowBlur=null;b.globalCompositeOperation="destination-out";b.beginPath();d=0;for(c=a.length;d<c;d++)if(f=a[d],e=f.footprint,W(e)&&!f.minHeight)switch(f.shape){case "cylinder":case "cone":case "dome":s.shadowMask(b,f.center,f.radius);break;default:$.shadowMask(b,e,f.holes)}b.fillStyle="#00ff00";b.fill();b.globalCompositeOperation="source-over"}}},Z={_idMapping:[null],reset:function(){this._idMapping=[null]},render:function(){if(!this._timer){var b=this;this._timer=setTimeout(function(){b._timer=
null;b._render()},500)}},_render:function(){var b=this.context;b.clearRect(0,0,D,B);if(!(z<G||R)){var a,c,d,f={x:N+q,y:O+n},h,g,e=C.items;e.sort(function(a,b){return a.minHeight-b.minHeight||T(b.center,f)-T(a.center,f)||b.height-a.height});for(var k=0,l=e.length;k<l;k++)if(a=e[k],g=a.hitColor)if(h=a.footprint,W(h)){c=a.height;d=0;a.minHeight&&(d=a.minHeight);switch(a.shape){case "cylinder":s.hitArea(b,a.center,a.radius,a.radius,c,d,g);break;case "cone":s.hitArea(b,a.center,a.radius,0,c,d,g);break;
case "dome":s.hitArea(b,a.center,a.radius,a.radius/2,c,d,g);break;case "sphere":s.hitArea(b,a.center,a.radius,a.radius,c,d,g);break;case "pyramid":S.hitArea(b,h,a.center,c,d,g);break;default:$.hitArea(b,h,a.holes,c,d,g)}switch(a.roofShape){case "cone":s.hitArea(b,a.center,a.radius,0,c+a.roofHeight,c,g);break;case "dome":s.hitArea(b,a.center,a.radius,a.radius/2,c+a.roofHeight,c,g);break;case "pyramid":S.hitArea(b,h,a.center,c+a.roofHeight,c,g)}}this._imageData=this.context.getImageData(0,0,D,B).data}},
getIdFromXY:function(b,a){var c=this._imageData;if(c){var d=4*((a|0)*D+(b|0));return this._idMapping[c[d]|c[d+1]<<8|c[d+2]<<16]}},idToColor:function(b){var a=this._idMapping.indexOf(b);-1===a&&(this._idMapping.push(b),a=this._idMapping.length-1);return"rgb("+[a&255,a>>8&255,a>>16&255].join()+")"}},M,x={container:ia.createElement("DIV"),items:[],init:function(){this.container.style.pointerEvents="none";this.container.style.position="absolute";this.container.style.left=0;this.container.style.top=0;
A.context=this.createContext(this.container);ja.context=this.createContext(this.container);u.context=this.createContext(this.container);Z.context=this.createContext()},render:function(b){Ha(function(){b||(A.render(),ja.render(),Z.render());u.render()})},createContext:function(b){var a=ia.createElement("CANVAS");a.style.webkitTransform="translate3d(0,0,0)";a.style.imageRendering="optimizeSpeed";a.style.position="absolute";a.style.left=0;a.style.top=0;var c=a.getContext("2d");c.lineCap="round";c.lineJoin=
"round";c.lineWidth=1;c.mozImageSmoothingEnabled=!1;c.webkitImageSmoothingEnabled=!1;this.items.push(a);b&&b.appendChild(a);return c},appendTo:function(b){b.appendChild(this.container)},remove:function(){this.container.parentNode.removeChild(this.container)},setSize:function(b,a){for(var c=0,d=this.items.length;c<d;c++)this.items[c].width=b,this.items[c].height=a},screenshot:function(){var b=ia.createElement("CANVAS"),a=b.getContext("2d"),c,d,f;b.width=D;b.height=B;clearInterval(M);M=null;f=C.items;
c=0;for(d=f.length;c<d;c++)f[c].scale=1;this.render(!0);c=0;for(d=this.items.length;c<d;c++)f=this.items[c],""!==f.style.opacity&&(a.globalAlpha=parseFloat(f.style.opacity)),a.drawImage(f,0,0),a.globalAlpha=1;return b.toDataURL("image/png")},setPosition:function(b,a){this.container.style.left=b+"px";this.container.style.top=a+"px"}};x.init();v=function(b){this.offset={x:0,y:0};b.addLayer(this)};r=v.prototype=L.Layer?new L.Layer:{};r.onAdd=function(b){this.map=b;x.appendTo(b._panes.overlayPane);var a=
this.getOffset(),c=b.getPixelOrigin();ma({width:b._size.x,height:b._size.y});var d=c.y-a.y;q=c.x-a.x;n=d;na(b._zoom);x.setPosition(-a.x,-a.y);b.on({move:this.onMove,moveend:this.onMoveEnd,zoomstart:this.onZoomStart,zoomend:this.onZoomEnd,resize:this.onResize,viewreset:this.onViewReset,click:this.onClick},this);if(b.options.zoomAnimation)b.on("zoomanim",this.onZoom,this);b.attributionControl&&b.attributionControl.addAttribution('&copy; <a href="http://osmbuildings.org">OSM Buildings</a>');C.update()};
r.onRemove=function(){var b=this.map;b.attributionControl&&b.attributionControl.removeAttribution('&copy; <a href="http://osmbuildings.org">OSM Buildings</a>');b.off({move:this.onMove,moveend:this.onMoveEnd,zoomstart:this.onZoomStart,zoomend:this.onZoomEnd,resize:this.onResize,viewreset:this.onViewReset,click:this.onClick},this);b.options.zoomAnimation&&b.off("zoomanim",this.onZoom,this);x.remove()};r.onMove=function(b){b=this.getOffset();ea({x:this.offset.x-b.x,y:this.offset.y-b.y})};r.onMoveEnd=
function(b){if(this.noMoveEnd)this.noMoveEnd=!1;else{var a=this.map;b=this.getOffset();var c=a.getPixelOrigin();this.offset=b;x.setPosition(-b.x,-b.y);ea({x:0,y:0});ma({width:a._size.x,height:a._size.y});a=c.y-b.y;q=c.x-b.x;n=a;x.render();C.update()}};r.onZoomStart=function(b){R=!0;x.render()};r.onZoom=function(b){};r.onZoomEnd=function(b){b=this.map;var a=this.getOffset(),c=b.getPixelOrigin(),d=c.y-a.y;q=c.x-a.x;n=d;b=b._zoom;R=!1;na(b);C.update();x.render();this.noMoveEnd=!0};r.onResize=function(){};
r.onViewReset=function(){var b=this.getOffset();this.offset=b;x.setPosition(-b.x,-b.y);ea({x:0,y:0})};r.onClick=function(b){var a=Z.getIdFromXY(b.containerPoint.x,b.containerPoint.y);a&&va({feature:a,lat:b.latlng.lat,lon:b.latlng.lng})};r.getOffset=function(){return L.DomUtil.getPosition(this.map._mapPane)};r.style=function(b){b=b||{};var a;if(a=b.color||b.wallColor)H=I.parse(a),ha=""+H.alpha(E),ca=H.lightness(0.8),ba=""+ca.alpha(E),P=H.lightness(1.2),Y=""+P.alpha(E);b.roofColor&&(P=I.parse(b.roofColor),
Y=""+P.alpha(E));void 0!==b.shadows&&(A.enabled=!!b.shadows);x.render();return this};r.date=function(b){A.date=b;A.render();return this};r.load=function(b){C.load(b);return this};r.set=function(b){C.set(b);return this};r.screenshot=function(b){var a=x.screenshot();b&&(aa.location.href=a.replace("image/png","image/octet-stream"));return a};var ua=function(){};r.each=function(b){ua=function(a){return b(a)};return this};var va=function(){};r.click=function(b){va=function(a){return b(a)};return this};
r.getDetails=function(b,a){C.provider&&C.provider.getFeature(b,a);return this};v.VERSION="0.2.2b";v.ATTRIBUTION='&copy; <a href="http://osmbuildings.org">OSM Buildings</a>';aa.OSMBuildings=v})(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment