3wcircus / DamnThePotHolesBackend

1 stars 0 forks source link

Web Service - Implement a method that combines 'near' hits #6

Open 3wcircus opened 5 years ago

3wcircus commented 5 years ago

Initial implementation should be an endpoint only accessible to admin users to kick it off. The logic should support a configurable 'distance range diameter-ish' value and the algorithm should then walk all data points, assess how close they are to any other data points, and if within configured proximity, collapse the n number of data points to one data point at roughly the center, creating a new hit marker and disabling markers that were combined.

(Just think a circle. Any points in the circle should be combined into 1 in the center of the circle)

You might start by looking at this https://www.npmjs.com/package/geolib or finding another Node friendly library for Geo stuff.

Not much activity on the project above, but does have the methods we need (method to pass in an array of coordinates (lat,long) and determining distance as well as merging to center). If you find something better that's cool as well.

3wcircus commented 5 years ago

Most of this written and works, but algo needs tweaks to decide what the final weight should be when multiple points combined.