If I have a series of points as longitude and latitude, how would I calculate the center of all of those points?
Add the latitudes of each, divide by 3. Add the longitudes of each, divide by 3. The result is the lat and long of the mid point, enter it in google maps.
In geography, the centroid of the two-dimensional shape of a region of the Earth's surface (projected radially to sea level or onto a geoid surface) is known as its geographic centre or geographical centre or (less commonly) gravitational centre.
Geomidpoint covers 3 different methods for calculating this.
Several people have answered to take the mean of the latitudes and longitudes. This is sort of the right idea, but means are more complicated on the sphere.
The latitude/longitude representation is essentially artificial and has discontinuities (at the poles, and opposite the prime meridian if you aren't careful), so it taking means in it doesn't seem likely (to me) to have a sensible geometric interpretation. I think you need to do something like averaging vectors in earth-centered coordinates, and then normalizing the result to put it back on the sphere.
I hope someone with more experience in these matters can comment more concretely.
Don't just take averages.
You can convert to 3d coordinates, then take the average (of x,y, and z coords), then project it back onto the sphere and turn that back into lat/long.
The wikipedia page on spherical coordinates has conversion algorithms.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With