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.
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?
To do a cluster or "mind map," write your general subject down in the middle of a piece of paper. Then, using the whole sheet of paper, rapidly jot down ideas related to that subject. If an idea spawns other ideas, link them together using lines and circles/shapes to form a cluster of ideas.
Marker clusters is the concept of sampling the data values into larger blocks in order to ease readability and increase performance. It is a simple solution to display a large number of markers on a map, or a chart. The number on a cluster shows how many markers it contains.
I have been searching library for Clustering Markers in Google Maps for iOS for three days, and finally I ended up with this https://github.com/googlemaps/google-maps-ios-utils, 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 to
YES. */
@property (nonatomic, assign) BOOL clusteringEnabled;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With