global-mercator
Advanced tools
Comparing version 0.2.2 to 0.2.3
138
index.js
"use strict"; | ||
const Debug = require('debug'); | ||
const lodash_1 = require('lodash'); | ||
const Debug = require("debug"); | ||
const lodash_1 = require("lodash"); | ||
exports.debug = { | ||
@@ -79,2 +79,3 @@ error: Debug('global-mercator:error'), | ||
* @param {number} lng Longitude (Meridians) in decimal degrees | ||
* @param {number} zoom Zoom level | ||
* @returns {Object} Google (XYZ) Tile | ||
@@ -95,3 +96,3 @@ * @example | ||
* @param {number} my Latitudes (Parallels) in decimal degrees | ||
* @param {number} [zoom] Zoom level | ||
* @param {number} zoom Zoom level | ||
* @returns {Object} TMS Tile | ||
@@ -316,3 +317,3 @@ * @example | ||
* @param {string} [name=Tile] - name used for debugging message | ||
* @throws Will throw an error if TMS Tile is not valid. | ||
* @throws {Error} Will throw an error if TMS Tile is not valid. | ||
* @returns {Object} TMS Tile | ||
@@ -346,3 +347,3 @@ * @example | ||
* @param {number} zoom Zoom level | ||
* @throws Will throw an error if zoom is not valid. | ||
* @throws {Error} Will throw an error if zoom is not valid. | ||
* @returns {number} zoom Zoom level | ||
@@ -376,3 +377,3 @@ * @example | ||
* @param {Array<number>} Pixels coordinates | ||
* @throws Will throw an error if Pixels is not valid. | ||
* @throws {Error} Will throw an error if Pixels is not valid. | ||
* @returns {Array<number>} Pixels coordinates | ||
@@ -408,3 +409,3 @@ * @example | ||
* @param {Array<number>} Meters coordinates | ||
* @throws Will throw an error if Meters is not valid. | ||
* @throws {Error} Will throw an error if Meters is not valid. | ||
* @returns {Array<number>} Meters coordinates | ||
@@ -452,3 +453,3 @@ * @example | ||
* @param {Array<number>} LatLng coordinates | ||
* @throws Will throw an error if LatLng is not valid. | ||
* @throws {Error} Will throw an error if LatLng is not valid. | ||
* @returns {Array<number>} LatLng coordinates | ||
@@ -469,3 +470,3 @@ * @example | ||
* @param {Array<number>} LngLat coordinates | ||
* @throws Will throw an error if LngLat is not valid. | ||
* @throws {Error} Will throw an error if LngLat is not valid. | ||
* @returns {Array<number>} LngLat coordinates | ||
@@ -511,3 +512,3 @@ * @example | ||
* @param {Array<number>} bbox extent in [minX, minY, maxX, maxY] order | ||
* @throws Will throw an error if bbox is not valid. | ||
* @throws {Error} Will throw an error if bbox is not valid. | ||
* @returns {Array<number>} bbox extent in [minX, minY, maxX, maxY] order | ||
@@ -535,3 +536,3 @@ * @example | ||
* @param {string} [name] - name used for debugging message | ||
* @throws Will throw an error if any item in Object is undefined. | ||
* @throws {Error} Will throw an error if any item in Object is undefined. | ||
* @returns {Object} items | ||
@@ -555,2 +556,10 @@ * @example | ||
exports.assertUndefined = assertUndefined; | ||
/** | ||
* {@link Google} (XYZ) Tile | ||
* | ||
* @class Google | ||
* @property {number} x Google (XYZ) Tile X | ||
* @property {number} y Google (XYZ) Tile Y | ||
* @property {number} zoom Zoom level | ||
*/ | ||
class Google { | ||
@@ -566,2 +575,10 @@ constructor(init) { | ||
exports.Google = Google; | ||
/** | ||
* TMS {@link Tile} | ||
* | ||
* @class Tile | ||
* @property {number} tx TMS Tile X | ||
* @property {number} ty TMS Tile Y | ||
* @property {number} zoom Zoom level | ||
*/ | ||
class Tile { | ||
@@ -578,2 +595,10 @@ constructor(init) { | ||
exports.Tile = Tile; | ||
/** | ||
* {@link Pixels} coordinates | ||
* | ||
* @class Pixels | ||
* @property {number} px Pixels X | ||
* @property {number} py Pixels Y | ||
* @property {number} zoom Zoom level | ||
*/ | ||
class Pixels { | ||
@@ -592,2 +617,10 @@ constructor(init) { | ||
exports.Pixels = Pixels; | ||
/** | ||
* {@link Meters} coordinates | ||
* | ||
* @class Meters | ||
* @property {number} mx Longitudes (Meridians) in meters | ||
* @property {number} my Latitudes (Parallels) in decimal degrees | ||
* @property {number} zoom Zoom level | ||
*/ | ||
class Meters { | ||
@@ -606,2 +639,10 @@ constructor(init) { | ||
exports.Meters = Meters; | ||
/** | ||
* {@link LatLng} coordinates | ||
* | ||
* @class LatLng | ||
* @property {number} lat Latitude (Parallels) in decimal degrees | ||
* @property {number} lng Longitude (Meridians) in decimal degrees | ||
* @property {number} zoom Zoom level | ||
*/ | ||
class LatLng { | ||
@@ -620,4 +661,10 @@ constructor(init) { | ||
exports.LatLng = LatLng; | ||
/** | ||
* GlobalMercator | ||
* | ||
* @class GlobalMercator | ||
* @property {number} [tileSize=256] Tile size dimension | ||
*/ | ||
class GlobalMercator { | ||
constructor(TileSize = 256) { | ||
constructor(tileSize = 256) { | ||
this.name = 'GlobalMercator'; | ||
@@ -629,4 +676,4 @@ this.bboxLatLngToMeters = (bbox) => { | ||
}; | ||
this.TileSize = TileSize; | ||
this.initialResolution = 2 * Math.PI * 6378137 / this.TileSize; | ||
this.tileSize = tileSize; | ||
this.initialResolution = 2 * Math.PI * 6378137 / this.tileSize; | ||
this.originShift = 2 * Math.PI * 6378137 / 2.0; | ||
@@ -647,3 +694,3 @@ } | ||
my = my * this.originShift / 180.0; | ||
return new Meters({ mx: mx, my: my, zoom: zoom }); | ||
return new Meters({ mx, my, zoom }); | ||
} | ||
@@ -655,3 +702,3 @@ metersToLatLng(init) { | ||
lat = 180 / Math.PI * (2 * Math.atan(Math.exp(lat * Math.PI / 180.0)) - Math.PI / 2.0); | ||
return new LatLng({ lat: lat, lng: lng, zoom: zoom }); | ||
return new LatLng({ lat, lng, zoom }); | ||
} | ||
@@ -663,3 +710,3 @@ metersToPixels(init) { | ||
const py = (my + this.originShift) / res; | ||
return new Pixels({ px: px, py: py, zoom: zoom }); | ||
return new Pixels({ px, py, zoom }); | ||
} | ||
@@ -690,3 +737,3 @@ latLngToTile(init) { | ||
const my = py * res - this.originShift; | ||
return new Meters({ mx: mx, my: my, zoom: zoom }); | ||
return new Meters({ mx, my, zoom }); | ||
} | ||
@@ -698,4 +745,4 @@ pixelsToTile(init) { | ||
const { px, py, zoom } = new Pixels(init); | ||
let tx = Math.ceil(px / this.TileSize) - 1; | ||
let ty = Math.ceil(py / this.TileSize) - 1; | ||
let tx = Math.ceil(px / this.tileSize) - 1; | ||
let ty = Math.ceil(py / this.tileSize) - 1; | ||
if (tx < 0) { | ||
@@ -707,8 +754,8 @@ tx = 0; | ||
} | ||
return new Tile({ tx: tx, ty: ty, zoom: zoom }); | ||
return new Tile({ tx, ty, zoom }); | ||
} | ||
tileBbox(init) { | ||
const { tx, ty, zoom } = new Tile(init); | ||
let min = this.pixelsToMeters({ px: tx * this.TileSize, py: ty * this.TileSize, zoom: zoom }); | ||
let max = this.pixelsToMeters({ px: (tx + 1) * this.TileSize, py: (ty + 1) * this.TileSize, zoom: zoom }); | ||
let min = this.pixelsToMeters({ px: tx * this.tileSize, py: ty * this.tileSize, zoom }); | ||
let max = this.pixelsToMeters({ px: (tx + 1) * this.tileSize, py: (ty + 1) * this.tileSize, zoom }); | ||
return validateBbox([min.mx, min.my, max.mx, max.my]); | ||
@@ -721,5 +768,5 @@ } | ||
const { tx, ty, zoom } = new Tile(init); | ||
const [mx1, my1, mx2, my2] = this.tileBbox({ tx: tx, ty: ty, zoom: zoom }); | ||
const min = this.metersToLatLng({ mx: mx1, my: my1, zoom: zoom }); | ||
const max = this.metersToLatLng({ mx: mx2, my: my2, zoom: zoom }); | ||
const [mx1, my1, mx2, my2] = this.tileBbox({ tx, ty, zoom }); | ||
const min = this.metersToLatLng({ mx: mx1, my: my1, zoom }); | ||
const max = this.metersToLatLng({ mx: mx2, my: my2, zoom }); | ||
return validateBbox([min.lng, min.lat, max.lng, max.lat]); | ||
@@ -742,3 +789,3 @@ } | ||
const y = (Math.pow(2, zoom) - 1) - ty; | ||
return new Google({ x: x, y: y, zoom: zoom }); | ||
return new Google({ x, y, zoom }); | ||
} | ||
@@ -749,3 +796,3 @@ googleTile(init) { | ||
const ty = Math.pow(2, zoom) - y - 1; | ||
return new Tile({ tx: tx, ty: ty, zoom: zoom }); | ||
return new Tile({ tx, ty, zoom }); | ||
} | ||
@@ -804,24 +851,25 @@ googleQuadkey(init) { | ||
}); | ||
return new Google({ x: x, y: y, zoom: zoom }); | ||
return new Google({ x, y, zoom }); | ||
} | ||
} | ||
exports.GlobalMercator = GlobalMercator; | ||
const mercator = new GlobalMercator(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = { | ||
metersToPixels: metersToPixels, | ||
metersToLatLng: metersToLatLng, | ||
metersToTile: metersToTile, | ||
pixelsToTile: pixelsToTile, | ||
pixelsToMeters: pixelsToMeters, | ||
latLngToMeters: latLngToMeters, | ||
latLngToGoogle: latLngToGoogle, | ||
tileBbox: tileBbox, | ||
tileLatLngBbox: tileLatLngBbox, | ||
tileGoogle: tileGoogle, | ||
tileQuadkey: tileQuadkey, | ||
quadkeyGoogle: quadkeyGoogle, | ||
quadkeyTile: quadkeyTile, | ||
googleBbox: googleBbox, | ||
googleLatLngBbox: googleLatLngBbox, | ||
googleQuadkey: googleQuadkey, | ||
metersToPixels, | ||
metersToLatLng, | ||
metersToTile, | ||
pixelsToTile, | ||
pixelsToMeters, | ||
latLngToMeters, | ||
latLngToGoogle, | ||
tileBbox, | ||
tileLatLngBbox, | ||
tileGoogle, | ||
tileQuadkey, | ||
quadkeyGoogle, | ||
quadkeyTile, | ||
googleBbox, | ||
googleLatLngBbox, | ||
googleQuadkey, | ||
}; | ||
@@ -828,0 +876,0 @@ /* istanbul ignore next */ |
83
index.ts
@@ -111,2 +111,3 @@ import * as Debug from 'debug' | ||
* @param {number} lng Longitude (Meridians) in decimal degrees | ||
* @param {number} zoom Zoom level | ||
* @returns {Object} Google (XYZ) Tile | ||
@@ -127,3 +128,3 @@ * @example | ||
* @param {number} my Latitudes (Parallels) in decimal degrees | ||
* @param {number} [zoom] Zoom level | ||
* @param {number} zoom Zoom level | ||
* @returns {Object} TMS Tile | ||
@@ -348,3 +349,3 @@ * @example | ||
* @param {string} [name=Tile] - name used for debugging message | ||
* @throws Will throw an error if TMS Tile is not valid. | ||
* @throws {Error} Will throw an error if TMS Tile is not valid. | ||
* @returns {Object} TMS Tile | ||
@@ -377,3 +378,3 @@ * @example | ||
* @param {number} zoom Zoom level | ||
* @throws Will throw an error if zoom is not valid. | ||
* @throws {Error} Will throw an error if zoom is not valid. | ||
* @returns {number} zoom Zoom level | ||
@@ -406,3 +407,3 @@ * @example | ||
* @param {Array<number>} Pixels coordinates | ||
* @throws Will throw an error if Pixels is not valid. | ||
* @throws {Error} Will throw an error if Pixels is not valid. | ||
* @returns {Array<number>} Pixels coordinates | ||
@@ -438,3 +439,3 @@ * @example | ||
* @param {Array<number>} Meters coordinates | ||
* @throws Will throw an error if Meters is not valid. | ||
* @throws {Error} Will throw an error if Meters is not valid. | ||
* @returns {Array<number>} Meters coordinates | ||
@@ -482,3 +483,3 @@ * @example | ||
* @param {Array<number>} LatLng coordinates | ||
* @throws Will throw an error if LatLng is not valid. | ||
* @throws {Error} Will throw an error if LatLng is not valid. | ||
* @returns {Array<number>} LatLng coordinates | ||
@@ -499,3 +500,3 @@ * @example | ||
* @param {Array<number>} LngLat coordinates | ||
* @throws Will throw an error if LngLat is not valid. | ||
* @throws {Error} Will throw an error if LngLat is not valid. | ||
* @returns {Array<number>} LngLat coordinates | ||
@@ -540,3 +541,3 @@ * @example | ||
* @param {Array<number>} bbox extent in [minX, minY, maxX, maxY] order | ||
* @throws Will throw an error if bbox is not valid. | ||
* @throws {Error} Will throw an error if bbox is not valid. | ||
* @returns {Array<number>} bbox extent in [minX, minY, maxX, maxY] order | ||
@@ -564,3 +565,3 @@ * @example | ||
* @param {string} [name] - name used for debugging message | ||
* @throws Will throw an error if any item in Object is undefined. | ||
* @throws {Error} Will throw an error if any item in Object is undefined. | ||
* @returns {Object} items | ||
@@ -584,2 +585,10 @@ * @example | ||
/** | ||
* {@link Google} (XYZ) Tile | ||
* | ||
* @class Google | ||
* @property {number} x Google (XYZ) Tile X | ||
* @property {number} y Google (XYZ) Tile Y | ||
* @property {number} zoom Zoom level | ||
*/ | ||
export class Google { | ||
@@ -599,2 +608,10 @@ public x: number | ||
/** | ||
* TMS {@link Tile} | ||
* | ||
* @class Tile | ||
* @property {number} tx TMS Tile X | ||
* @property {number} ty TMS Tile Y | ||
* @property {number} zoom Zoom level | ||
*/ | ||
export class Tile { | ||
@@ -615,2 +632,10 @@ public tx: number | ||
/** | ||
* {@link Pixels} coordinates | ||
* | ||
* @class Pixels | ||
* @property {number} px Pixels X | ||
* @property {number} py Pixels Y | ||
* @property {number} zoom Zoom level | ||
*/ | ||
export class Pixels { | ||
@@ -631,2 +656,10 @@ public px: number | ||
/** | ||
* {@link Meters} coordinates | ||
* | ||
* @class Meters | ||
* @property {number} mx Longitudes (Meridians) in meters | ||
* @property {number} my Latitudes (Parallels) in decimal degrees | ||
* @property {number} zoom Zoom level | ||
*/ | ||
export class Meters { | ||
@@ -647,2 +680,10 @@ public mx: number | ||
/** | ||
* {@link LatLng} coordinates | ||
* | ||
* @class LatLng | ||
* @property {number} lat Latitude (Parallels) in decimal degrees | ||
* @property {number} lng Longitude (Meridians) in decimal degrees | ||
* @property {number} zoom Zoom level | ||
*/ | ||
export class LatLng { | ||
@@ -663,11 +704,17 @@ public lat: number | ||
class GlobalMercator { | ||
/** | ||
* GlobalMercator | ||
* | ||
* @class GlobalMercator | ||
* @property {number} [tileSize=256] Tile size dimension | ||
*/ | ||
export class GlobalMercator { | ||
public name: string = 'GlobalMercator' | ||
private TileSize: number | ||
private tileSize: number | ||
private initialResolution: number | ||
private originShift: number | ||
constructor(TileSize: number = 256) { | ||
this.TileSize = TileSize | ||
this.initialResolution = 2 * Math.PI * 6378137 / this.TileSize | ||
constructor(tileSize: number = 256) { | ||
this.tileSize = tileSize | ||
this.initialResolution = 2 * Math.PI * 6378137 / this.tileSize | ||
this.originShift = 2 * Math.PI * 6378137 / 2.0 | ||
@@ -741,4 +788,4 @@ } | ||
const {px, py, zoom} = new Pixels(init) | ||
let tx = Math.ceil(px / this.TileSize) - 1 | ||
let ty = Math.ceil(py / this.TileSize) - 1 | ||
let tx = Math.ceil(px / this.tileSize) - 1 | ||
let ty = Math.ceil(py / this.tileSize) - 1 | ||
if (tx < 0) { tx = 0 } | ||
@@ -751,4 +798,4 @@ if (ty < 0) { ty = 0 } | ||
const {tx, ty, zoom} = new Tile(init) | ||
let min = this.pixelsToMeters({ px: tx * this.TileSize, py: ty * this.TileSize, zoom }) | ||
let max = this.pixelsToMeters({ px: (tx + 1) * this.TileSize, py: (ty + 1) * this.TileSize, zoom }) | ||
let min = this.pixelsToMeters({ px: tx * this.tileSize, py: ty * this.tileSize, zoom }) | ||
let max = this.pixelsToMeters({ px: (tx + 1) * this.tileSize, py: (ty + 1) * this.tileSize, zoom }) | ||
@@ -755,0 +802,0 @@ return validateBbox([ min.mx, min.my, max.mx, max.my ]) |
{ | ||
"name": "global-mercator", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Global Mercator", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -113,2 +113,3 @@ [![Build Status](https://travis-ci.org/DenisCarriere/global-mercator.svg?branch=master)](https://travis-ci.org/DenisCarriere/global-mercator) | ||
- `lng` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Longitude (Meridians) in decimal degrees | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
@@ -132,3 +133,3 @@ **Examples** | ||
- `my` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Latitudes (Parallels) in decimal degrees | ||
- `zoom` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Zoom level | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
@@ -405,3 +406,3 @@ **Examples** | ||
- Throws **any** Will throw an error if TMS Tile is not valid. | ||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Will throw an error if TMS Tile is not valid. | ||
@@ -429,3 +430,3 @@ Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** TMS Tile | ||
- Throws **any** Will throw an error if zoom is not valid. | ||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Will throw an error if zoom is not valid. | ||
@@ -449,3 +450,3 @@ Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** zoom Zoom level | ||
- Throws **any** Will throw an error if Pixels is not valid. | ||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Will throw an error if Pixels is not valid. | ||
@@ -469,3 +470,3 @@ Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** Pixels coordinates | ||
- Throws **any** Will throw an error if Meters is not valid. | ||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Will throw an error if Meters is not valid. | ||
@@ -489,3 +490,3 @@ Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** Meters coordinates | ||
- Throws **any** Will throw an error if LatLng is not valid. | ||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Will throw an error if LatLng is not valid. | ||
@@ -509,3 +510,3 @@ Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** LatLng coordinates | ||
- Throws **any** Will throw an error if LngLat is not valid. | ||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Will throw an error if LngLat is not valid. | ||
@@ -531,3 +532,3 @@ Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** LngLat coordinates | ||
- Throws **any** Will throw an error if bbox is not valid. | ||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Will throw an error if bbox is not valid. | ||
@@ -554,4 +555,62 @@ Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** bbox extent in [minX, minY, maxX, maxY] order | ||
- Throws **any** Will throw an error if any item in Object is undefined. | ||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Will throw an error if any item in Object is undefined. | ||
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** items | ||
[Google](https://en.wikipedia.org/wiki/Tiled_web_map) (XYZ) Tile | ||
**Properties** | ||
- `x` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Google (XYZ) Tile X | ||
- `y` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Google (XYZ) Tile Y | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
# Tile | ||
TMS [Tile](https://en.wikipedia.org/wiki/Tiled_web_map) | ||
**Properties** | ||
- `tx` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** TMS Tile X | ||
- `ty` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** TMS Tile Y | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
# Pixels | ||
[Pixels](https://msdn.microsoft.com/en-us/library/bb259689.aspx) coordinates | ||
**Properties** | ||
- `px` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Pixels X | ||
- `py` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Pixels Y | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
# Meters | ||
[Meters](https://en.wikipedia.org/wiki/Web_Mercator) coordinates | ||
**Properties** | ||
- `mx` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Longitudes (Meridians) in meters | ||
- `my` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Latitudes (Parallels) in decimal degrees | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
# LatLng | ||
[LatLng](https://en.wikipedia.org/wiki/World_Geodetic_System) coordinates | ||
**Properties** | ||
- `lat` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Latitude (Parallels) in decimal degrees | ||
- `lng` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Longitude (Meridians) in decimal degrees | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
# GlobalMercator | ||
GlobalMercator | ||
**Properties** | ||
- `tileSize` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Tile size dimension |
"use strict"; | ||
const ava_1 = require('ava'); | ||
const lodash_1 = require('lodash'); | ||
const mercator = require('./index'); | ||
const ava_1 = require("ava"); | ||
const lodash_1 = require("lodash"); | ||
const mercator = require("./index"); | ||
const TILE = { tx: 2389, ty: 5245, zoom: 13 }; | ||
@@ -22,3 +22,3 @@ const GOOGLE = { x: 2389, y: 2946, zoom: 13 }; | ||
const { lat, lng, zoom } = latlng; | ||
t.deepEqual({ lat: lat, lng: lng, zoom: zoom }, LATLNG); | ||
t.deepEqual({ lat, lng, zoom }, LATLNG); | ||
}); | ||
@@ -25,0 +25,0 @@ ava_1.default('metersToPixels', t => { |
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
875602
23427
607