Free those pins!

10.26.2012

Six months ago, we wrote on clustering annotations on iOS maps. We described a very efficient technique to handle huge amounts of pins on an MKMapView, while still keeping a very fluid UI. The actual implementation is fairly complex though, and many developers asked us to share our code. Today, we are happy to release the source code to ADClusterMapView, under a BSD license.

Integrating ADClusterMapView into your code is extremely easy since it’s a subclass of MKMapView. Just add our classes to your project, turn your MKMapView instance into an ADClusterMapView instance, and you are mostly good to go! Using ADClusterMapView might even make your code easier since you won’t have to handle pins addition and deletion.

We added the above demo to the repository for you to give it a try. The data sets come from Paris’ Open Data website. Notice how the mapview runs smoothly even though the second data set contains more than 100,000 elements!