Concave Hull From GPS Coordinates in Javascript

1.1k views Asked by At

this is my first question in stackoverflow after reading a lot about concave hulls and alpha shapes but unfortunately I still have not found a working solution :(

My input is a big array of GPS-Coordinates (lat,lon) (around 1000-2000 points) defining a GPS track. Now I'm looking for a way to measure the perimeter of the outline of all coordinates.

Until now, I was able to calculate and display the convex hull from all the points but the calculation of the concave hull was not successful so far :(

I use javascript for all my programming and looking for the following task: Input: all lat/lon coordinates (WGS84) Output: all edge coordinates defining the concave hull.

I already found interesting infos about concave hulls, alpha shapes and delaunay triangulation but unfortunately all infos refer to a 2D plane / X,Y coordinates (like [5,2][6,7][3,2]) and if I try those scripts with my WGS84 coordinates -> unable to get the concave hull of my point cloud :(

Thank you very much for any help!

2

There are 2 answers

2
Micromega On

You can use alpha shapes. Its a delaunay triangulation without edges exceeding alpha.WGS84 means spherical earth so z isn't so useful. But you can try a 3d triangulation (set Z to anything) or try a mercator map projection:https://alastaira.wordpress.com/2011/01/23/the-google-maps-bing-maps-spherical-mercator-projection/ and then alpha shapes.

0
AndriiHeonia On

Try to use hull.js library to solve your problem: https://github.com/AndriiHeonia/hull