New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

esri-leaflet-dynamic-tilelayer

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esri-leaflet-dynamic-tilelayer - npm Package Compare versions

Comparing version 0.7.3 to 0.7.31

78

dist/esri-leaflet-dynamic-tilelayer-src.js

@@ -24,5 +24,2 @@ (function (factory) {

/**
* @type {Array.<XmlHttpRequest>}
*/
_requests: [],

@@ -46,3 +43,3 @@

if (map.options.crs && map.options.crs.code) {
var sr = this._getSr(map.options.crs.code);
var sr = map.options.crs.code.split(':')[1];
this.options.bboxSR = sr;

@@ -57,11 +54,2 @@ this.options.imageSR = sr;

/**
* Could be WKT and at least possble to override
* @param {String} code
* @return {String}
*/
_getSr: function(code) {
return code.split(':')[1];
},
/**
* @param {L.Map} map

@@ -80,4 +68,4 @@ */

setLayers: function(layers) {
this._redraw();
return EsriLeaflet.Layers.DynamicMapLayer.prototype.setLayers.call(this, layers);
EsriLeaflet.Layers.DynamicMapLayer.prototype.setLayers.call(this, layers);
return this.redraw();
},

@@ -90,4 +78,4 @@

setLayerDefs: function(layerDefs) {
this._redraw();
return EsriLeaflet.Layers.DynamicMapLayer.prototype.setLayerDefs.call(this, layerDefs);
EsriLeaflet.Layers.DynamicMapLayer.prototype.setLayerDefs.call(this, layerDefs);
return this.redraw();
},

@@ -100,4 +88,4 @@

setTimeOptions: function(timeOptions) {
this._redraw();
return EsriLeaflet.Layers.DynamicMapLayer.prototype.setTimeOptions.call(this, timeOptions);
EsriLeaflet.Layers.DynamicMapLayer.prototype.setTimeOptions.call(this, timeOptions);
return this.redraw();
},

@@ -174,8 +162,4 @@

this.getTileUrl(tilePoint, function(err, url) {
if (err) {
this._tileOnError.call(tile);
} else {
tile.src = url;
}
}, tile);
tile.src = url;
});

@@ -191,5 +175,4 @@ this.fire('tileloadstart', {

* @param {Function} callback
* @param {Image} tile
*/
getTileUrl: function(tilePoint, callback) {
getTileUrl: function(tilePoint, callback) { // (Point, Number) -> String
var map = this._map,

@@ -201,6 +184,4 @@ tileSize = this.options.tileSize,

var bounds = new L.LatLngBounds(
map.unproject(nwPoint, tilePoint.z),
map.unproject(sePoint, tilePoint.z)
);
var bounds = new L.LatLngBounds(map.unproject(nwPoint, tilePoint.z),
map.unproject(sePoint, tilePoint.z));
var size = new L.Point(this.options.tileSize, this.options.tileSize);

@@ -221,7 +202,3 @@

this._requests.push(this._service.get('export', params, function(error, response) {
if (error) {
callback(error, response);
} else {
callback(null, response.href, bounds);
}
callback(null, response.href, bounds);
}, this));

@@ -234,8 +211,3 @@ } else {

/**
* Smooth redraw, see
* @see https://github.com/w8r/leaflet-wms-bgbuffer
* @return {EsriLeaflet.Layers.TiledDynamicMapLayer}
*/
_redraw: function() {
redraw: function() {
if (this._map) {

@@ -247,3 +219,2 @@ if (this.options.redrawBuffer) {

this._bgBuffer = front;
this._tiles = {};

@@ -253,18 +224,13 @@ this._tilesToLoad = 0;

} else {
L.TileLayer.prototype._reset.call(this, {
this._reset({
hard: true
});
}
this._update();
}
return this;
},
/**
* Override for old IE, just to have bg buffer for tiles
*/
_initContainer: function() {
this._animated = this._animated || this.options.redrawBuffer;
L.TileLayer.prototype._initContainer.call(this);
},
/**
* Bounds or params changed

@@ -308,6 +274,6 @@ */

// factory
EsriLeaflet.Layers.tiledDynamicMapLayer =
EsriLeaflet.tiledDynamicMapLayer = function(url, options) {
return new EsriLeaflet.Layers.TiledDynamicMapLayer(url, options);
};
EsriLeaflet.tiledDynamicMapLayer =
EsriLeaflet.Layers.tiledDynamicMapLayer = function(url, options) {
return new EsriLeaflet.Layers.TiledDynamicMapLayer(url, options);
};

@@ -314,0 +280,0 @@

@@ -18,3 +18,3 @@ (function (factory) {

EsriLeaflet.Layers.TiledDynamicMapLayer=L.TileLayer.extend({options:L.Util.extend({},EsriLeaflet.Layers.DynamicMapLayer.prototype.options,{redrawBuffer:!0}),_requests:[],initialize:function(a,b){L.TileLayer.prototype.initialize.call(this,a,b),EsriLeaflet.DynamicMapLayer.prototype.initialize.call(this,a,b)},onAdd:function(a){if(a.options.crs&&a.options.crs.code){var b=this._getSr(a.options.crs.code);this.options.bboxSR=b,this.options.imageSR=b}return a.on("zoomstart zoomend",this._onZoomChange,this),L.TileLayer.prototype.onAdd.call(this,a)},_getSr:function(a){return a.split(":")[1]},onRemove:function(a){a.off("zoomstart zoomend",this._onZoomChange,this),L.TileLayer.prototype.onRemove.call(this,a),EsriLeaflet.DynamicMapLayer.prototype.onRemove.call(this,a)},setLayers:function(a){return this._redraw(),EsriLeaflet.Layers.DynamicMapLayer.prototype.setLayers.call(this,a)},setLayerDefs:function(a){return this._redraw(),EsriLeaflet.Layers.DynamicMapLayer.prototype.setLayerDefs.call(this,a)},setTimeOptions:function(a){return this._redraw(),EsriLeaflet.Layers.DynamicMapLayer.prototype.setTimeOptions.call(this,a)},_onZoomChange:function(a){this._zooming="zoomstart"===a.type},_buildExportParams:function(a,b){var c=this._map.options.crs.project(a._northEast),d=this._map.options.crs.project(a._southWest),e=this._map.latLngToLayerPoint(a._northEast),f=this._map.latLngToLayerPoint(a._southWest);(e.y>0||f.y<b.y)&&(b.y=f.y-e.y);var g={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&&(g.layers="show:"+this.options.layers.join(",")),this.options.layerDefs&&(g.layerDefs=JSON.stringify(this.options.layerDefs)),this.options.timeOptions&&(g.timeOptions=JSON.stringify(this.options.timeOptions)),this.options.from&&this.options.to&&(g.time=this.options.from.valueOf()+","+this.options.to.valueOf()),this._service.options.token&&(g.token=this._service.options.token),g},_loadTile:function(a,b){a._layer=this,a.onload=this._tileOnLoad,a.onerror=this._tileOnError,this._adjustTilePoint(b),this.getTileUrl(b,function(b,c){b?this._tileOnError.call(a):a.src=c},a),this.fire("tileloadstart",{tile:a})},getTileUrl:function(a,b){var c=this._map,d=this.options.tileSize,e=a.multiplyBy(d),f=e.add([d,d]),g=new L.LatLngBounds(c.unproject(e,a.z),c.unproject(f,a.z)),h=new L.Point(this.options.tileSize,this.options.tileSize),i=this._buildExportParams(g,h);this._requestExport(i,g,b)},_requestExport:function(a,b,c){"json"===this.options.f?this._requests.push(this._service.get("export",a,function(a,d){a?c(a,d):c(null,d.href,b)},this)):(a.f="image",c(null,this.options.url+"export"+L.Util.getParamString(a),b))},_redraw:function(){if(this._map)if(this.options.redrawBuffer){var a=this._tileContainer;this._clearBgBuffer(),this._tileContainer=this._bgBuffer,this._bgBuffer=a,this._tiles={},this._tilesToLoad=0,this._tilesTotal=0}else L.TileLayer.prototype._reset.call(this,{hard:!0})},_initContainer:function(){this._animated=this._animated||this.options.redrawBuffer,L.TileLayer.prototype._initContainer.call(this)},_update:function(){this._map&&this._map._animatingZoom||L.TileLayer.prototype._update.call(this)}}),function(a){for(var b=0,c=a.length;c>b;b++)EsriLeaflet.Layers.TiledDynamicMapLayer.prototype[a[b]]=EsriLeaflet.Layers.DynamicMapLayer.prototype[a[b]]}(["getLayers","getLayerDefs","getTimeOptions","metadata","query","identify","find","_getPopupData","_propagateEvent"]),EsriLeaflet.Layers.tiledDynamicMapLayer=EsriLeaflet.tiledDynamicMapLayer=function(a,b){return new EsriLeaflet.Layers.TiledDynamicMapLayer(a,b)};
EsriLeaflet.Layers.TiledDynamicMapLayer=L.TileLayer.extend({options:L.Util.extend({},EsriLeaflet.Layers.DynamicMapLayer.prototype.options,{redrawBuffer:!0}),_requests:[],initialize:function(a,b){L.TileLayer.prototype.initialize.call(this,a,b),EsriLeaflet.DynamicMapLayer.prototype.initialize.call(this,a,b)},onAdd:function(a){if(a.options.crs&&a.options.crs.code){var b=a.options.crs.code.split(":")[1];this.options.bboxSR=b,this.options.imageSR=b}return a.on("zoomstart zoomend",this._onZoomChange,this),L.TileLayer.prototype.onAdd.call(this,a)},onRemove:function(a){a.off("zoomstart zoomend",this._onZoomChange,this),L.TileLayer.prototype.onRemove.call(this,a),EsriLeaflet.DynamicMapLayer.prototype.onRemove.call(this,a)},setLayers:function(a){return EsriLeaflet.Layers.DynamicMapLayer.prototype.setLayers.call(this,a),this.redraw()},setLayerDefs:function(a){return EsriLeaflet.Layers.DynamicMapLayer.prototype.setLayerDefs.call(this,a),this.redraw()},setTimeOptions:function(a){return EsriLeaflet.Layers.DynamicMapLayer.prototype.setTimeOptions.call(this,a),this.redraw()},_onZoomChange:function(a){this._zooming="zoomstart"===a.type},_buildExportParams:function(a,b){var c=this._map.options.crs.project(a._northEast),d=this._map.options.crs.project(a._southWest),e=this._map.latLngToLayerPoint(a._northEast),f=this._map.latLngToLayerPoint(a._southWest);(e.y>0||f.y<b.y)&&(b.y=f.y-e.y);var g={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&&(g.layers="show:"+this.options.layers.join(",")),this.options.layerDefs&&(g.layerDefs=JSON.stringify(this.options.layerDefs)),this.options.timeOptions&&(g.timeOptions=JSON.stringify(this.options.timeOptions)),this.options.from&&this.options.to&&(g.time=this.options.from.valueOf()+","+this.options.to.valueOf()),this._service.options.token&&(g.token=this._service.options.token),g},_loadTile:function(a,b){a._layer=this,a.onload=this._tileOnLoad,a.onerror=this._tileOnError,this._adjustTilePoint(b),this.getTileUrl(b,function(b,c){a.src=c}),this.fire("tileloadstart",{tile:a})},getTileUrl:function(a,b){var c=this._map,d=this.options.tileSize,e=a.multiplyBy(d),f=e.add([d,d]),g=new L.LatLngBounds(c.unproject(e,a.z),c.unproject(f,a.z)),h=new L.Point(this.options.tileSize,this.options.tileSize),i=this._buildExportParams(g,h);this._requestExport(i,g,b)},_requestExport:function(a,b,c){"json"===this.options.f?this._requests.push(this._service.get("export",a,function(a,d){c(null,d.href,b)},this)):(a.f="image",c(null,this.options.url+"export"+L.Util.getParamString(a),b))},redraw:function(){if(this._map){if(this.options.redrawBuffer){var a=this._tileContainer;this._clearBgBuffer(),this._tileContainer=this._bgBuffer,this._bgBuffer=a,this._tiles={},this._tilesToLoad=0,this._tilesTotal=0}else this._reset({hard:!0});this._update()}return this},_update:function(){this._map&&this._map._animatingZoom||L.TileLayer.prototype._update.call(this)}}),function(a){for(var b=0,c=a.length;c>b;b++)EsriLeaflet.Layers.TiledDynamicMapLayer.prototype[a[b]]=EsriLeaflet.Layers.DynamicMapLayer.prototype[a[b]]}(["getLayers","getLayerDefs","getTimeOptions","metadata","query","identify","find","_getPopupData","_propagateEvent"]),EsriLeaflet.tiledDynamicMapLayer=EsriLeaflet.Layers.tiledDynamicMapLayer=function(a,b){return new EsriLeaflet.Layers.TiledDynamicMapLayer(a,b)};
//# sourceMappingURL=esri-leaflet-dynamic-tilelayer.js.map

@@ -21,0 +21,0 @@

{
"name": "esri-leaflet-dynamic-tilelayer",
"version": "0.7.3",
"version": "0.7.31",
"description": "Tiled dynamic layer plugin for esri-leaflet",

@@ -31,4 +31,4 @@ "main": "dist/esri-dynamic-tilelayer-legend.js",

"dependencies": {
"esri-leaflet": "^1.0.0-rc.8",
"leaflet": "~0.7.3"
"esri-leaflet": "1.0.0-rc.8",
"leaflet": "^0.7.3"
},

@@ -35,0 +35,0 @@ "devDependencies": {

@@ -43,7 +43,7 @@ describe('L.esri.Layers.TiledDynamicMapLayer', function() {

it('should have a L.esri.Layers.tiledDynamicMapLayer alias', function() {
expect(L.esri.Layers.tiledDynamicMapLayer(url)).to.be.instanceof(L.esri.Layers.TiledDynamicMapLayer);
expect(L.esri.Layers.tiledDynamicMapLayer(url, {})).to.be.instanceof(L.esri.Layers.TiledDynamicMapLayer);
});
it('should be a subclass of L.TileLayer', function() {
expect(L.esri.Layers.tiledDynamicMapLayer(url)).to.be.instanceof(L.TileLayer);
expect(L.esri.Layers.tiledDynamicMapLayer(url, {})).to.be.instanceof(L.TileLayer);
});

@@ -55,6 +55,2 @@

it('should provide a container and a background buffer on add', function() {
expect(layer._tileContainer).to.be.ok;
expect(layer._bgBuffer).to.be.ok;
});

@@ -61,0 +57,0 @@ it('should have async getTileUrl', function() {

if (!this.EsriLeaflet) {
this.EsriLeaflet = window.L.esri;
this.EsriLeaflet = window.L.esri;
}

@@ -8,5 +8,2 @@ EsriLeaflet.Layers.TiledDynamicMapLayer = L.TileLayer.extend({

/**
* @type {Array.<XmlHttpRequest>}
*/
_requests: [],

@@ -30,3 +27,3 @@

if (map.options.crs && map.options.crs.code) {
var sr = this._getSr(map.options.crs.code);
var sr = map.options.crs.code.split(':')[1];
this.options.bboxSR = sr;

@@ -41,11 +38,2 @@ this.options.imageSR = sr;

/**
* Could be WKT and at least possble to override
* @param {String} code
* @return {String}
*/
_getSr: function(code) {
return code.split(':')[1];
},
/**
* @param {L.Map} map

@@ -64,4 +52,4 @@ */

setLayers: function(layers) {
this._redraw();
return EsriLeaflet.Layers.DynamicMapLayer.prototype.setLayers.call(this, layers);
EsriLeaflet.Layers.DynamicMapLayer.prototype.setLayers.call(this, layers);
return this.redraw();
},

@@ -74,4 +62,4 @@

setLayerDefs: function(layerDefs) {
this._redraw();
return EsriLeaflet.Layers.DynamicMapLayer.prototype.setLayerDefs.call(this, layerDefs);
EsriLeaflet.Layers.DynamicMapLayer.prototype.setLayerDefs.call(this, layerDefs);
return this.redraw();
},

@@ -84,4 +72,4 @@

setTimeOptions: function(timeOptions) {
this._redraw();
return EsriLeaflet.Layers.DynamicMapLayer.prototype.setTimeOptions.call(this, timeOptions);
EsriLeaflet.Layers.DynamicMapLayer.prototype.setTimeOptions.call(this, timeOptions);
return this.redraw();
},

@@ -158,8 +146,4 @@

this.getTileUrl(tilePoint, function(err, url) {
if (err) {
this._tileOnError.call(tile);
} else {
tile.src = url;
}
}, tile);
tile.src = url;
});

@@ -175,5 +159,4 @@ this.fire('tileloadstart', {

* @param {Function} callback
* @param {Image} tile
*/
getTileUrl: function(tilePoint, callback) {
getTileUrl: function(tilePoint, callback) { // (Point, Number) -> String
var map = this._map,

@@ -185,6 +168,4 @@ tileSize = this.options.tileSize,

var bounds = new L.LatLngBounds(
map.unproject(nwPoint, tilePoint.z),
map.unproject(sePoint, tilePoint.z)
);
var bounds = new L.LatLngBounds(map.unproject(nwPoint, tilePoint.z),
map.unproject(sePoint, tilePoint.z));
var size = new L.Point(this.options.tileSize, this.options.tileSize);

@@ -205,7 +186,3 @@

this._requests.push(this._service.get('export', params, function(error, response) {
if (error) {
callback(error, response);
} else {
callback(null, response.href, bounds);
}
callback(null, response.href, bounds);
}, this));

@@ -218,8 +195,3 @@ } else {

/**
* Smooth redraw, see
* @see https://github.com/w8r/leaflet-wms-bgbuffer
* @return {EsriLeaflet.Layers.TiledDynamicMapLayer}
*/
_redraw: function() {
redraw: function() {
if (this._map) {

@@ -231,3 +203,2 @@ if (this.options.redrawBuffer) {

this._bgBuffer = front;
this._tiles = {};

@@ -237,18 +208,13 @@ this._tilesToLoad = 0;

} else {
L.TileLayer.prototype._reset.call(this, {
this._reset({
hard: true
});
}
this._update();
}
return this;
},
/**
* Override for old IE, just to have bg buffer for tiles
*/
_initContainer: function() {
this._animated = this._animated || this.options.redrawBuffer;
L.TileLayer.prototype._initContainer.call(this);
},
/**
* Bounds or params changed

@@ -292,5 +258,5 @@ */

// factory
EsriLeaflet.Layers.tiledDynamicMapLayer =
EsriLeaflet.tiledDynamicMapLayer = function(url, options) {
return new EsriLeaflet.Layers.TiledDynamicMapLayer(url, options);
};
EsriLeaflet.tiledDynamicMapLayer =
EsriLeaflet.Layers.tiledDynamicMapLayer = function(url, options) {
return new EsriLeaflet.Layers.TiledDynamicMapLayer(url, options);
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc