Positioning GMSMapView to display multiple annotations simultaneously

My question is very similar to except MKMapView. How can I do the same process (resize the map to fit all annotations / markers on the screen at the same time) using Google Maps? As far as I understand, I need to convert MKCoordinateRegion to GMSProjection, am I right?

+6
source share
1 answer

It is very simple, simple:

@property (nonatomic, strong) GMSMapView *mapView; - (void)didTapFitBoundsWithMarkers:(NSArray *)markers { GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] init];; for (GMSMarker *marker in markers) { bounds = [bounds includingCoordinate:marker.position]; } GMSCameraUpdate *update = [GMSCameraUpdate fitBounds:bounds]; [self.mapView moveCamera:update]; [self.mapView animateToViewingAngle:50]; } 
+13
source

All Articles