-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Get bounding box on Android #3706
Comments
Until they add it, I guess you could try this: //create bounds
LatLng southWest = mapView.fromScreenLocation(new PointF(0f, mapView.getHeight()));
LatLng northEast = mapView.fromScreenLocation(new PointF(mapView.getWidth(), 0f));
CoordinateBounds bounds = new CoordinateBounds(southWest, northEast);
//set the bounds
mapView.setVisibleCoordinateBounds(bounds, true); |
@esisa |
Thanks @AlPHez |
@tobrun did this work around get lost in 4.0? |
@sddamico, since |
@tobrun yeah, I was specifically referring to I'm attempting to accomplish something similar to the effect of the api's that might be offered in #3602. The web engineer I am working with was able to achieve the effect of bounding the map by using the |
@sddamico /**
* Returns a CameraUpdate that transforms the camera such that the specified latitude/longitude
* bounds are centered on screen at the greatest possible zoom level.
* You can specify padding, in order to inset the bounding box from the map view's edges.
* The returned CameraUpdate has a bearing of 0 and a tilt of 0.
*
* @param bounds Bounds to match Camera position with
* @param padding Padding added to the bounds
* @return CameraUpdate Final Camera Position
*/
public static CameraUpdate newLatLngBounds(@NonNull LatLngBounds bounds, int padding) {
return newLatLngBounds(bounds, padding, padding, padding, padding);
}
/** Note that we don't restrict the user from navigating outside of the set bounds. |
@tobrun yeah, I definitely need to limit the user from navigating outside the bounds. I'll start investigating some other workarounds. |
Is there no way to get the current bounding box on Android? On iOS it seems to be a bounds variable that I can use, but I cannot find anything similar on Android.
The text was updated successfully, but these errors were encountered: