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
2
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.3.0 to 2.4.0

geojson-vt-dev.js

8

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

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

},
"eslintConfig": {
"extends": "mourner"
},
"license": "ISC",

@@ -38,4 +41,5 @@ "scripts": {

"build-dev": "browserify -d src/index.js -s geojsonvt -o geojson-vt-dev.js",
"watch": "watchify -v -d src/index.js -s geojsonvt -o geojson-vt-dev.js"
"watch": "watchify -v -d src/index.js -s geojsonvt -o geojson-vt-dev.js",
"prepublish": "npm run build-dev && npm run build-min"
}
}

@@ -5,2 +5,4 @@ 'use strict';

var createFeature = require('./feature');
/* clip features between two axis-parallel lines:

@@ -45,9 +47,3 @@ * | |

// so there's no need to recalculate bboxes
clipped.push({
geometry: slices,
type: type,
tags: features[i].tags || null,
min: feature.min,
max: feature.max
});
clipped.push(createFeature(feature.tags, type, slices, feature.id));
}

@@ -54,0 +50,0 @@ }

@@ -6,2 +6,3 @@ 'use strict';

var simplify = require('./simplify');
var createFeature = require('./feature');

@@ -37,12 +38,13 @@ // converts GeoJSON feature into an intermediate projected JSON vector format with simplification data

tags = feature.properties,
id = feature.id,
i, j, rings, projectedRing;
if (type === 'Point') {
features.push(create(tags, 1, [projectPoint(coords)]));
features.push(createFeature(tags, 1, [projectPoint(coords)], id));
} else if (type === 'MultiPoint') {
features.push(create(tags, 1, project(coords)));
features.push(createFeature(tags, 1, project(coords), id));
} else if (type === 'LineString') {
features.push(create(tags, 2, [project(coords, tolerance)]));
features.push(createFeature(tags, 2, [project(coords, tolerance)], id));

@@ -56,3 +58,3 @@ } else if (type === 'MultiLineString' || type === 'Polygon') {

}
features.push(create(tags, type === 'Polygon' ? 3 : 2, rings));
features.push(createFeature(tags, type === 'Polygon' ? 3 : 2, rings, id));

@@ -68,3 +70,3 @@ } else if (type === 'MultiPolygon') {

}
features.push(create(tags, 3, rings));
features.push(createFeature(tags, 3, rings, id));

@@ -84,14 +86,2 @@ } else if (type === 'GeometryCollection') {

function create(tags, type, geometry) {
var feature = {
geometry: geometry,
type: type,
tags: tags || null,
min: [2, 1], // initial bbox values;
max: [-1, 0] // note that coords are usually in [0..1] range
};
calcBBox(feature);
return feature;
}
function project(lonlats, tolerance) {

@@ -137,23 +127,1 @@ var projected = [];

}
// calculate the feature bounding box for faster clipping later
function calcBBox(feature) {
var geometry = feature.geometry,
min = feature.min,
max = feature.max;
if (feature.type === 1) calcRingBBox(min, max, geometry);
else for (var i = 0; i < geometry.length; i++) calcRingBBox(min, max, geometry[i]);
return feature;
}
function calcRingBBox(min, max, points) {
for (var i = 0, p; i < points.length; i++) {
p = points[i];
min[0] = Math.min(p[0], min[0]);
max[0] = Math.max(p[0], max[0]);
min[1] = Math.min(p[1], min[1]);
max[1] = Math.max(p[1], max[1]);
}
}

@@ -81,7 +81,11 @@ 'use strict';

if (simplified.length) {
tile.features.push({
var tileFeature = {
geometry: simplified,
type: type,
tags: feature.tags || null
});
};
if (feature.id !== null) {
tileFeature.id = feature.id;
}
tile.features.push(tileFeature);
}

@@ -88,0 +92,0 @@ }

'use strict';
var clip = require('./clip');
var createFeature = require('./feature');

@@ -40,9 +41,3 @@ module.exports = wrap;

newFeatures.push({
geometry: newGeometry,
type: type,
tags: feature.tags,
min: [feature.min[0] + offset, feature.min[1]],
max: [feature.max[0] + offset, feature.max[1]]
});
newFeatures.push(createFeature(feature.tags, type, newGeometry, feature.id));
}

@@ -49,0 +44,0 @@

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