Calculating the center latitude longitude of a polygon in PHP

I have a set of points (stored as lat / lon) for a polygon, I want to calculate the center point of the lat / lon of a polygon in PHP.

Basically do the same as getCenter () in Google Maps LatLngBounds .

Any ideas on how I can achieve this?

+5
source share
2 answers

What you are looking for is the center of gravity of the polygon - it's pretty easy to calculate. If you use latitude / longitude, the question is complicated by the fact that the polygon is actually located on the surface of a sphere (ellipsoid).

, Google api javascript?

+4

All Articles