I am developing a node.js/javascript application where I would have dozens of beacons in a row (positions known), which gives me their distances to specific object (3 or 4 distances per object). The idea is to trilaterate those distances to infer the coordinates of this object.

I have technical background but I am not an expert in geometry nor cartography. I have check a lot of articles about trilateration. Most interesting:

With the distances involved (hundreds of meters), instead of 3D problem, I can simplify to 2D problem, but I am not sure which would be best approach to tackle it. I would need a fast algorithm, since I can have around 12 different position calculations (different objects) every second.

I have different ideas:

  1. Using wikipedia's article is the easiest way. I have a pair of javascript libraries that perform this algorithm (cannot put links due to constraints in stackexchange). Problem: does not take into account error in measurements, so many times equation does not give you a solution (approximate value would be enough...)
  2. Using Mathematica: cannot do that. Is there any other C++ or javascript/nodejs library that performs those calculations?
  3. Using postgis: I think I can create a circular stripe (donut) per beacon distance, using ST_BuildArea. Then intersect those areas and calculate the centroid. Do you think this would be a proper approach using geometry - not geography-? Fast enough for 12 positions/second?
  • Hi, what is your thoughts on this question 3 years after? Have you found robust algorithm for your application? – evilive Nov 4 at 8:47

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.