commit 3c51c958fc4dea68b863dc435474bc503f458b04
parent 851d1684c92c8aee391fb72f2efa925fb2de9f4b
Author: Sergej Orlov <wladimirych@gmail.com>
Date: Sat, 25 Feb 2017 13:36:22 +0300
[jnx] do not save jnx with zero or >50000 tiles
Diffstat:
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/lib/leaflet.control.jnx/jnx-encoder.js b/src/lib/leaflet.control.jnx/jnx-encoder.js
@@ -35,6 +35,17 @@ const JnxWriter = L.Class.extend({
LEVEL_INFO_SIZE = 17,
TILE_INFO_SIZE = 28;
+ let totalTilesCount = 0;
+ for (let levelTiles of Object.values(this.tiles)) {
+ totalTilesCount += levelTiles.length;
+ }
+ if (totalTilesCount === 0) {
+ throw new Error('No tiles collected, JNX is empty');
+ }
+ if (totalTilesCount > 50000) {
+ throw new Error('Too many tiles found (more then 50000)');
+ }
+
let west = 1e10,
east = -1e10,
north = -1e10,