global-mercator
Advanced tools
Comparing version 1.5.0 to 1.6.0
# Changelog | ||
## 1.6.0 - 2017-01-05 | ||
- BBox reduced decimal precision to 6 | ||
- Lat & Lng decimal toFixed(6) | ||
- Meters toFixed(1) | ||
## 1.5.0 - 2016-12-25 | ||
@@ -4,0 +10,0 @@ |
10
index.js
@@ -49,2 +49,4 @@ "use strict"; | ||
y = y * exports.originShift / 180.0; | ||
x = Number(x.toFixed(1)); | ||
y = Number(y.toFixed(1)); | ||
return [x, y]; | ||
@@ -67,2 +69,4 @@ } | ||
lat = 180 / Math.PI * (2 * Math.atan(Math.exp(lat * Math.PI / 180.0)) - Math.PI / 2.0); | ||
lng = Number(lng.toFixed(6)); | ||
lat = Number(lat.toFixed(6)); | ||
return [lng, lat]; | ||
@@ -153,4 +157,6 @@ } | ||
const res = resolution(zoom); | ||
const mx = px * res - exports.originShift; | ||
const my = py * res - exports.originShift; | ||
let mx = px * res - exports.originShift; | ||
let my = py * res - exports.originShift; | ||
mx = Number(mx.toFixed(1)); | ||
my = Number(my.toFixed(1)); | ||
return [mx, my]; | ||
@@ -157,0 +163,0 @@ } |
12
index.ts
@@ -82,2 +82,4 @@ export const tileSize = 256 | ||
y = y * originShift / 180.0 | ||
x = Number(x.toFixed(1)) | ||
y = Number(y.toFixed(1)) | ||
return [x, y] | ||
@@ -100,3 +102,4 @@ } | ||
lat = 180 / Math.PI * (2 * Math.atan( Math.exp( lat * Math.PI / 180.0)) - Math.PI / 2.0) | ||
lng = Number(lng.toFixed(6)) | ||
lat = Number(lat.toFixed(6)) | ||
return [lng, lat] | ||
@@ -184,5 +187,6 @@ } | ||
const res = resolution(zoom) | ||
const mx = px * res - originShift | ||
const my = py * res - originShift | ||
let mx = px * res - originShift | ||
let my = py * res - originShift | ||
mx = Number(mx.toFixed(1)) | ||
my = Number(my.toFixed(1)) | ||
return [mx, my] | ||
@@ -189,0 +193,0 @@ } |
{ | ||
"name": "global-mercator", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "Tools to help with TMS, Quadkey & Google (XYZ) Tiles", | ||
@@ -10,3 +10,3 @@ "main": "index.js", | ||
"docs": "tsc && cat HEADER.md > README.md && documentation build index.js -c documentation.yml -f md --shallow >> README.md && cat CHANGELOG.md >> README.md", | ||
"lint": "tsc && tslint index.ts index.test.ts && documentation lint index.js" | ||
"lint": "tsc && tslint index.ts test.ts && documentation lint index.js" | ||
}, | ||
@@ -57,3 +57,6 @@ "repository": { | ||
], | ||
"testEnvironment": "node" | ||
"testEnvironment": "node", | ||
"jest": { | ||
"verbose": true | ||
} | ||
} |
66941
1346