Calculating midpoint from series of latitude and longitude coordinates

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.

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.

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.

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

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.

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