我有4个latlong
点,我想打开地图并使每个latlong
点位于地图的4个角上,然后将标记设置在地图的中心。
这是4点:
“ new_latitude1”:24.790874,
“ new_latitude2”:24.828583,
“ new_latitude3”:24.856611,
“ new_latitude4”:24.837425,
“ new_longitude1”:46.860488,
“ new_longitude2”:46.842389,
“ new_longitude3”:46.86747,
“ new_longitude4”:46.895313,
答案 0 :(得分:2)
成对表示坐标。
同时您可以像这样扩展LatLngBounds
的坐标:
LatLngBounds.Builder builder = new LatLngBounds.Builder();
builder.include(new LatLng(24.790874, 46.860488));
builder.include(new LatLng(24.828583, 46.842389));
builder.include(new LatLng(24.856611, 46.86747));
builder.include(new LatLng(24.837425, 46.895313));
LatLngBounds bounds = builder.build();
LatLng center = bounds.getCenter();
这些LatLngBounds
也可用于缩放地图以适合:
map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 20));