concavehull

Workable refactoring into a module of a concave hull algorithm.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
concavehull
0.1.66 years ago8 years agoMinified + gzip package size for concavehull in KB

Readme

ConcaveHull
Travis   npm   License MIT

Based on the StackOverflow question about the CSharp implementation of a paper written by Adriano Moreira and Maribel Yasmina Santos from the University of Minho.
Initially a prototype was created by nredko – and this implementation is a refactor to transform it into a fully working module.

Getting Started

Using ConcaveHull is terribly simple – all you have to do is pass an array of objects that conform to the { lat: {Number}, lng: {Number} } format – in the case of Leaflet.js this is just an array of L.LatLng objects.
Once you have your array of latitudinal and longitudinal values, you can instantiate the object, and then invoke the getLatLngs method:
var latLngs = new ConcaveHull(latLngs).getLatLngs();

You can manually specify the maximum length of edges in metres by passing it into the constructor as the second argument:
var edgeLength = 35,
    latLngs    = new ConcaveHull(latLngs, edgeLength).getLatLngs();