I have two latitude, longitude, now how i can find the center latitude,longitude of that two latitude longitude. Can anybody help me?
Asked
Active
Viewed 7,857 times
1
-
Which projection are you using? – sectus Mar 21 '13 at 11:04
-
This is quite simple just add the both lat and divide by 2 and similar to longitude add both and divide by 2. – Code Lღver Mar 21 '13 at 11:06
-
You can use search for example ;) [answer](http://stackoverflow.com/questions/11682164/find-center-geopoint-between-start-geo-point-and-end-geo-point-on-android) – Denis O. Mar 21 '13 at 11:06
3 Answers
3
Define what is 'center' for you. Mostly, i use simple average. Better solution is to compute two vectors (from center of the earth), add them and normalize result. Calculate the center point of multiple latitude/longitude coordinate pairs

Community
- 1
- 1

user2183861
- 56
- 2
2
Also, be careful about longitudes. The midpoint between two points at 170° E and 170° W should be at 180° E (or W), but you may end up with 0° E.
Download Map Projections: A Working Manual, by John P. Snyder, from the USGS. http://pubs.er.usgs.gov/publication/pp1395. It's free.

Eric Jablow
- 7,874
- 2
- 22
- 29
1
Convert your latitudes and longitudes to radians, then
$deltaLongitude = $endPointLongitude - $startPointlongitude;
$xModified = cos($endPointLatitude) * cos($deltaLongitude);
$yModified = cos($endPointLatitude) * sin($deltaLongitude);
$midpointLatitude = atan2(
sin($startPointlatitude) + sin($endPointLatitude),
sqrt((cos($startPointLatitude) + $xModified) * (cos($startPointLatitude) + $xModified) +
$yModified * $yModified
)
);
$midpointLongitude = $startPointLongitude +
atan2($yModified,
cos($startPointLatitude) + $xModified
);

Mark Baker
- 209,507
- 32
- 346
- 385
-
Clearly I'm wrong from the downvote: anybody care to explain so that __I__ can learn from the gurus as well – Mark Baker Mar 21 '13 at 11:15
-
+1 for having a stab at it. I think (without trying to get a headache) it is down to Riemannian circle - Now the heady duty maths come into play. – Ed Heal Mar 21 '13 at 11:23
-
-