GPS triangular coordinates

Say that you have n GPS coordinates, how could you determine the center GPS point between them?

+4
source share
2 answers

In case this helps someone now or in the future, here is an algorithm that works even for points near the poles (if it works at all, i.e. if I haven't made a stupid mathematical mistake ;-):

  • Converting latitude / longitude coordinates to three-dimensional Cartesian coordinates:

     x = cos(lat) * cos(lon) y = cos(lat) * sin(lon) z = sin(lat) 
  • Calculate the average value of x, the average value of y, and the average value of z:

     x_avg = sum(x) / count(x) y_avg = sum(y) / count(y) z_avg = sum(z) / count(z) 
  • Convert this direction back to latitude and longitude:

     lat_avg = arctan(z_avg / sqrt(x_avg ** 2 + y_avg ** 2)) lon_avg = arctan(y_avg / x_avg) 
+9
source

Depends on what you mean by the GPS center point. You could just take the average of all the points, as suggested by Stephen - but keep in mind that the GPS coordinates are not continuous - this will ineffectively affect gaps such as poles.

In most cases, you will need to convert to a coordinate system that does not have this problem.

You can also see all the points limited by it, calculate all the distances to each GPS point and minimize the sum of the distances to all GPS points. To do this, you need to look at the big circle calculations.

In addition, each GPS may have a higher or lower degree of uncertainty, you must take this into account and weight them accordingly.

What exactly are you trying to find out?

-Adam

+4
source

All Articles