Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

didChangeCameraPosition get bounding box/ rectangle of available coordinates

How can I retrieve the GMSCoordinateBounds from a GMSCameraPosition? I want to know the visible coordinates on the map (at least Northeast/Southwest points) everytime the user moves the camera as in:

(void)mapView:(GMSMapView *)mapView didChangeCameraPosition:(GMSCameraPosition *)position
like image 997
apinho Avatar asked May 20 '14 22:05

apinho


1 Answers

GMSVisibleRegion visibleRegion = mapView.projection.visibleRegion;
GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithRegion:visibleRegion];

// we've got what we want, but here are NE and SW points
CLLocationCoordinate2D northEast = bounds.northEast;
CLLocationCoordinate2D southWest = bounds.southWest;
like image 64
friedbunny Avatar answered Nov 16 '22 00:11

friedbunny