global-mercator
Advanced tools
Comparing version
199
index.js
@@ -450,22 +450,2 @@ "use strict"; | ||
exports.validateBounds = validateBounds; | ||
/** | ||
* LngLatBounds | ||
* @name LngLatBounds | ||
* @example | ||
* const { bounds } = new LngLatBounds([ -75, 44, -74, 45 ]) | ||
* //= [ -75, 44, -74, 45 ] | ||
*/ | ||
class LngLatBounds { | ||
constructor(init) { | ||
const [x1, y1, x2, y2] = validateBounds(init); | ||
this.x1 = x1; | ||
this.y1 = y1; | ||
this.x2 = x2; | ||
this.y2 = y2; | ||
this.t1 = validateLngLat([x1, y1]); | ||
this.t2 = validateLngLat([x2, y2]); | ||
this.bounds = [x1, y1, x2, y2]; | ||
} | ||
} | ||
exports.LngLatBounds = LngLatBounds; | ||
class Google { | ||
@@ -529,23 +509,5 @@ constructor(init) { | ||
exports.LatLng = LatLng; | ||
/** | ||
* Global Mercator | ||
* @name GlobalMercator | ||
* @example | ||
* const mercator = GlobalMercator() | ||
* mercator.LatLngToMeters(Tile) | ||
*/ | ||
class GlobalMercator { | ||
/** | ||
* Initialize the TMS Global Mercator pyramid | ||
* @param {number} TileSize (default=256) | ||
*/ | ||
constructor(TileSize = 256) { | ||
this.name = 'GlobalMercator'; | ||
/** | ||
* Converts bounds from LatLng to Meters | ||
* | ||
* @name boundsLatLngToMeters | ||
* @param {Array<number>} bbox extent in [minX, minY, maxX, maxY] order | ||
* @returns {Array<number>} bounds | ||
*/ | ||
this.boundsLatLngToMeters = (bounds) => { | ||
@@ -560,20 +522,5 @@ const min = this.latLngToMeters({ lat: bounds[1], lng: bounds[0] }); | ||
} | ||
/** | ||
* Resolution (Meters/pixel) for given zoom level (measured at Equator) | ||
* | ||
* @name Resolution | ||
* @param {number} zoom | ||
* @returns {number} | ||
*/ | ||
Resolution(zoom) { | ||
return this.initialResolution / Math.pow(2, zoom); | ||
} | ||
/** | ||
* Converts given lat/lon in WGS84 Datum to XY in Spherical Mercator EPSG:900913 | ||
* | ||
* @name latLngToMeters | ||
* @param {number} lat | ||
* @param {number} lng | ||
* @returns {Meters} | ||
*/ | ||
latLngToMeters(init) { | ||
@@ -586,10 +533,2 @@ const { lat, lng, zoom } = new LatLng(init); | ||
} | ||
/** | ||
* Converts XY point from Spherical Mercator EPSG:900913 to lat/lng in WGS84 Datum | ||
* | ||
* @name metersToLatLng | ||
* @param {number} mx | ||
* @param {number} my | ||
* @returns {LatLng} | ||
*/ | ||
metersToLatLng(init) { | ||
@@ -602,11 +541,2 @@ const { mx, my, zoom } = new Meters(init); | ||
} | ||
/** | ||
* Converts EPSG:900913 to pyramid pixel coordinates in given zoom level | ||
* | ||
* @name metersToPixels | ||
* @param {number} mx | ||
* @param {number} my | ||
* @param {number} zoom | ||
* @returns {Pixels} | ||
*/ | ||
metersToPixels(init) { | ||
@@ -619,11 +549,2 @@ const { mx, my, zoom } = new Meters(init); | ||
} | ||
/** | ||
* Returns Tile for given latlng coordinates | ||
* | ||
* @name latLngToTile | ||
* @param {number} lat | ||
* @param {number} lng | ||
* @param {number} zoom | ||
* @returns {Tile} | ||
*/ | ||
latLngToTile(init) { | ||
@@ -634,10 +555,2 @@ const meters = this.latLngToMeters(init); | ||
} | ||
/** | ||
* Returns Google Tile for given latlng coordinates | ||
* | ||
* @name latLngToTile | ||
* @param {number} lat | ||
* @param {number} lng | ||
* @returns {Google} Google Tile | ||
*/ | ||
latLngToGoogle(init) { | ||
@@ -650,10 +563,2 @@ if (init.zoom === 0) { | ||
} | ||
/** | ||
* Returns Tile for given mercator coordinates | ||
* | ||
* @name metersToTile | ||
* @param {number} mx | ||
* @param {number} my | ||
* @returns {Tile} | ||
*/ | ||
metersToTile(init) { | ||
@@ -666,11 +571,2 @@ if (init.zoom === 0) { | ||
} | ||
/** | ||
* Converts pixel coordinates in given zoom level of pyramid to EPSG:900913 | ||
* | ||
* @name pixelsToMeters | ||
* @param {number} px | ||
* @param {number} py | ||
* @param {number} zoom | ||
* @returns {Meters} | ||
*/ | ||
pixelsToMeters(init) { | ||
@@ -683,11 +579,2 @@ const { px, py, zoom } = new Pixels(init); | ||
} | ||
/** | ||
* Returns a Tile covering region in given pixel coordinates | ||
* | ||
* @name pixelsToTile | ||
* @param {number} px | ||
* @param {number} py | ||
* @param {number} zoom | ||
* @returns {Tile} | ||
*/ | ||
pixelsToTile(init) { | ||
@@ -708,11 +595,2 @@ if (init.zoom === 0) { | ||
} | ||
/** | ||
* Returns bounds of the given Tile in EPSG:900913 coordinates | ||
* | ||
* @name tileBounds | ||
* @param {number} tx | ||
* @param {number} ty | ||
* @param {number} zoom | ||
* @returns {Array<number>} bbox extent in [minX, minY, maxX, maxY] order | ||
*/ | ||
tileBounds(init) { | ||
@@ -724,11 +602,2 @@ const { tx, ty, zoom } = new Tile(init); | ||
} | ||
/** | ||
* Returns bounds of the given Tile in EPSG:900913 coordinates | ||
* | ||
* @name tileLatLonBounds | ||
* @param {number} tx | ||
* @param {number} ty | ||
* @param {number} zoom | ||
* @returns {Array<number>} bbox extent in [minX, minY, maxX, maxY] order | ||
*/ | ||
tileLatLonBounds(init) { | ||
@@ -744,11 +613,2 @@ if (init.zoom === 0) { | ||
} | ||
/** | ||
* Converts Google Tile system in Mercator bounds (Meters) | ||
* | ||
* @name googleBounds | ||
* @param {number} x | ||
* @param {number} y | ||
* @param {number} zoom | ||
* @returns {Array<number>} bbox extent in [minX, minY, maxX, maxY] order | ||
*/ | ||
googleBounds(init) { | ||
@@ -758,11 +618,2 @@ const Tile = this.googleTile(init); | ||
} | ||
/** | ||
* Converts Google Tile system in LatLng bounds (degrees) | ||
* | ||
* @name googleLatLonBounds | ||
* @param {number} x | ||
* @param {number} y | ||
* @param {number} zoom | ||
* @returns {Array<number>} bbox extent in [minX, minY, maxX, maxY] order | ||
*/ | ||
googleLatLonBounds(init) { | ||
@@ -772,11 +623,2 @@ const Tile = this.googleTile(init); | ||
} | ||
/** | ||
* Converts TMS Tile coordinates to Google Tile coordinates | ||
* | ||
* @name tileGoogle | ||
* @param {number} tx | ||
* @param {number} ty | ||
* @param {number} zoom | ||
* @returns {Array<number>} bbox extent in [minX, minY, maxX, maxY] order | ||
*/ | ||
tileGoogle(init) { | ||
@@ -791,11 +633,2 @@ if (init.zoom === 0) { | ||
} | ||
/** | ||
* Converts Google Tile coordinates to TMS Tile coordinates | ||
* | ||
* @name googleTile | ||
* @param {number} x | ||
* @param {number} y | ||
* @param {number} zoom | ||
* @returns {Tile} | ||
*/ | ||
googleTile(init) { | ||
@@ -807,11 +640,2 @@ const { x, y, zoom } = new Google(init); | ||
} | ||
/** | ||
* Converts Google Tile coordinates to Microsoft QuadKey | ||
* | ||
* @name googleTile | ||
* @param {number} x | ||
* @param {number} y | ||
* @param {number} zoom | ||
* @returns {quadkey} | ||
*/ | ||
googleQuadKey(init) { | ||
@@ -821,11 +645,2 @@ const Tile = this.googleTile(init); | ||
} | ||
/** | ||
* Converts TMS Tile coordinates to Microsoft QuadKey | ||
* | ||
* @name tileQuadKey | ||
* @param {number} tx | ||
* @param {number} ty | ||
* @param {number} zoom | ||
* @returns {quadkey} | ||
*/ | ||
tileQuadKey(init) { | ||
@@ -852,9 +667,2 @@ // Zoom 0 does not exist for QuadKey | ||
} | ||
/** | ||
* Converts QuadKey to TMS Tile coordinates | ||
* | ||
* @name quadKeyTile | ||
* @param {string} quadkey | ||
* @returns {Tile} | ||
*/ | ||
quadKeyTile(quadkey) { | ||
@@ -864,9 +672,2 @@ const Google = this.quadKeyGoogle(quadkey); | ||
} | ||
/** | ||
* Converts QuadKey to Google Tile | ||
* | ||
* @name quadKeyGoogle | ||
* @param {string} quadkey | ||
* @returns {Google} | ||
*/ | ||
quadKeyGoogle(quadkey) { | ||
@@ -873,0 +674,0 @@ let x = 0; |
209
index.ts
@@ -43,3 +43,3 @@ import * as Debug from 'debug' | ||
* Converts given lat/lon in WGS84 Datum to XY in Spherical Mercator EPSG:900913 | ||
* | ||
* | ||
* @name latLngToMeters | ||
@@ -480,30 +480,2 @@ * @param {number} lat | ||
/** | ||
* LngLatBounds | ||
* @name LngLatBounds | ||
* @example | ||
* const { bounds } = new LngLatBounds([ -75, 44, -74, 45 ]) | ||
* //= [ -75, 44, -74, 45 ] | ||
*/ | ||
export class LngLatBounds { | ||
public x1: number | ||
public y1: number | ||
public x2: number | ||
public y2: number | ||
public bounds: number[] | ||
public t1: number[] | ||
public t2: number[] | ||
constructor(init: number[]) { | ||
const [x1, y1, x2, y2] = validateBounds(init) | ||
this.x1 = x1 | ||
this.y1 = y1 | ||
this.x2 = x2 | ||
this.y2 = y2 | ||
this.t1 = validateLngLat([x1, y1]) | ||
this.t2 = validateLngLat([x2, y2]) | ||
this.bounds = [x1, y1, x2, y2] | ||
} | ||
} | ||
export class Google { | ||
@@ -583,9 +555,2 @@ public x: number | ||
/** | ||
* Global Mercator | ||
* @name GlobalMercator | ||
* @example | ||
* const mercator = GlobalMercator() | ||
* mercator.LatLngToMeters(Tile) | ||
*/ | ||
class GlobalMercator { | ||
@@ -597,6 +562,2 @@ public name: string = 'GlobalMercator' | ||
/** | ||
* Initialize the TMS Global Mercator pyramid | ||
* @param {number} TileSize (default=256) | ||
*/ | ||
constructor(TileSize: number = 256) { | ||
@@ -608,9 +569,2 @@ this.TileSize = TileSize | ||
/** | ||
* Resolution (Meters/pixel) for given zoom level (measured at Equator) | ||
* | ||
* @name Resolution | ||
* @param {number} zoom | ||
* @returns {number} | ||
*/ | ||
public Resolution(zoom: number) { | ||
@@ -620,10 +574,2 @@ return this.initialResolution / Math.pow(2, zoom) | ||
/** | ||
* Converts given lat/lon in WGS84 Datum to XY in Spherical Mercator EPSG:900913 | ||
* | ||
* @name latLngToMeters | ||
* @param {number} lat | ||
* @param {number} lng | ||
* @returns {Meters} | ||
*/ | ||
public latLngToMeters(init: InterfaceLatLng) { | ||
@@ -637,10 +583,2 @@ const { lat, lng, zoom } = new LatLng(init) | ||
/** | ||
* Converts XY point from Spherical Mercator EPSG:900913 to lat/lng in WGS84 Datum | ||
* | ||
* @name metersToLatLng | ||
* @param {number} mx | ||
* @param {number} my | ||
* @returns {LatLng} | ||
*/ | ||
public metersToLatLng(init: InterfaceMeters) { | ||
@@ -655,11 +593,2 @@ const { mx, my, zoom } = new Meters(init) | ||
/** | ||
* Converts EPSG:900913 to pyramid pixel coordinates in given zoom level | ||
* | ||
* @name metersToPixels | ||
* @param {number} mx | ||
* @param {number} my | ||
* @param {number} zoom | ||
* @returns {Pixels} | ||
*/ | ||
public metersToPixels(init: InterfaceMeters) { | ||
@@ -674,11 +603,2 @@ const { mx, my, zoom } = new Meters(init) | ||
/** | ||
* Returns Tile for given latlng coordinates | ||
* | ||
* @name latLngToTile | ||
* @param {number} lat | ||
* @param {number} lng | ||
* @param {number} zoom | ||
* @returns {Tile} | ||
*/ | ||
public latLngToTile(init: InterfaceLatLng) { | ||
@@ -690,10 +610,2 @@ const meters = this.latLngToMeters(init) | ||
/** | ||
* Returns Google Tile for given latlng coordinates | ||
* | ||
* @name latLngToTile | ||
* @param {number} lat | ||
* @param {number} lng | ||
* @returns {Google} Google Tile | ||
*/ | ||
public latLngToGoogle(init: InterfaceLatLng) { | ||
@@ -705,10 +617,2 @@ if (init.zoom === 0) { return new Google({ x: 0, y: 0, zoom: 0 })} | ||
/** | ||
* Returns Tile for given mercator coordinates | ||
* | ||
* @name metersToTile | ||
* @param {number} mx | ||
* @param {number} my | ||
* @returns {Tile} | ||
*/ | ||
public metersToTile(init: Meters) { | ||
@@ -720,11 +624,2 @@ if (init.zoom === 0) { return new Tile({ tx: 0, ty: 0, zoom: 0 })} | ||
/** | ||
* Converts pixel coordinates in given zoom level of pyramid to EPSG:900913 | ||
* | ||
* @name pixelsToMeters | ||
* @param {number} px | ||
* @param {number} py | ||
* @param {number} zoom | ||
* @returns {Meters} | ||
*/ | ||
public pixelsToMeters(init: Pixels) { | ||
@@ -739,11 +634,2 @@ const {px, py, zoom} = new Pixels(init) | ||
/** | ||
* Returns a Tile covering region in given pixel coordinates | ||
* | ||
* @name pixelsToTile | ||
* @param {number} px | ||
* @param {number} py | ||
* @param {number} zoom | ||
* @returns {Tile} | ||
*/ | ||
public pixelsToTile(init: Pixels) { | ||
@@ -759,11 +645,2 @@ if (init.zoom === 0) { return new Tile({ tx: 0, ty: 0, zoom: 0 })} | ||
/** | ||
* Returns bounds of the given Tile in EPSG:900913 coordinates | ||
* | ||
* @name tileBounds | ||
* @param {number} tx | ||
* @param {number} ty | ||
* @param {number} zoom | ||
* @returns {Array<number>} bbox extent in [minX, minY, maxX, maxY] order | ||
*/ | ||
public tileBounds(init: Tile) { | ||
@@ -777,11 +654,2 @@ const {tx, ty, zoom} = new Tile(init) | ||
/** | ||
* Returns bounds of the given Tile in EPSG:900913 coordinates | ||
* | ||
* @name tileLatLonBounds | ||
* @param {number} tx | ||
* @param {number} ty | ||
* @param {number} zoom | ||
* @returns {Array<number>} bbox extent in [minX, minY, maxX, maxY] order | ||
*/ | ||
public tileLatLonBounds(init: Tile) { | ||
@@ -798,11 +666,2 @@ if (init.zoom === 0) { return [ -180, -85.05112877980659, 180, 85.05112877980659 ] } | ||
/** | ||
* Converts Google Tile system in Mercator bounds (Meters) | ||
* | ||
* @name googleBounds | ||
* @param {number} x | ||
* @param {number} y | ||
* @param {number} zoom | ||
* @returns {Array<number>} bbox extent in [minX, minY, maxX, maxY] order | ||
*/ | ||
public googleBounds(init: Google) { | ||
@@ -813,11 +672,2 @@ const Tile = this.googleTile(init) | ||
/** | ||
* Converts Google Tile system in LatLng bounds (degrees) | ||
* | ||
* @name googleLatLonBounds | ||
* @param {number} x | ||
* @param {number} y | ||
* @param {number} zoom | ||
* @returns {Array<number>} bbox extent in [minX, minY, maxX, maxY] order | ||
*/ | ||
public googleLatLonBounds(init: Google) { | ||
@@ -828,9 +678,2 @@ const Tile = this.googleTile(init) | ||
/** | ||
* Converts bounds from LatLng to Meters | ||
* | ||
* @name boundsLatLngToMeters | ||
* @param {Array<number>} bbox extent in [minX, minY, maxX, maxY] order | ||
* @returns {Array<number>} bounds | ||
*/ | ||
public boundsLatLngToMeters = (bounds: number[]): number[] => { | ||
@@ -842,11 +685,2 @@ const min = this.latLngToMeters({lat: bounds[1], lng: bounds[0]}) | ||
/** | ||
* Converts TMS Tile coordinates to Google Tile coordinates | ||
* | ||
* @name tileGoogle | ||
* @param {number} tx | ||
* @param {number} ty | ||
* @param {number} zoom | ||
* @returns {Array<number>} bbox extent in [minX, minY, maxX, maxY] order | ||
*/ | ||
public tileGoogle(init: Tile) { | ||
@@ -862,11 +696,2 @@ if (init.zoom === 0) { return new Google({ x: 0, y: 0, zoom: 0 })} | ||
/** | ||
* Converts Google Tile coordinates to TMS Tile coordinates | ||
* | ||
* @name googleTile | ||
* @param {number} x | ||
* @param {number} y | ||
* @param {number} zoom | ||
* @returns {Tile} | ||
*/ | ||
public googleTile(init: Google) { | ||
@@ -880,11 +705,2 @@ const { x, y, zoom } = new Google(init) | ||
/** | ||
* Converts Google Tile coordinates to Microsoft QuadKey | ||
* | ||
* @name googleTile | ||
* @param {number} x | ||
* @param {number} y | ||
* @param {number} zoom | ||
* @returns {quadkey} | ||
*/ | ||
public googleQuadKey(init: Google) { | ||
@@ -895,11 +711,2 @@ const Tile = this.googleTile(init) | ||
/** | ||
* Converts TMS Tile coordinates to Microsoft QuadKey | ||
* | ||
* @name tileQuadKey | ||
* @param {number} tx | ||
* @param {number} ty | ||
* @param {number} zoom | ||
* @returns {quadkey} | ||
*/ | ||
public tileQuadKey(init: Tile) { | ||
@@ -924,9 +731,2 @@ // Zoom 0 does not exist for QuadKey | ||
/** | ||
* Converts QuadKey to TMS Tile coordinates | ||
* | ||
* @name quadKeyTile | ||
* @param {string} quadkey | ||
* @returns {Tile} | ||
*/ | ||
public quadKeyTile(quadkey: string) { | ||
@@ -937,9 +737,2 @@ const Google = this.quadKeyGoogle(quadkey) | ||
/** | ||
* Converts QuadKey to Google Tile | ||
* | ||
* @name quadKeyGoogle | ||
* @param {string} quadkey | ||
* @returns {Google} | ||
*/ | ||
public quadKeyGoogle(quadkey: string) { | ||
@@ -946,0 +739,0 @@ let x: number = 0 |
{ | ||
"name": "global-mercator", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Global Mercator", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
258
README.md
@@ -22,13 +22,2 @@ <!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
# latLngToMeters | ||
Converts given lat/lon in WGS84 Datum to XY in Spherical Mercator EPSG:900913 | ||
**Parameters** | ||
- `lat` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `lng` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
Returns **Meters** | ||
# metersToLatLng | ||
@@ -53,13 +42,2 @@ | ||
# metersToLatLng | ||
Converts XY point from Spherical Mercator EPSG:900913 to lat/lng in WGS84 Datum | ||
**Parameters** | ||
- `mx` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `my` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
Returns **LatLng** | ||
# metersToPixels | ||
@@ -84,14 +62,2 @@ | ||
# metersToPixels | ||
Converts EPSG:900913 to pyramid pixel coordinates in given zoom level | ||
**Parameters** | ||
- `mx` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `my` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
Returns **Pixels** | ||
# latLngToTile | ||
@@ -109,25 +75,2 @@ | ||
# latLngToTile | ||
Returns Tile for given latlng coordinates | ||
**Parameters** | ||
- `lat` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `lng` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
Returns **Tile** | ||
# latLngToTile | ||
Returns Google Tile for given latlng coordinates | ||
**Parameters** | ||
- `lat` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `lng` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
Returns **Google** Google Tile | ||
# latLngToGoogle | ||
@@ -155,13 +98,2 @@ | ||
# metersToTile | ||
Returns Tile for given mercator coordinates | ||
**Parameters** | ||
- `mx` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `my` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
Returns **Tile** | ||
# pixelsToMeters | ||
@@ -179,14 +111,2 @@ | ||
# pixelsToMeters | ||
Converts pixel coordinates in given zoom level of pyramid to EPSG:900913 | ||
**Parameters** | ||
- `px` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `py` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
Returns **Meters** | ||
# pixelsToTile | ||
@@ -204,14 +124,2 @@ | ||
# pixelsToTile | ||
Returns a Tile covering region in given pixel coordinates | ||
**Parameters** | ||
- `px` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `py` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
Returns **Tile** | ||
# tileBounds | ||
@@ -229,14 +137,2 @@ | ||
# tileBounds | ||
Returns bounds of the given Tile in EPSG:900913 coordinates | ||
**Parameters** | ||
- `tx` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `ty` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
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 | ||
# tileLatLonBounds | ||
@@ -254,14 +150,2 @@ | ||
# tileLatLonBounds | ||
Returns bounds of the given Tile in EPSG:900913 coordinates | ||
**Parameters** | ||
- `tx` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `ty` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
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 | ||
# googleBounds | ||
@@ -279,14 +163,2 @@ | ||
# googleBounds | ||
Converts Google Tile system in Mercator bounds (Meters) | ||
**Parameters** | ||
- `x` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `y` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
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 | ||
# googleLatLonBounds | ||
@@ -304,14 +176,2 @@ | ||
# googleLatLonBounds | ||
Converts Google Tile system in LatLng bounds (degrees) | ||
**Parameters** | ||
- `x` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `y` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
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 | ||
# tileGoogle | ||
@@ -329,14 +189,2 @@ | ||
# tileGoogle | ||
Converts TMS Tile coordinates to Google Tile coordinates | ||
**Parameters** | ||
- `tx` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `ty` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
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 | ||
# googleTile | ||
@@ -354,26 +202,2 @@ | ||
# googleTile | ||
Converts Google Tile coordinates to TMS Tile coordinates | ||
**Parameters** | ||
- `x` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `y` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
Returns **Tile** | ||
# googleTile | ||
Converts Google Tile coordinates to Microsoft QuadKey | ||
**Parameters** | ||
- `x` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `y` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
Returns **quadkey** | ||
# googleQuadKey | ||
@@ -403,14 +227,2 @@ | ||
# tileQuadKey | ||
Converts TMS Tile coordinates to Microsoft QuadKey | ||
**Parameters** | ||
- `tx` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `ty` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
Returns **quadkey** | ||
# quadKeyTile | ||
@@ -426,12 +238,2 @@ | ||
# quadKeyTile | ||
Converts QuadKey to TMS Tile coordinates | ||
**Parameters** | ||
- `quadkey` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
Returns **Tile** | ||
# quadKeyGoogle | ||
@@ -447,12 +249,2 @@ | ||
# quadKeyGoogle | ||
Converts QuadKey to Google Tile | ||
**Parameters** | ||
- `quadkey` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
Returns **Google** | ||
# boundsLatLngToMeters | ||
@@ -468,12 +260,2 @@ | ||
# boundsLatLngToMeters | ||
Converts bounds from LatLng to Meters | ||
**Parameters** | ||
- `bbox` **[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)>** extent in [minX, minY, maxX, maxY] order | ||
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)>** bounds | ||
# validateUndefined | ||
@@ -570,41 +352,1 @@ | ||
``` | ||
# LngLatBounds | ||
LngLatBounds | ||
**Examples** | ||
```javascript | ||
const { bounds } = new LngLatBounds([ -75, 44, -74, 45 ]) | ||
//= [ -75, 44, -74, 45 ] | ||
``` | ||
# GlobalMercator | ||
Global Mercator | ||
**Examples** | ||
```javascript | ||
const mercator = GlobalMercator() | ||
mercator.LatLngToMeters(Tile) | ||
``` | ||
## constructor | ||
Initialize the TMS Global Mercator pyramid | ||
**Parameters** | ||
- `TileSize` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)](default 256)** (default=256) | ||
# Resolution | ||
Resolution (Meters/pixel) for given zoom level (measured at Equator) | ||
**Parameters** | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** |
@@ -111,6 +111,2 @@ "use strict"; | ||
}); | ||
ava_1.default('LngLatBounds', t => { | ||
const { bounds } = new mercator.LngLatBounds(BOUNDS_LATLNG); | ||
t.deepEqual(bounds, BOUNDS_LATLNG); | ||
}); | ||
ava_1.default('validateLatLng', t => { | ||
@@ -117,0 +113,0 @@ t.deepEqual(mercator.validateLatLng([85, -120]), [85, -120]); |
@@ -134,7 +134,2 @@ import test from 'ava' | ||
test('LngLatBounds', t => { | ||
const { bounds } = new mercator.LngLatBounds(BOUNDS_LATLNG) | ||
t.deepEqual(bounds, BOUNDS_LATLNG) | ||
}) | ||
test('validateLatLng', t => { | ||
@@ -141,0 +136,0 @@ t.deepEqual(mercator.validateLatLng([85, -120]), [85, -120]) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
844353
-2.54%23120
-1.75%335
-43.51%