Performance is good with 280 annotations; appearance is not. You must group them in clusters when the user is scaled.
One way to do this:
- Determine how many cluster annotations you want to show.
- Divide the screen into x * y tiles by approximately
x*y =~ numClusters and x/y=480/320=1.5 x*y =~ numClusters x/y=480/320=1.5 - Add a cluster annotation to each fragment (this is a regular cluster with an array containing 0 or more annotations).
- Run k-mean algorithm :
- Iterate over all annotations and add them to the nearest cluster.
- Calculate a new center for each cluster, which will be the average center of all its members.
- Clear each cluster.
- Repeat until the cluster moves more.
- Delete empty clusters, if any.
You fall into numClusters clusters arranged according to the density of annotation.
You can also leave a series of regular annotations yourself if they are outside the clusters. Depends on how you want it to look.
Jano source share