Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.6.1 to 0.7.0

18

index.js

@@ -170,2 +170,17 @@ // a tile is an array [x,y,z]

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];
}
module.exports = {

@@ -183,3 +198,4 @@ tileToGeoJSON: tileToGeoJSON,

pointToTile: pointToTile,
bboxToTile: bboxToTile
bboxToTile: bboxToTile,
pointToTileFraction: pointToTileFraction
};

2

package.json
{
"name": "tilebelt",
"version": "0.6.1",
"version": "0.7.0",
"description": "simple tile utilities",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -26,2 +26,3 @@ tilebelt

tileToGeoJSON(tile) | get a geojson representation of a tile
tileToBBOX(tile) | get the bbox of a tile
getChildren(tile) | get the 4 tiles one zoom level higher

@@ -36,2 +37,3 @@ getParent(tile) | get the tile one zoom level lower

pointToTile(lon, lat, zoom) | get the tile for a point at a specified zoom level
pointToTileFraction(lon, lat, zoom) | get the precise fractional tile location for a point at a zoom level

@@ -38,0 +40,0 @@ ##tests

@@ -173,2 +173,11 @@ var test = require('tape'),

t.end();
});
test('pointToTileFraction', function(t) {
var tile = tilebelt.pointToTileFraction(-95.93965530395508,41.26000108568697,9);
t.ok(tile, 'convert point to tile fraction');
t.equal(tile[0], 119.552490234375);
t.equal(tile[1], 191.4701834281966);
t.equal(tile[2], 9);
t.end();
});
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