From 114eab43bd3e89703b047e78b3a5a016e3321cf6 Mon Sep 17 00:00:00 2001 From: Robert Plummer Date: Sun, 11 Oct 2015 14:48:58 -0400 Subject: [PATCH 1/9] Added the ability to use ajax, which can overcome certain security deficiencies found in Chrome and IE --- index.html | 2 +- index.js | 29 ++++++++++++++++++++++++++++- leaflet-image.js | 38 +++++++++++++++++++++++++++++++------- 3 files changed, 60 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index be1c5e9..ac3e38d 100644 --- a/index.html +++ b/index.html @@ -39,7 +39,7 @@ var snapshot = document.getElementById('snapshot'); var map = L.mapbox.map('map', 'mapbox.streets') .setView([38.88995, -77.00906], 15); - +L.marker([38.88995, -77.00906]).addTo(map); document.getElementById('snap').addEventListener('click', function() { leafletImage(map, doImage); }); diff --git a/index.js b/index.js index df5dbce..d8cc573 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ var queue = require('./queue'); // leaflet-image -module.exports = function leafletImage(map, callback) { +module.exports = function leafletImage(map, callback, useAjax) { var dimensions = map.getSize(), layerQueue = new queue(1); @@ -208,6 +208,13 @@ module.exports = function leafletImage(map, callback) { }); }; + if (useAjax) { + getBase64(url, function(data) { + im.src = 'data: image/png;base64, ' + data; + im.onload(); + }); + return; + } im.src = url; if (isBase64) im.onload(); @@ -216,4 +223,24 @@ module.exports = function leafletImage(map, callback) { function addCacheString(url) { return url + ((url.match(/\?/)) ? '&' : '?') + 'cache=' + (+new Date()); } + + function getBase64(url, callback) { + var request = new XMLHttpRequest(); + request.open('GET', url, true); + request.responseType = 'arraybuffer'; + request.onload = function() { + if (request.status >= 200 && request.status < 400) { + var buffer = this.response, + binary = '', + bytes = new Uint8Array(buffer), + len = bytes.byteLength; + + for (var i = 0; i < len; i++) { + binary += String.fromCharCode(bytes[i]); + } + callback(btoa(binary)); + } + }; + request.send(); + } }; diff --git a/leaflet-image.js b/leaflet-image.js index 4e812ec..06031d7 100644 --- a/leaflet-image.js +++ b/leaflet-image.js @@ -1,9 +1,8 @@ -(function(e){if("function"==typeof bootstrap)bootstrap("leafletimage",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeLeafletImage=e}else"undefined"!=typeof window?window.leafletImage=e():global.leafletImage=e()})(function(){var define,ses,bootstrap,module,exports; -return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 200 && request.status < 400) { + var buffer = this.response, + binary = '', + bytes = new Uint8Array(buffer), + len = bytes.byteLength; + + for (var i = 0; i < len; i++) { + binary += String.fromCharCode(bytes[i]); + } + callback(btoa(binary)); + } + }; + request.send(); + } }; },{"./queue":2}],2:[function(require,module,exports){ @@ -301,7 +327,5 @@ module.exports = function leafletImage(map, callback) { function noop() {} })(); -},{}]},{},[1]) -(1) -}); -; +},{}]},{},[1])(1) +}); \ No newline at end of file From 53296a7bf2d124b40a6dd4213eca51fd2660ac08 Mon Sep 17 00:00:00 2001 From: Robert Plummer Date: Sat, 31 Oct 2015 16:42:48 -0400 Subject: [PATCH 2/9] create image cache when using ajax use else because it looks better correct onload duplicate callback issue causing images to intermittently show up --- index.js | 48 +++++++++++++++++++++++++++++++++++------------- leaflet-image.js | 47 ++++++++++++++++++++++++++++++++++------------- 2 files changed, 69 insertions(+), 26 deletions(-) diff --git a/index.js b/index.js index d8cc573..b5db8b9 100644 --- a/index.js +++ b/index.js @@ -4,7 +4,8 @@ var queue = require('./queue'); module.exports = function leafletImage(map, callback, useAjax) { var dimensions = map.getSize(), - layerQueue = new queue(1); + layerQueue = new queue(1), + imageCache = {}; var canvas = document.createElement('canvas'); canvas.width = dimensions.x; @@ -185,12 +186,14 @@ module.exports = function leafletImage(map, callback, useAjax) { minPoint = new L.Point(pixelBounds.min.x, pixelBounds.min.y), pixelPoint = map.project(marker.getLatLng()), isBase64 = /^data\:/.test(marker._icon.src), + cache = imageCache[marker._icon.src], url = isBase64 ? marker._icon.src : addCacheString(marker._icon.src), im = new Image(), options = marker.options.icon.options, size = options.iconSize, pos = pixelPoint.subtract(minPoint), - anchor = L.point(options.iconAnchor || size && size.divideBy(2, true)); + anchor = L.point(options.iconAnchor || size && size.divideBy(2, true)), + loaded = false; if (size instanceof L.Point) size = [size.x, size.y]; @@ -202,22 +205,41 @@ module.exports = function leafletImage(map, callback, useAjax) { im.crossOrigin = ''; im.onload = function() { + if (loaded) return; + loaded = true; ctx.drawImage(this, x, y, size[0], size[1]); - callback(null, { + callback(null, { canvas: canvas }); }; - if (useAjax) { - getBase64(url, function(data) { - im.src = 'data: image/png;base64, ' + data; - im.onload(); - }); - return; - } - im.src = url; + if (useAjax && !isBase64) { + if (cache === undefined) { + getBase64(url, function (data) { + im.src = imageCache[marker._icon.src] = 'data: image/png;base64, ' + data; + if (!loaded) { + setTimeout(function() { + im.onload(); + },0); + } + }); + } else { + im.src = cache; + if (!loaded) { + setTimeout(function() { + im.onload(); + },0); + } + } + } else { + im.src = url; - if (isBase64) im.onload(); + if (isBase64 && !loaded) { + setTimeout(function () { + im.onload(); + }, 0); + } + } } function addCacheString(url) { @@ -243,4 +265,4 @@ module.exports = function leafletImage(map, callback, useAjax) { }; request.send(); } -}; +}; \ No newline at end of file diff --git a/leaflet-image.js b/leaflet-image.js index 06031d7..a6e48d0 100644 --- a/leaflet-image.js +++ b/leaflet-image.js @@ -5,7 +5,8 @@ var queue = require('./queue'); module.exports = function leafletImage(map, callback, useAjax) { var dimensions = map.getSize(), - layerQueue = new queue(1); + layerQueue = new queue(1), + imageCache = {}; var canvas = document.createElement('canvas'); canvas.width = dimensions.x; @@ -186,12 +187,14 @@ module.exports = function leafletImage(map, callback, useAjax) { minPoint = new L.Point(pixelBounds.min.x, pixelBounds.min.y), pixelPoint = map.project(marker.getLatLng()), isBase64 = /^data\:/.test(marker._icon.src), + cache = imageCache[marker._icon.src], url = isBase64 ? marker._icon.src : addCacheString(marker._icon.src), im = new Image(), options = marker.options.icon.options, size = options.iconSize, pos = pixelPoint.subtract(minPoint), - anchor = L.point(options.iconAnchor || size && size.divideBy(2, true)); + anchor = L.point(options.iconAnchor || size && size.divideBy(2, true)), + loaded = false; if (size instanceof L.Point) size = [size.x, size.y]; @@ -203,22 +206,41 @@ module.exports = function leafletImage(map, callback, useAjax) { im.crossOrigin = ''; im.onload = function() { + if (loaded) return; + loaded = true; ctx.drawImage(this, x, y, size[0], size[1]); - callback(null, { + callback(null, { canvas: canvas }); }; - if (useAjax) { - getBase64(url, function(data) { - im.src = 'data: image/png;base64, ' + data; - im.onload(); - }); - return; - } - im.src = url; + if (useAjax && !isBase64) { + if (cache === undefined) { + getBase64(url, function (data) { + im.src = imageCache[marker._icon.src] = 'data: image/png;base64, ' + data; + if (!loaded) { + setTimeout(function() { + im.onload(); + },0); + } + }); + } else { + im.src = cache; + if (!loaded) { + setTimeout(function() { + im.onload(); + },0); + } + } + } else { + im.src = url; - if (isBase64) im.onload(); + if (isBase64 && !loaded) { + setTimeout(function () { + im.onload(); + }, 0); + } + } } function addCacheString(url) { @@ -245,7 +267,6 @@ module.exports = function leafletImage(map, callback, useAjax) { request.send(); } }; - },{"./queue":2}],2:[function(require,module,exports){ (function() { if (typeof module === "undefined") self.queue = queue; From b87b448896a0ed8fc22ef3d69ddc002aac3db19a Mon Sep 17 00:00:00 2001 From: Robert Plummer Date: Sat, 31 Oct 2015 16:46:37 -0400 Subject: [PATCH 3/9] space correction --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index b5db8b9..a2e4eae 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,7 @@ module.exports = function leafletImage(map, callback, useAjax) { var dimensions = map.getSize(), layerQueue = new queue(1), - imageCache = {}; + imageCache = {}; var canvas = document.createElement('canvas'); canvas.width = dimensions.x; @@ -208,7 +208,7 @@ module.exports = function leafletImage(map, callback, useAjax) { if (loaded) return; loaded = true; ctx.drawImage(this, x, y, size[0], size[1]); - callback(null, { + callback(null, { canvas: canvas }); }; @@ -265,4 +265,4 @@ module.exports = function leafletImage(map, callback, useAjax) { }; request.send(); } -}; \ No newline at end of file +}; From 975009e7a1e03e331775420f94b445344a305ae2 Mon Sep 17 00:00:00 2001 From: Robert Plummer Date: Sat, 31 Oct 2015 16:47:15 -0400 Subject: [PATCH 4/9] space correction --- leaflet-image.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/leaflet-image.js b/leaflet-image.js index a6e48d0..ab701be 100644 --- a/leaflet-image.js +++ b/leaflet-image.js @@ -6,7 +6,7 @@ module.exports = function leafletImage(map, callback, useAjax) { var dimensions = map.getSize(), layerQueue = new queue(1), - imageCache = {}; + imageCache = {}; var canvas = document.createElement('canvas'); canvas.width = dimensions.x; @@ -209,7 +209,7 @@ module.exports = function leafletImage(map, callback, useAjax) { if (loaded) return; loaded = true; ctx.drawImage(this, x, y, size[0], size[1]); - callback(null, { + callback(null, { canvas: canvas }); }; @@ -267,6 +267,7 @@ module.exports = function leafletImage(map, callback, useAjax) { request.send(); } }; + },{"./queue":2}],2:[function(require,module,exports){ (function() { if (typeof module === "undefined") self.queue = queue; From 1588f003c24d73cf25cbbc45d900168353897d33 Mon Sep 17 00:00:00 2001 From: Robert Plummer Date: Tue, 29 Dec 2015 14:37:26 -0500 Subject: [PATCH 5/9] add the ability to render a canvas directly as image if render method exists and canvas property exists --- index.js | 21 +++++++++++++++++++-- leaflet-image.js | 21 +++++++++++++++++++-- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index a2e4eae..adb4b50 100644 --- a/index.js +++ b/index.js @@ -29,7 +29,7 @@ module.exports = function leafletImage(map, callback, useAjax) { } else if (map._panes && map._panes.overlayPane.firstChild) { layerQueue.defer(handlePathRoot, map._panes.overlayPane.firstChild); } - map.eachLayer(drawMarkerLayer); + map.eachLayer(drawLayer); layerQueue.awaitAll(layersDone); function drawTileLayer(l) { @@ -37,9 +37,11 @@ module.exports = function leafletImage(map, callback, useAjax) { else if (l._heat) layerQueue.defer(handlePathRoot, l._canvas); } - function drawMarkerLayer(l) { + function drawLayer(l) { if (l instanceof L.Marker && l.options.icon instanceof L.Icon) { layerQueue.defer(handleMarkerLayer, l); + } else if (typeof l.redraw === 'function' && l.canvas) { + layerQueue.defer(handleCanvasLayer, l); } } @@ -53,6 +55,11 @@ module.exports = function leafletImage(map, callback, useAjax) { if (layer && layer.canvas) { ctx.drawImage(layer.canvas, 0, 0); } + }); + layers.forEach(function (layer) { + if (layer && layer.img && !layer.canvas) { + ctx.drawImage(layer.img, 0, 0); + } }); done(); } @@ -265,4 +272,14 @@ module.exports = function leafletImage(map, callback, useAjax) { }; request.send(); } + + function handleCanvasLayer(l, callback) { + l.redraw(function () { + var img = new Image(); + img.src = l.canvas.toDataURL(); + callback(null, { + img: img + }); + }) + } }; diff --git a/leaflet-image.js b/leaflet-image.js index ab701be..6f95f5f 100644 --- a/leaflet-image.js +++ b/leaflet-image.js @@ -30,7 +30,7 @@ module.exports = function leafletImage(map, callback, useAjax) { } else if (map._panes && map._panes.overlayPane.firstChild) { layerQueue.defer(handlePathRoot, map._panes.overlayPane.firstChild); } - map.eachLayer(drawMarkerLayer); + map.eachLayer(drawLayer); layerQueue.awaitAll(layersDone); function drawTileLayer(l) { @@ -38,9 +38,11 @@ module.exports = function leafletImage(map, callback, useAjax) { else if (l._heat) layerQueue.defer(handlePathRoot, l._canvas); } - function drawMarkerLayer(l) { + function drawLayer(l) { if (l instanceof L.Marker && l.options.icon instanceof L.Icon) { layerQueue.defer(handleMarkerLayer, l); + } else if (typeof l.redraw === 'function' && l.canvas) { + layerQueue.defer(handleCanvasLayer, l); } } @@ -54,6 +56,11 @@ module.exports = function leafletImage(map, callback, useAjax) { if (layer && layer.canvas) { ctx.drawImage(layer.canvas, 0, 0); } + }); + layers.forEach(function (layer) { + if (layer && layer.img && !layer.canvas) { + ctx.drawImage(layer.img, 0, 0); + } }); done(); } @@ -266,6 +273,16 @@ module.exports = function leafletImage(map, callback, useAjax) { }; request.send(); } + + function handleCanvasLayer(l, callback) { + l.redraw(function () { + var img = new Image(); + img.src = l.canvas.toDataURL(); + callback(null, { + img: img + }); + }) + } }; },{"./queue":2}],2:[function(require,module,exports){ From 655589ad72b3da6e8ad5e71ad3dfc5c8467a466c Mon Sep 17 00:00:00 2001 From: Robert Plummer Date: Tue, 29 Dec 2015 14:40:44 -0500 Subject: [PATCH 6/9] spacing --- index.js | 4 ++-- leaflet-image.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index adb4b50..17a3652 100644 --- a/index.js +++ b/index.js @@ -56,7 +56,7 @@ module.exports = function leafletImage(map, callback, useAjax) { ctx.drawImage(layer.canvas, 0, 0); } }); - layers.forEach(function (layer) { + layers.forEach(function (layer) { if (layer && layer.img && !layer.canvas) { ctx.drawImage(layer.img, 0, 0); } @@ -273,7 +273,7 @@ module.exports = function leafletImage(map, callback, useAjax) { request.send(); } - function handleCanvasLayer(l, callback) { + function handleCanvasLayer(l, callback) { l.redraw(function () { var img = new Image(); img.src = l.canvas.toDataURL(); diff --git a/leaflet-image.js b/leaflet-image.js index 6f95f5f..e38877f 100644 --- a/leaflet-image.js +++ b/leaflet-image.js @@ -57,7 +57,7 @@ module.exports = function leafletImage(map, callback, useAjax) { ctx.drawImage(layer.canvas, 0, 0); } }); - layers.forEach(function (layer) { + layers.forEach(function (layer) { if (layer && layer.img && !layer.canvas) { ctx.drawImage(layer.img, 0, 0); } @@ -274,7 +274,7 @@ module.exports = function leafletImage(map, callback, useAjax) { request.send(); } - function handleCanvasLayer(l, callback) { + function handleCanvasLayer(l, callback) { l.redraw(function () { var img = new Image(); img.src = l.canvas.toDataURL(); From cb015a4f970f4d66ec666445a53b2a73bfbb8fa2 Mon Sep 17 00:00:00 2001 From: Robert Plummer Date: Tue, 7 Jun 2016 23:08:59 -0400 Subject: [PATCH 7/9] Merge remote-tracking branch 'upstream/gh-pages' into gh-pages # Conflicts: # index.js # leaflet-image.js --- leaflet-image.js | 77 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 71 insertions(+), 6 deletions(-) diff --git a/leaflet-image.js b/leaflet-image.js index bf99a37..b4d21f7 100644 --- a/leaflet-image.js +++ b/leaflet-image.js @@ -6,12 +6,13 @@ var queue = require('d3-queue').queue; var cacheBusterDate = +new Date(); // leaflet-image -module.exports = function leafletImage(map, callback) { +module.exports = function leafletImage(map, callback, useAjax) { var hasMapbox = !!L.mapbox; var dimensions = map.getSize(), - layerQueue = new queue(1); + layerQueue = new queue(1), + imageCache = {}; var canvas = document.createElement('canvas'); canvas.width = dimensions.x; @@ -47,6 +48,8 @@ module.exports = function leafletImage(map, callback) { function drawMarkerLayer(l) { if (l instanceof L.Marker && l.options.icon instanceof L.Icon) { layerQueue.defer(handleMarkerLayer, l); + } else if (typeof l.redraw === 'function' && l.canvas) { + layerQueue.defer(handleCanvasLayer, l); } } @@ -61,6 +64,11 @@ module.exports = function leafletImage(map, callback) { ctx.drawImage(layer.canvas, 0, 0); } }); + layers.forEach(function (layer) { + if (layer && layer.img && !layer.canvas) { + ctx.drawImage(layer.img, 0, 0); + } + }); done(); } @@ -193,12 +201,14 @@ module.exports = function leafletImage(map, callback) { minPoint = new L.Point(pixelBounds.min.x, pixelBounds.min.y), pixelPoint = map.project(marker.getLatLng()), isBase64 = /^data\:/.test(marker._icon.src), + cache = imageCache[marker._icon.src], url = isBase64 ? marker._icon.src : addCacheString(marker._icon.src), im = new Image(), options = marker.options.icon.options, size = options.iconSize, pos = pixelPoint.subtract(minPoint), - anchor = L.point(options.iconAnchor || size && size.divideBy(2, true)); + anchor = L.point(options.iconAnchor || size && size.divideBy(2, true)), + loaded = false; if (size instanceof L.Point) size = [size.x, size.y]; @@ -210,15 +220,41 @@ module.exports = function leafletImage(map, callback) { im.crossOrigin = ''; im.onload = function () { + if (loaded) return; + loaded = true; ctx.drawImage(this, x, y, size[0], size[1]); callback(null, { canvas: canvas }); }; - im.src = url; + if (useAjax && !isBase64) { + if (cache === undefined) { + getBase64(url, function (data) { + im.src = imageCache[marker._icon.src] = 'data: image/png;base64, ' + data; + if (!loaded) { + setTimeout(function() { + im.onload(); + },0); + } + }); + } else { + im.src = cache; + if (!loaded) { + setTimeout(function() { + im.onload(); + },0); + } + } + } else { + im.src = url; - if (isBase64) im.onload(); + if (isBase64 && !loaded) { + setTimeout(function () { + im.onload(); + }, 0); + } + } } function addCacheString(url) { @@ -233,7 +269,36 @@ module.exports = function leafletImage(map, callback) { var dataURLRegex = /^\s*data:([a-z]+\/[a-z]+(;[a-z\-]+\=[a-z\-]+)?)?(;base64)?,[a-z0-9\!\$\&\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i; return !!url.match(dataURLRegex); } - + + function getBase64(url, callback) { + var request = new XMLHttpRequest(); + request.open('GET', url, true); + request.responseType = 'arraybuffer'; + request.onload = function() { + if (request.status >= 200 && request.status < 400) { + var buffer = this.response, + binary = '', + bytes = new Uint8Array(buffer), + len = bytes.byteLength; + + for (var i = 0; i < len; i++) { + binary += String.fromCharCode(bytes[i]); + } + callback(btoa(binary)); + } + }; + request.send(); + } + + function handleCanvasLayer(l, callback) { + l.redraw(function () { + var img = new Image(); + img.src = l.canvas.toDataURL(); + callback(null, { + img: img + }); + }) + } }; },{"d3-queue":2}],2:[function(require,module,exports){ From e94bf12a8b4a12107604df9322950653585c61ca Mon Sep 17 00:00:00 2001 From: Robert Plummer Date: Tue, 7 Jun 2016 23:13:53 -0400 Subject: [PATCH 8/9] cleanup, post merge --- index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 10144ca..14786a0 100644 --- a/index.js +++ b/index.js @@ -65,7 +65,7 @@ module.exports = function leafletImage(map, callback, useAjax) { }); layers.forEach(function (layer) { if (layer && layer.img && !layer.canvas) { - ctx.drawImage(layer.img, 0, 0); + ctx.drawImage(layer.img, 0, 0); } }); done(); @@ -232,7 +232,7 @@ module.exports = function leafletImage(map, callback, useAjax) { getBase64(url, function (data) { im.src = imageCache[marker._icon.src] = 'data: image/png;base64, ' + data; if (!loaded) { - setTimeout(function() { + setTimeout(function () { im.onload(); },0); } @@ -240,7 +240,7 @@ module.exports = function leafletImage(map, callback, useAjax) { } else { im.src = cache; if (!loaded) { - setTimeout(function() { + setTimeout(function () { im.onload(); },0); } @@ -273,7 +273,7 @@ module.exports = function leafletImage(map, callback, useAjax) { var request = new XMLHttpRequest(); request.open('GET', url, true); request.responseType = 'arraybuffer'; - request.onload = function() { + request.onload = function () { if (request.status >= 200 && request.status < 400) { var buffer = this.response, binary = '', @@ -296,6 +296,6 @@ module.exports = function leafletImage(map, callback, useAjax) { callback(null, { img: img }); - }) + }); } }; From c6c74af09d7f434a3ad34ad88e08fc0d0a67c239 Mon Sep 17 00:00:00 2001 From: Robert Plummer Date: Tue, 7 Jun 2016 23:19:23 -0400 Subject: [PATCH 9/9] adding Uint8Array to globals --- index.js | 2 +- leaflet-image.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 14786a0..da102cb 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -/* global L */ +/* global L, Uint8Array */ var queue = require('d3-queue').queue; diff --git a/leaflet-image.js b/leaflet-image.js index b4d21f7..1766b49 100644 --- a/leaflet-image.js +++ b/leaflet-image.js @@ -1,5 +1,5 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.leafletImage = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 200 && request.status < 400) { var buffer = this.response, binary = '', @@ -297,7 +297,7 @@ module.exports = function leafletImage(map, callback, useAjax) { callback(null, { img: img }); - }) + }); } };