0

In one of my project (IOS) I need to add functionality that when user zoom out the google maps it adds marks within that coordinates. Right now I am zooming the map on user current location and the nearest location. So when user zoom out it will add more locations that are in that region. I dont know how to achieve that please help me in this.

rmaddy
  • 314,917
  • 42
  • 532
  • 579

1 Answers1

1

As it looks like, GoogleMaps SDK leaves the responsibility for storing and managing markers entirely to you. So what you need to do is keep a separate storage (like NSMutableArray or NSMutableSet or whatever best suits you) for all your markers and using projection.visibleRegion property on GMSMapView to decide which to remove (or add).

Check out GMSProjection reference on GoogleMaps SDK docs

In order to catch up with zooming in and out, you have to declare your GMSMapViewDelegate and implement this method:

- (void)mapView:(GMSMapView *)mapView didChangeCameraPosition:(GMSCameraPosition *)position

That's about it.

Jonan Gueorguiev
  • 1,146
  • 12
  • 20