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

geocluster

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geocluster

find clusters in coordinates

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-92.31%
Maintainers
1
Weekly downloads
 
Created
Source

geocluster

geocluster finds clusters in sets of coordinates. It's a port of S-means by Brian Hann (which itself is a stdev-driven form of K-means), but with two dimensions, Earth-geodesic distance and properly working code.

Install

npm install geocluster

API

result = geocluster(coordinates[, bias])

coordinates is an Array of [lat, lon] pairs. bias is a factor the standard deviation gets multiplied with, which acts as threshold to determine if a coordinate belongs to a cluster.

result is an Array of cluster objects, which have centroid and elements properties. Example:

[{
	centroid: [1.0,1.0],
	elements: [
		[1.0,1.0], [0.9,1.1], [1.1,0.9]
	]
},{
	centroid: [2.0,2.0],
	elements: [
		[2.0,2.0], [1.9,2.1], [2.1,1.9]
	]
}]

Sample Code


var geocluster = require("geocluster");

var coordinates = [ // array of lat-lon-pairs
	[<lat>, <lon>], 
	[<lat>, <lon>], 
	[<lat>, <lon>],
	// ...
];

var bias = 1.5; // multiply stdev with this factor, the smaller the more clusters

var result = geocluster(coordinates, bias); 

// result is an array of cluster objects with `centroid` and `elements` properties

License

Public Domain

Keywords

FAQs

Package last updated on 28 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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