I need a MySQL query (or function) to calculate the geographic midpoint of an arbitrary number of latitude/longitude coordinates. I want to use Method C (Average latitude/longitude) as described on this page http://www.geomidpoint.com/calculation.html but can't figure out how to convert this into a SQL query. I'm looking for something of the form:
select LATITUDE_AVG_FORMULA(points.latitude),LONGITUDE_AVG_FORMULA(points.longitude) from points;
Where each point in the points table has as associated latitude and longitude in decimal format. I'm hoping someone either already has a MySQL query (or function) they are using for this or have a lot more experience with geospacial calculations than I have. Thanks in advance for your help!