kingpin
kingpin copied to clipboard
Is there a way to get the Kingpin annotation that an annotation is contained in?
I have a dictionary of my annotations, and i want to be able to call selectAnnotation:animate: on the king pin annotation that the correct one is contained within. Is there a way to do this using kingpin? Thanks!
(sorry if this is the wrong avenue for asking this question!)
also if i add this feature myself would a pull request be welcomed? @itsbonczek @stanislaw
@mjmayank, pull request is more than welcome! Also I didn't get your question quite well: do you actually mean dictionary of annotations?
I am pretty sure that you are aware of this piece of documentation: Accessing cluster's annotations so I believe you're asking something different here.
Please elaborate or suggest Pull Request.
@stanislaw Basically I have a way to find an annotation in my own dataset, and previously I would just call selectAnnotation on it. However now that those annotations are hidden within Kingpin and not actually on the map themselves, I cannot programmatically select an annotation.
So it would be nice to be able to query for the kingpin annotation that's on the map that contains the annotation I want to select, so that the callout for that annotation is shown.
I guess I could get the list of cluster annotations, but that would be an O(n) operation as I'd have to loop through every cluster and check if my annotation is contained in it, and I was hoping to do it more efficiently (ie with a dictionary mapping an annotation to its cluster).
Hello @stanislaw I got the same request, any way to do that? I want to find a specific annotation...
Hello there @stanislaw @mjmayank , did you addressed this need?
How can we select programmatically an annotation that's part of a kingpin?
For my own project I made an NSDictionary within Kingpin that hashed each annotation to its cluster. You must designate something as a unique ID for the key in the dictionary (I used the objectID for the object my annotation was representing).
I wish I could have pushed it to the project but it wasn't really implemented robustly enough for any purpose other than my specific one. It was pretty hacky but I think the method could easily be abstracted though.
we are currently following another path, but we'll have a look at your approach, tnx! :)
You can look at my code here: https://github.com/mjmayank/kingpin