Search code examples
mapkitscaling

MapKit: how to hide objects when zoomed out?


I have lots of custom annotations and polylines on map, and it becomes a huge mess when i zoom out. Is there any way to hide them? I'm not familiar with MapKit, so only solution that i figured out is to create event on changing zoom level and re-add annotations whose zoom limit(it will be custom annotation property) is higher or equal to the current, but i'm afraid that it will be slow. Is there any other way?


Solution

  • I think, you should group your points in map. When you zoom in make ungroup, zoom out - group.

    enter image description here

    resources:

    1. http://five.agency/having-fun-with-ios-map-kit-grouping-annotations/
    2. https://github.com/choefele/CCHMapClusterController
    3. https://github.com/yinkou/OCMapView