13

I have a series of longitude and latitude coordinates which represent a building outline

e.g.

-0.5485381346101759,53.2285150736142
-0.5482220594232723,53.22842450827133
-0.5482298619861881,53.22841205254449

...(intermediate points not listed)...

-0.5483123769301657,53.22882101914848

How can I work out the midpoint?

I've found tutorials that show how to do it if you've got three coordinates (e.g. Link), but in many cases I've got more than three.

0

5 Answers 5

12

With coordinates that close to each other, you can treat the Earth as being locally flat and simply find the centroid as though they were planar coordinates. Then you would simply take the average of the latitudes and the average of the longitudes to find the latitude and longitude of the centroid.

As @whuber points out, the above method would not work unless the building is a rectangle or a regular polygon. For an arbitrary shape, the formula here gives the correct result.

0
5

If you want the center of the building which is outlined by a polygon, then don't take the mean of vertices. This is obviously wrong. You need instead to compute the centroid of the polygon itself. For the formula, see

http://en.wikipedia.org/wiki/Centroid#Centroid_of_polygon

I agree with earlier posters: you can treat latitude and longitude as Cartesian coordinates because the building is small and it's far from a pole and from the international date line.

0
1

Convert from geographic coordinates to geocentric, average the geocentric vectors, then convert back to geographic.

0
0

The centroid of finitely many points is simply the arithmetic mean of each of the coordinates. So just sum up the latitudes and longitudes and divide by the number of points.

0
-1

If you're working over larger ranges, you need spherical interpolation.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.