New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

geojson-vt

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geojson-vt - npm Package Compare versions

Comparing version 2.1.6 to 2.1.7

src/transform.js

3

package.json
{
"name": "geojson-vt",
"version": "2.1.6",
"version": "2.1.7",
"description": "Slice GeoJSON data into vector tiles efficiently",

@@ -23,2 +23,3 @@ "homepage": "https://github.com/mapbox/geojson-vt",

"eslint": "^1.5.0",
"eslint-config-mourner": "^1.0.0",
"faucet": "0.0.1",

@@ -25,0 +26,0 @@ "istanbul": "^0.3.20",

@@ -79,2 +79,6 @@ ## geojson-vt — GeoJSON Vector Tiles

##### 2.1.7 (Oct 16, 2015)
- Expose transform methods in a separate file (`transform.js`).
##### 2.1.6 (Sep 22, 2015)

@@ -81,0 +85,0 @@

@@ -5,6 +5,7 @@ 'use strict';

var convert = require('./convert'), // GeoJSON conversion and preprocessing
clip = require('./clip'), // stripe clipping algorithm
wrap = require('./wrap'), // date line processing
createTile = require('./tile'); // final simplified tile generation
var convert = require('./convert'), // GeoJSON conversion and preprocessing
transform = require('./transform'), // coordinate transformation
clip = require('./clip'), // stripe clipping algorithm
wrap = require('./wrap'), // date line processing
createTile = require('./tile'); // final simplified tile generation

@@ -162,3 +163,3 @@

var id = toID(z, x, y);
if (this.tiles[id]) return transformTile(this.tiles[id], extent);
if (this.tiles[id]) return transform.tile(this.tiles[id], extent);

@@ -185,3 +186,3 @@ if (debug > 1) console.log('drilling down to z%d-%d-%d', z, x, y);

if (parent.source) {
if (isClippedSquare(parent, extent, options.buffer)) return transformTile(parent, extent);
if (isClippedSquare(parent, extent, options.buffer)) return transform.tile(parent, extent);

@@ -195,40 +196,5 @@ if (debug > 1) console.time('drilling down');

return transformTile(this.tiles[id], extent);
return transform.tile(this.tiles[id], extent);
};
function transformTile(tile, extent) {
if (tile.transformed) return tile;
var z2 = tile.z2,
tx = tile.x,
ty = tile.y,
i, j, k;
for (i = 0; i < tile.features.length; i++) {
var feature = tile.features[i],
geom = feature.geometry,
type = feature.type;
if (type === 1) {
for (j = 0; j < geom.length; j++) geom[j] = transformPoint(geom[j], extent, z2, tx, ty);
} else {
for (j = 0; j < geom.length; j++) {
var ring = geom[j];
for (k = 0; k < ring.length; k++) ring[k] = transformPoint(ring[k], extent, z2, tx, ty);
}
}
}
tile.transformed = true;
return tile;
}
function transformPoint(p, extent, z2, tx, ty) {
var x = Math.round(extent * (p[0] * z2 - tx)),
y = Math.round(extent * (p[1] * z2 - ty));
return [x, y];
}
function toID(z, x, y) {

@@ -263,3 +229,3 @@ return (((1 << z) * y + x) * 32) + z;

for (var i = 0; i < len; i++) {
var p = transformPoint(feature.geometry[0][i], extent, tile.z2, tile.x, tile.y);
var p = transform.point(feature.geometry[0][i], extent, tile.z2, tile.x, tile.y);
if ((p[0] !== -buffer && p[0] !== extent + buffer) ||

@@ -266,0 +232,0 @@ (p[1] !== -buffer && p[1] !== extent + buffer)) return false;

Sorry, the diff of this file is not supported yet

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