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

supercluster

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

supercluster - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

dist/supercluster.js

46

index.js

@@ -73,30 +73,44 @@ 'use strict';

getTile: function (z, x, y) {
var tree = this.trees[this._limitZoom(z)];
var z2 = Math.pow(2, z);
var extent = this.options.extent;
var p = this.options.radius / extent;
var tree = this.trees[this._limitZoom(z)];
var ids = tree.range(
(x - p) / z2,
(y - p) / z2,
(x + 1 + p) / z2,
(y + 1 + p) / z2);
var r = this.options.radius;
var p = r / extent;
var top = (y - p) / z2;
var bottom = (y + 1 + p) / z2;
if (!ids.length) return null;
var tile = {
features: []
};
this._addTileFeatures(
tree.range((x - p) / z2, top, (x + 1 + p) / z2, bottom),
tree.points, x, y, z2, tile);
if (x === 0) {
this._addTileFeatures(
tree.range(1 - p / z2, top, 1, bottom),
tree.points, z2, y, z2, tile);
}
if (x === z2 - 1) {
this._addTileFeatures(
tree.range(0, top, p / z2, bottom),
tree.points, -1, y, z2, tile);
}
return tile.features.length ? tile : null;
},
_addTileFeatures: function (ids, points, x, y, z2, tile) {
for (var i = 0; i < ids.length; i++) {
var c = tree.points[ids[i]];
var feature = {
var c = points[ids[i]];
tile.features.push({
type: 1,
geometry: [[
Math.round(extent * (c.x * z2 - x)),
Math.round(extent * (c.y * z2 - y))
Math.round(this.options.extent * (c.x * z2 - x)),
Math.round(this.options.extent * (c.y * z2 - y))
]],
tags: c.id !== -1 ? this.points[c.id].properties : getClusterProperties(c)
};
tile.features.push(feature);
});
}
return tile;
},

@@ -103,0 +117,0 @@

{
"name": "supercluster",
"version": "2.1.0",
"version": "2.2.0",
"description": "A crazy fast geospatial point clustering library.",

@@ -9,4 +9,14 @@ "main": "index.js",

"test": "tap test",
"cov": "tap test --cov"
"cov": "tap test --cov",
"build-dev": "mkdirp dist && browserify -d index.js -s supercluster > dist/supercluster.js",
"build-min": "mkdirp dist && browserify index.js -s supercluster | uglifyjs -c warnings=false -m > dist/supercluster.min.js",
"prepublish": "npm run build-dev && npm run build-min"
},
"files": [
"dist"
],
"repository": {
"type": "git",
"url": "git://github.com/mapbox/supercluster.git"
},
"keywords": [

@@ -23,5 +33,8 @@ "clustering",

"devDependencies": {
"browserify": "^13.1.0",
"eslint": "^2.7.0",
"eslint-config-mourner": "^2.0.1",
"tap": "^5.7.1"
"mkdirp": "^0.5.1",
"tap": "^5.7.1",
"uglifyjs": "^2.4.10"
},

@@ -28,0 +41,0 @@ "eslintConfig": {

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