Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Jul 19, 2017
1 parent fed0c04 commit e22616e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,7 @@

## 2.8.1 - 2017-07-19

- Add `wrapTile` method
- Include tests side by side with `tilebelt`
- Fixed issue with `tileToQuadkey`
- Drop rollup setup
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -522,10 +522,10 @@ Wrap Tile -- Handles tiles which crosses the 180th meridian or 90th parallel
mercator.wrapTile([0, 3, 2])
//= [0, 3, 2] -- Valid Tile X
mercator.wrapTile([4, 2, 2])
//= [0, 2, 2] -- Tile 4 does not exist, wrap around to TileX=0
//= [0, 2, 2] -- Tile 4 does not exist, wrap around to TileX=0
```

Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Tile X
Returns **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Wrapped Tile

### validateZoom

Expand Down
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -536,12 +536,12 @@ function validateTile (tile, validate) {
*
* @param {[number, number, number]} tile Tile
* @param {number} zoom Zoom Level
* @returns {number} Tile X
* @returns {[number, number, number]} Wrapped Tile
* @example
* mercator.wrapTile([0, 3, 2])
* //= [0, 3, 2] -- Valid Tile X
* mercator.wrapTile([4, 2, 2])
* //= [0, 2, 2] -- Tile 4 does not exist, wrap around to TileX=0
* //= [0, 2, 2] -- Tile 4 does not exist, wrap around to TileX=0
*/
function wrapTile (tile) {
var tx = tile[0]
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "global-mercator",
"version": "2.8.2",
"version": "2.8.3",
"description": "Tools to help with TMS, Quadkey & Google (XYZ) Tiles",
"repository": {
"type": "git",
Expand Down
13 changes: 13 additions & 0 deletions test.js
Expand Up @@ -246,3 +246,16 @@ test('pointToTile -- cross meridian', t => {
t.deepEqual(mercator.pointToTile([-175, 95], 2), [0, 3, 2], '[-175, +95] zoom 2')
t.end()
})

// test('tilebelt.pointToTile -- cross meridian', t => {
// // X axis
// t.deepEqual(tilebelt.pointToTile(-180, 85, 2), [0, 0, 2], '[-180, 85] zoom 2')
// t.deepEqual(tilebelt.pointToTile(180, 85, 2), [0, 0, 2], '[+180, 85] zoom 2')
// t.deepEqual(tilebelt.pointToTile(-185, 85, 2), [3, 0, 2], '[-185, 85] zoom 2')
// t.deepEqual(tilebelt.pointToTile(185, 85, 2), [0, 0, 2], '[+185, 85] zoom 2')

// // Y axis
// t.deepEqual(tilebelt.pointToTile(-175, -97, 2), [0, 0, 2], '[-175, -95] zoom 2')
// t.deepEqual(tilebelt.pointToTile(-175, 95, 2), [0, 3, 2], '[-175, +95] zoom 2')
// t.end()
// })

0 comments on commit e22616e

Please sign in to comment.