Set a max zoom level on LatLngBounds builder

前端 未结 10 605
慢半拍i
慢半拍i 2020-12-13 00:57

I haven\'t found an answer in my search, there are a few answers on SO but they didn\'t work for me.

I have 2 markers on the map and I am using LatLngBounds builder

10条回答
  •  囚心锁ツ
    2020-12-13 01:21

    I implemented this solution according to the answer by user2808624, but using the SphericalUtil from the Android Maps Utility Library to do the calculations.

    final double HEADING_NORTH_EAST = 45;
    final double HEADING_SOUTH_WEST = 225;
    LatLng center = tmpBounds.getCenter();
    LatLng northEast = SphericalUtil.computeOffset(center, 709, HEADING_NORTH_EAST);
    LatLng southWest = SphericalUtil.computeOffset(center, 709, HEADING_SOUTH_WEST);
    

提交回复
热议问题