Clustering Google Maps Markers in iOS

I have a map-based application, using Google Maps’ iOS SDK. I need to store up to several thousand items in a core data database and display them with markers on the map. For performance and usability reasons, I need to cluster these markers when the user is zoomed out, but I need to make sure to place representative markers so the user knows where to zoom in to see more detail.

Each entry in my core data model has latitude/longitude double values stored. So what I thought of for clustering the items is to keep a separate entity where I strip the less significant parts of the geographic coordinates and store a count in it.

  • How can I tell whether an `NSManagedObject` has been deleted?
  • How to get country specific result with Google autocomplete place api ios sdk?
  • Create complicated NSCompoundPredicate in swift 3
  • iOS Make sure documents are open before accessing
  • How to use the first character as a section name
  • Swift CoreData: error: Serious application error. Exception was caught during Core Data change processing.
  • So whenever an item with lat/lon {44.9382719, -130.20293849} is inserted in the database, another “cluster” object with lat/lon {44.9, -130.2} has its count property incremented. The idea is that at low zooms (ie. zoomed out), I would only query the cluster objects and place those on the map instead of the actual items.

    My question is: according to the NSManagedObject reference, you’re not supposed to fetch stuff in awakeFromInsert, so how can I make sure that inserting a managed object of one kind updates the value of a corresponding managed object of another kind?

    2 Solutions Collect From Internet About “Clustering Google Maps Markers in iOS”

    I have been searching library for Clustering Markers in Google Maps for iOS for three days, and finally I ended up with this, which is working nicely and very easy to use and understand.

    Have a look at routeMe, this comes default

    /** Whether the annotation should be clustered when map view clustering is enabled. Defaults toYES. */
    @property (nonatomic, assign) BOOL clusteringEnabled;