Socket
Socket
Sign inDemoInstall

tilebelt

Package Overview
Dependencies
Maintainers
22
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tilebelt - npm Package Compare versions

Comparing version 0.7.1 to 1.0.0

.nyc_output/36558.json

32

index.js

@@ -41,9 +41,6 @@ // a tile is an array [x,y,z]

function pointToTile(lon, lat, z) {
var latr = lat*d2r,
z2 = Math.pow(2, z);
return [
(Math.floor((lon+180)/360*z2)),
(Math.floor((1-Math.log(Math.tan(latr) + 1/Math.cos(latr))/Math.PI)/2 *z2)),
z
];
var tile = pointToTileFraction(lon, lat, z);
tile[0] = Math.floor(tile[0]);
tile[1] = Math.floor(tile[1]);
return tile;
}

@@ -171,15 +168,10 @@

function pointToTileFraction (lon, lat, z) {
var tile = pointToTile(lon, lat, z);
var bbox = tileToBBOX(tile);
var xTileOffset = bbox[2] - bbox[0];
var xPointOffset = lon - bbox[0];
var xPercentOffset = xPointOffset / xTileOffset;
var yTileOffset = bbox[1] - bbox[3];
var yPointOffset = lat - bbox[3];
var yPercentOffset = yPointOffset / yTileOffset;
return [tile[0]+xPercentOffset, tile[1]+yPercentOffset, z];
function pointToTileFraction(lon, lat, z) {
var latr = lat*d2r,
z2 = Math.pow(2, z);
return [
(lon+180)/360*z2,
(1-Math.log(Math.tan(latr) + 1/Math.cos(latr))/Math.PI)/2 *z2,
z
];
}

@@ -186,0 +178,0 @@

{
"name": "tilebelt",
"version": "0.7.1",
"version": "1.0.0",
"description": "simple tile utilities",
"main": "index.js",
"scripts": {
"test": "node test.js"
"test": "tap test.js --cov"
},

@@ -25,6 +25,6 @@ "repository": {

"devDependencies": {
"tape": "^2.14.0",
"benchmark": "~1.0.0"
"benchmark": "~1.0.0",
"tap": "^1.2.0"
},
"dependencies": {}
}
tilebelt
====
[![Build Status](https://travis-ci.org/mapbox/tilebelt.svg?branch=master)](https://travis-ci.org/mapbox/tilebelt)
[![Build Status](https://travis-ci.org/mapbox/tilebelt.svg?branch=master)](https://travis-ci.org/mapbox/tilebelt) [![Coverage Status](https://coveralls.io/repos/mapbox/tilebelt/badge.svg?branch=use-tap)](https://coveralls.io/r/mapbox/tilebelt?branch=use-tap)
simple [tile](http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames) utilities
##install
## install
```bash

@@ -12,3 +13,4 @@ npm install tilebelt

##usage
## usage
```js

@@ -23,3 +25,4 @@ var tilebelt = require('tilebelt');

##features
## features
function | description

@@ -41,5 +44,6 @@ ---|---

##tests
## tests
```bash
npm test
```
```

@@ -1,2 +0,2 @@

var test = require('tape'),
var test = require('tap').test,
tilebelt = require('./');

@@ -117,3 +117,3 @@

test('bbox to tile -- big', function(t) {
var bbox = [-84.72656249999999,
var bbox = [-84.72656249999999,
11.178401873711785,

@@ -130,2 +130,13 @@ -5.625,

test('bbox to tile -- no area', function(t) {
var bbox = [-84,
11,
-84,
11];
var tile = tilebelt.bboxToTile(bbox);
t.ok(tile, 'convert bbox to tile');
t.deepEqual(tile, [71582788, 125964677, 28]);
t.end();
});
test('bbox to tile -- dc', function(t) {

@@ -181,5 +192,5 @@ var bbox = [-77.04615354537964,

t.equal(tile[0], 119.552490234375);
t.equal(tile[1], 191.4701834281966);
t.equal(tile[1], 191.47119140625);
t.equal(tile[2], 9);
t.end();
});
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc