From c943d7fa1c5de45b63e8b3bef1432855f9deaa76 Mon Sep 17 00:00:00 2001 From: Calvin Metcalf Date: Thu, 28 Sep 2017 13:58:21 -0400 Subject: [PATCH 1/2] fix off by 1 error in tile calcs --- index.js | 2 +- test/test.js | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 3b6fc14..4482350 100644 --- a/index.js +++ b/index.js @@ -73,7 +73,7 @@ abaculus.tileList = function(z, s, center, tileSize) { y = center.y, w = center.w, h = center.h; - var dimensions = {x: w, y: h}; + var dimensions = {x: w - 1, y: h - 1}; var size = tileSize || 256; var ts = Math.floor(size * s); diff --git a/test/test.js b/test/test.js index d660694..05e3d18 100644 --- a/test/test.js +++ b/test/test.js @@ -144,7 +144,27 @@ describe('create list of tile coordinates', function() { var coords = printer.tileList(zoom, scale, center); assert.deepEqual(JSON.stringify(coords), JSON.stringify(expectedCoords)); }); + it('should avoid extranious images', function() { + var zoom = 11, + scale = 1, + width = 256, + height = 256, + center = { w: width, h: height, x: 118912, y: 214912 }; + var expectedCoords = { + tiles: [ + { z: 11, x: 464, y: 839, px: 0, py: 0}, + // {z: 11, x: 464, y: 840, px: 0, py: 256 }, + // { z: 11, x: 465, y: 839, px: 256, py: 0 }, + // { z: 11, x: 465, y: 840, px: 256, py: 256 } + ], + dimensions: {x: width, y: height}, + center: { row: 839, column: 464, zoom: 11 }, + scale: scale + }; + var coords = printer.tileList(zoom, scale, center); + assert.deepEqual(JSON.stringify(coords), JSON.stringify(expectedCoords)); + }); it('should return a tiles object with correct coords when image is much bigger than world', function() { var zoom = 1, scale = 1, From 28471a0bfa5eba0ed82919b241302d5bfdacc349 Mon Sep 17 00:00:00 2001 From: Calvin Metcalf Date: Thu, 5 Oct 2017 09:41:53 -0400 Subject: [PATCH 2/2] just remove broken version of node --- appveyor.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 3e42468..83d05c5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,7 +2,6 @@ os: Visual Studio 2015 environment: matrix: - - nodejs_version: "0.10.40" - nodejs_version: "4.4.1" platform: