global-mercator
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -10,5 +10,5 @@ [![Build Status](https://travis-ci.org/DenisCarriere/global-mercator.svg?branch=master)](https://travis-ci.org/DenisCarriere/global-mercator) | ||
# Installation | ||
Works well using [`tilebelt`](https://github.com/mapbox/tilebelt). | ||
Using npm: | ||
## Install | ||
@@ -19,9 +19,47 @@ ```bash | ||
In Node.js: | ||
## Quickstart | ||
```javascript | ||
import * as mercator from 'global-mercator' | ||
import { latLngToMeters } from 'global-mercator' | ||
const tile = [10, 15, 8] // x, y, zoom | ||
console.log(mercator.tileToBBox(tile)) | ||
console.log(mercator.tileToGoogle(tile)) | ||
``` | ||
## Tests | ||
```bash | ||
$ npm test | ||
``` | ||
## Documentation | ||
```bash | ||
$ npm run docs | ||
``` | ||
## Features | ||
| Function | Description | | ||
|----------------------------|-------------| | ||
| lngLatToMeters(lnglat) | Converts LngLat coordinates to Meters coordinates. | ||
| metersToLngLat(meters) | Converts Meters coordinates to LngLat coordinates. | ||
| metersToPixels(meters) | Converts Meters coordinates to Pixels coordinates. | ||
| lngLatToTile(lnglat) | Converts LngLat coordinates to TMS Tile. | ||
| lngLatToGoogle(lnglat) | Converts LngLat coordinates to Google (XYZ) Tile. | ||
| metersToTile(meters) | Converts Meters coordinates to TMS Tile. | ||
| pixelsToMeters(pixels) | Converts Pixels coordinates to Meters coordinates. | ||
| pixelsToTile(pixels) | Converts Pixels coordinates to TMS Tile. | ||
| tileToBBoxMeters(tile) | Converts TMS Tile to bbox in Meters coordinates. | ||
| tileToBBox(tile) | Converts TMS Tile to bbox in LngLat coordinates. | ||
| googleToBBoxMeters(google) | Converts Google (XYZ) Tile to bbox in Meters coordinates. | ||
| googleToBBox(google) | Converts Google (XYZ) Tile to bbox in LngLat coordinates. | ||
| tileToGoogle(tile) | Converts TMS Tile to Google (XYZ) Tile. | ||
| googleToTile(google) | Converts Google (XYZ) Tile to TMS Tile. | ||
| googleToQuadkey(google) | Converts Google (XYZ) Tile to Quadkey. | ||
| tileToQuadkey(tile) | Converts TMS Tile to QuadKey. | ||
| quadkeyToTile(quadkey) | Converts Quadkey to TMS Tile. | ||
| quadkeyToGoogle(quadkey) | Converts Quadkey to Google (XYZ) Tile. | ||
| bboxToMeters(bbox) | Converts BBox from LngLat coordinates to Meters coordinates |
@@ -92,3 +92,3 @@ "use strict"; | ||
* @example | ||
* const google = lngLatToGoogle({lat: 37, lng: 126, zoom: 13 }) | ||
* const google = lngLatToGoogle([37, 126, 13]) | ||
@@ -484,3 +484,2 @@ */ | ||
* validatePixels([-115, 44]) | ||
* //= [-115, 44] | ||
*/ | ||
@@ -502,3 +501,4 @@ function validatePixels(pixels) { | ||
* validateMeters([-115, 44]) | ||
* //= [-115, 44] | ||
* validateMeters([-230, 999000000]) | ||
* //= Error: Meters [y] cannot be greater than 20037508.342789244 | ||
*/ | ||
@@ -539,3 +539,2 @@ function validateMeters(meters) { | ||
* validateLngLat([-115, 44]) | ||
* //= [-115, 44] | ||
* validateLngLat([-225, 44]) | ||
@@ -542,0 +541,0 @@ * //= Error: LngLat [lng] must be within -180 to 180 degrees |
@@ -123,3 +123,3 @@ export const tileSize = 256 | ||
* @example | ||
* const google = lngLatToGoogle({lat: 37, lng: 126, zoom: 13 }) | ||
* const google = lngLatToGoogle([37, 126, 13]) | ||
@@ -505,3 +505,2 @@ */ | ||
* validatePixels([-115, 44]) | ||
* //= [-115, 44] | ||
*/ | ||
@@ -523,3 +522,4 @@ export function validatePixels(pixels: Pixels): Pixels { | ||
* validateMeters([-115, 44]) | ||
* //= [-115, 44] | ||
* validateMeters([-230, 999000000]) | ||
* //= Error: Meters [y] cannot be greater than 20037508.342789244 | ||
*/ | ||
@@ -560,3 +560,2 @@ export function validateMeters(meters: Meters): Meters { | ||
* validateLngLat([-115, 44]) | ||
* //= [-115, 44] | ||
* validateLngLat([-225, 44]) | ||
@@ -563,0 +562,0 @@ * //= Error: LngLat [lng] must be within -180 to 180 degrees |
{ | ||
"name": "global-mercator", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Global Mercator", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -10,5 +10,5 @@ [![Build Status](https://travis-ci.org/DenisCarriere/global-mercator.svg?branch=master)](https://travis-ci.org/DenisCarriere/global-mercator) | ||
# Installation | ||
Works well using [`tilebelt`](https://github.com/mapbox/tilebelt). | ||
Using npm: | ||
## Install | ||
@@ -19,12 +19,49 @@ ```bash | ||
In Node.js: | ||
## Quickstart | ||
```javascript | ||
import * as mercator from 'global-mercator' | ||
import { latLngToMeters } from 'global-mercator' | ||
const tile = [10, 15, 8] // x, y, zoom | ||
console.log(mercator.tileToBBox(tile)) | ||
console.log(mercator.tileToGoogle(tile)) | ||
``` | ||
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
## Tests | ||
```bash | ||
$ npm test | ||
``` | ||
## Documentation | ||
```bash | ||
$ npm run docs | ||
``` | ||
## Features | ||
| Function | Description | | ||
|----------------------------|-------------| | ||
| lngLatToMeters(lnglat) | Converts LngLat coordinates to Meters coordinates. | ||
| metersToLngLat(meters) | Converts Meters coordinates to LngLat coordinates. | ||
| metersToPixels(meters) | Converts Meters coordinates to Pixels coordinates. | ||
| lngLatToTile(lnglat) | Converts LngLat coordinates to TMS Tile. | ||
| lngLatToGoogle(lnglat) | Converts LngLat coordinates to Google (XYZ) Tile. | ||
| metersToTile(meters) | Converts Meters coordinates to TMS Tile. | ||
| pixelsToMeters(pixels) | Converts Pixels coordinates to Meters coordinates. | ||
| pixelsToTile(pixels) | Converts Pixels coordinates to TMS Tile. | ||
| tileToBBoxMeters(tile) | Converts TMS Tile to bbox in Meters coordinates. | ||
| tileToBBox(tile) | Converts TMS Tile to bbox in LngLat coordinates. | ||
| googleToBBoxMeters(google) | Converts Google (XYZ) Tile to bbox in Meters coordinates. | ||
| googleToBBox(google) | Converts Google (XYZ) Tile to bbox in LngLat coordinates. | ||
| tileToGoogle(tile) | Converts TMS Tile to Google (XYZ) Tile. | ||
| googleToTile(google) | Converts Google (XYZ) Tile to TMS Tile. | ||
| googleToQuadkey(google) | Converts Google (XYZ) Tile to Quadkey. | ||
| tileToQuadkey(tile) | Converts TMS Tile to QuadKey. | ||
| quadkeyToTile(quadkey) | Converts Quadkey to TMS Tile. | ||
| quadkeyToGoogle(quadkey) | Converts Quadkey to Google (XYZ) Tile. | ||
| bboxToMeters(bbox) | Converts BBox from LngLat coordinates to Meters coordinates<!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
# lngLatToMeters | ||
@@ -124,3 +161,3 @@ | ||
```javascript | ||
const google = lngLatToGoogle({lat: 37, lng: 126, zoom: 13 }) | ||
const google = lngLatToGoogle([37, 126, 13]) | ||
@@ -479,3 +516,2 @@ ``` | ||
validatePixels([-115, 44]) | ||
//= [-115, 44] | ||
``` | ||
@@ -502,3 +538,4 @@ | ||
validateMeters([-115, 44]) | ||
//= [-115, 44] | ||
validateMeters([-230, 999000000]) | ||
//= Error: Meters [y] cannot be greater than 20037508.342789244 | ||
``` | ||
@@ -525,3 +562,2 @@ | ||
validateLngLat([-115, 44]) | ||
//= [-115, 44] | ||
validateLngLat([-225, 44]) | ||
@@ -528,0 +564,0 @@ //= Error: LngLat [lng] must be within -180 to 180 degrees |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
121558
586
0
1467