GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - whins/node-geocluster: find clusters in coordinates

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

2 Commits
2 Commits

Folders and files

NameName
Last commit message
Last commit date
index.js
index.js
 
 
package.json
package.json
 
 
readme.md
readme.md
 
 

Repository files navigation

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

About

find clusters in coordinates

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.