转载地址:https://blog.csdn.net/u010010664/article/details/78685171
/**
* 获取不规则多边形几何中心点
*
* @param mPoints
* @return
*/
public static LatLng getCenterPoint(List<LatLng> mPoints) {
// 1 自己计算
// double latitude = (getMinLatitude(mPoints) + getMaxLatitude(mPoints)) / 2;
// double longitude = (getMinLongitude(mPoints) + getMaxLongitude(mPoints)) / 2;
// return new LatLng(latitude, longitude);
// 2 使用Google map API提供的方法(推荐)
LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder();
for (LatLng ll : mPoints)
boundsBuilder.include(ll);
return boundsBuilder.build().getCenter();
}