You need to calculate the centroid of the polygon defined by your points. Wikipedia defines the center of gravity as:
The centroid or geometric center of a planar figure is the arithmetic mean ("average") position of all points in the form
To calculate the centroid of a finite set of points , you can use the following method:
private LatLng computeCentroid(List<LatLng> points) { double latitude = 0; double longitude = 0; int n = points.size(); for (LatLng point : points) { latitude += point.latitude; longitude += point.longitude; } return new LatLng(latitude/n, longitude/n); }
antonio
source share