didChangeCameraPosition get bounding box/ rectangle of available coordinates
Asked Answered
T

1

7

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
Tarboosh answered 20/5, 2014 at 22:26 Comment(0)
M
17
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;
Mccain answered 13/6, 2014 at 16:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.