kingpin icon indicating copy to clipboard operation
kingpin copied to clipboard

Is there a way to get the Kingpin annotation that an annotation is contained in?

Open mjmayank-zz opened this issue 9 years ago • 8 comments

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!)

mjmayank-zz avatar Oct 05 '15 03:10 mjmayank-zz

also if i add this feature myself would a pull request be welcomed? @itsbonczek @stanislaw

mjmayank-zz avatar Oct 07 '15 23:10 mjmayank-zz

@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 avatar Oct 08 '15 07:10 stanislaw

@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).

mjmayank-zz avatar Oct 08 '15 16:10 mjmayank-zz

Hello @stanislaw I got the same request, any way to do that? I want to find a specific annotation...

notiles avatar May 27 '16 09:05 notiles

Hello there @stanislaw @mjmayank , did you addressed this need?

How can we select programmatically an annotation that's part of a kingpin?

therealpan avatar Nov 17 '16 19:11 therealpan

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.

mjmayank-zz avatar Nov 17 '16 19:11 mjmayank-zz

we are currently following another path, but we'll have a look at your approach, tnx! :)

therealpan avatar Nov 17 '16 19:11 therealpan

You can look at my code here: https://github.com/mjmayank/kingpin

mjmayank-zz avatar Nov 17 '16 19:11 mjmayank-zz