Quantcast
Channel: Applidium
Viewing all 64 articles
Browse latest View live

VLC for the iPhone hits the AppStore

$
0
0

After the usual validation delay, we’re very happy to announce the availability of VLC on the AppStore !

This new version brings in the following major improvements :

  • It works on the iPhone 3GS and iPhone 4, as well as 3rd and 4th generation iPods.
  • Decoding is quite a lot faster than in the previous version
  • You can now open attachments from other applications, as well as RTSP and MMS streams.

Once again, all the source code is freely available. We’re now hosted on git.videolan.org, so feel free to submit patches if you would like to contribute!


Six AppStore pitfalls

$
0
0

Six AppStore pitfalls and how to avoid them: this is the presentation we gave at the AppStudies conference this monday. For those who couldn’t be there, we’re making our slides available online. We’re talking about internationalisation, updates, and AppStore reviews.

AppStories_Applidium.pdf

519.93 Ko Download

Paste to web : sharing screenshots made easy

$
0
0

Here’s a little utility we’ve been using internally for a while. We’ve decided to make it available to the public as an early christmas gift to Mac users. Introducing PasteToWeb : a very handy Mac OS dashboard widget that lets you upload screenshots on the web. It’s extremely easy to use, and efficient. Here’s how to use it :

  • Press “Ctrl-Shift-Cmd-4” on your Mac, and select the area you’d like to share
  • Go to the dashboard (by pressing F4 unless you’ve changed the setting)
  • Click the “PasteToWeb” upload button

That’s it, you’re done : the widget is uploading the image for you. Once the upload is finished, it will copy the image’s URL in your clipboard, ready for you to share.

PasteToWeb.wdgt.zip

66.43 Ko Download

Here’s why it’s so great :

  • It is super efficient. You can litteraly upload a screenshot in under a second.
  • Not another daemon : it only runs when you need it. No CPU or memory consumption if you don’t use it.
  • Never write anything to the disk at all : the bitmap data goes straight from your clipboard to the web.

Now here are some interesting things to know about PasteToWeb :

  • Ctrl-Shift-Cmd-4 is a standard OS X gesture to take a screenshot to the clipboard. PasteToWeb just uploads your clipboard, so any other way to put bitmap data in your clipboard will work just as well.
  • The images are sent to imgur.com

Apple pulled VLC off the AppStore

$
0
0

Much to our surprise, we received this friday an email from Apple that said “We regret that the dispute regarding your application named ‘VLC Media Player’ could not be resolved amicably between the parties. We have removed your application from the App Store. For any questions relating to this matter, please contact Rémi Denis-Courmont directly.”

This was a follow-up from an email we received from Apple last October : “On 10/20/2010, we received a notice from Rémi Denis-Courmont that Rémi Denis-Courmont believes your application named ‘VLC Media Player’ infringes Rémi Denis-Courmont’s intellectual property rights. In particular, Rémi Denis-Courmont believes you are infringing their copyright.”

Rémi Denis-Courmont’s complaint came pretty much unsuspected, since we did receive approval from the VideoLAN association before starting the iOS port of VLC. As a matter of fact, some members of VideoLAN even helped us porting VLC to the iOS.

It goes without saying, we still believe the AppStore licence is compatible with the GPLv2 under the which VLC is released. Therefore, together with the VideoLAN association, we’ll do our best to not let this be the end of VLC/iOS.

As a final word, we think it’s pretty sad to deny millions of users the right to enjoy a nice piece of open source software … in the name of freedom.

The AppStore mindset

$
0
0

Here’s an interesting story : as you may know, we’ve built an iOS Google Analytics app for our own use. It’s a rather simple (yet efficient) application that lets you check your Google Analytics stats on the go. So we decided to put it on the App Store, for free.

Here are some comments our app got on the US App Store :

  • “Quick access to quick stats. So we have the bait when is the switch? It’s free and no ads? Is my password safe?”
  • “Works perfectly for me. I can’t believe this is free!”

We find it really amazing how Apple managed to get its customers to expect to pay for pretty much anything.

On the web, nobody ever asked why Google Analytics itself was free in the first place while it’s a project several orders of magnitude more complex than our app.

Are universal iOS applications the best choice?

$
0
0

More often than not, iPad applications share a significant part of their codebase with their iPhone equivalent. As an editor, should we prefer publishing a dedicated application for each platform, or a universal one?

Advantages of a universal app

  • With iCloud and its over-the-air automatic synchronization between all our iOS devices, users won’t have your application twice on their iPads.
  • By merging the you minimize the number of app submissions, a difficult moment in which mistakes can easily be made.

Risks of a universal app

  • By spliting apps you won’t annoy users from a specific platform with upgrades that do not concern them.

Other leads

  • Leveraging iPhone downloads to rise in the iPad App Store rankings doesn’t seem to be possible 1. Whatever the method being used by Apple, that’s not a good reason to prefer a solution over the other.
  • Finally, in terms of earnings, it is rather difficult to make a universal app much more expensive because many users will only use it on a single device. Therefore most people price their universal application as if it was an iPhone-only one (this might lead to a slight loss of earnings though as iPad apps are traditionnaly more expensive).

In the end, both choices seem reasonable : two separate apps will offer more flexibilty in pricing and upgrades, whereas a universal one will be more simple. One should be rather careful when making his decision though, as there’s no coming back.

1 Cross Fingers, today #4 on the iPhone App Store is only #21 in the iPad one, far behind iPad-only applications.

2 Because of the way the App Store works, migrating from two separate apps to a universal one (or the other way round) will indeed break the “update link” with your users. Worse : in the case of a paid application, they would have to pay again.

Vim hits the App Store

$
0
0

At Applidium we really dig open source software. To celebrate Vim’s 20th birthday, we decided to port this incredible text editor to the iPad.

We could explain why Vim is so awesome, but many people already have :

So go grab Vim on the App Store. It also does run on the iPhone, but to be honest it works better on the iPad. Last but not least, feel free to report bugs or contribute on our GitHub page.

Too many pins on your map?

$
0
0

One of the most regularly used framework in the iOS SDK is certainly the Map Kit framework, which lets you easily embed and annotate maps in your applications. In this article we will show you an innovative way to make the best out of this framework.

Map Kit: a convenient but limited framework

In general, Map Kit usage follows this pattern:

  1. Instantiate an annotation (a model object which conforms to the MKAnnotation protocol)
  2. Add your annotation to your map (a MKMapView instance)
  3. Tell the map’s delegate what your annotation will look like when displayed on the map

Fairly simple, right? Not quite so: as soon as you have to display a large number of annotations, this naive approach doesn’t work anymore. Here’s why it doesn’t scale:

  • Performance: your device will struggle with all those annotations and you’ll experience dramatic frame drops when panning or zooming the map.
  • Usability: most annotations will overlap on screen, making them difficult to select.

Lately, when we were developing a transportation app, we had to display over a thousand train stations on the map. As the standard implementation wasn’t smooth enough to our liking, we decided it was time to do some research and figure out a solution to this prevalent problem.

Clustering

The solution is called clustering. The concept is simple: group together annotations (eg. photos, stations, restaurants: you name it) which are close to each other. But how do you define close? That’s all the question.

In fact, you probably already use clustering: you can find it in action in the Photos app shipped with the iPhone.

Unfortunately for us developers, Apple didn’t think it was a good idea to expose this neat feature in a public API. So we are on our own on this one.

State of the art

There are already few other clustering implementations around. Some of them are commercial (see Superpin or DTClusterMaker), some of them are open source projects (see REVClusterMap). Though these could be perfectly valid for some uses, neither of them seemed to really fit our expectations.

Clustering is an active field of research and there are already many interesting solutions to this problem. However, in our case, three constraints were prevalent:

  • The complexity of the algorithm must be as low as possible to allow for fast displaying of the map and smooth zooming and panning.
  • We want to be able to animate the transitions when an annotation expands to many (or when several annotations collapse into a single one), like in the Photos app. Thus, our algorithm should be deterministic (no random behavior is allowed while choosing the clusters).
  • We want a natural look which implicitly shows the density of the annotations (no grid/tile effect).

Grid effect in Superpin and REVClusterMap

Discussion

We tried several methods during our research. Let’s see how they perform:

  • Naive perfect method: we started grouping the annotations by evaluating the distance between each annotation to every other annotation. The complexity of the resulting algorithm was obviously (really) bad.
  • K-means: k-means clustering is a popular clustering method used in many domains including statistics and image segmentation. It leads to an easy-to-implement iterative algorithm. Unfortunately, it proved to be quite slow on our devices. And more important, it is not deterministic, thus we can’t animate during zooming and panning.
  • Quadtree: Using a quadtree structure is also a valid approach (used by Superpin, for example). The idea is to build the tree when adding the annotations to the map. Each node respresents the partitioning of the space into four regions. This step can be done offline (read “before showing the map”), so it’s ok if it takes a little time to compute. Updating the clusters to display each time you move the map can then be done quickly, which is nice. There is one major drawback though: you get this infamous grid effect.

Our implementation

We ended up using our own variant of the quadtree approach using another structure: a k-d tree, which in our case consists in a binary tree where the space is subdivided into two regions by a line at each level. What is nice about this structure is that you have full control over where you split your data. For example, you can choose to build a perfectly balanced binary tree by ensuring we have the same number of annotations in every newly created sub-region. But that’s not what we want. Instead, what we do at each step of the construction of the tree is:

  • do a Principal Component Analysis to estimate the principal vector describing the distribution of our annotations
  • compute the mean of the coordinates of the points
  • for each point (x,y), compute the scalar product between the principal vector p and the vector u (x-xMean, y-yMean), xMean and yMean being the mean of the two coordinates of our annotations. The sign of this product determines which partition the point belongs to.

Once the k-d tree is built, we just have to look for clusters through the tree for a given visible region of the map. We do a simple breadth-first search through all nodes of the tree belonging to the visible region of the map, until we reach a maximum number of clusters that we expose as a parameter in our API. So every time you pan or zoom the map, we won’t display more annotations than you need. Plus, you will get nice grouping/degrouping animations because our structure is consistent at any depth in the tree.

Conclusion

Et voilà! If there is one thing to remember of this, it’s that the iOS SDK is a great piece of software that’s just waiting for us to experiment with. It’s actually a lot of fun to work on extending the possibilities of all these frameworks we have in hand.

If you want to see our clustering in action, you can download the free app we developed this method for: RailTime. As you can see on this screenshot, the clusters accurately follow the path of the railway. This is something you wouldn’t see if we were using a quadtree.

We hope you liked this little research article and even maybe learned a little something. If you have any question, don’t hesitate to react to this blog post on Twitter: @applidium.


Lively UITableView

$
0
0

Animations are a central part of mobile applications: screen real estate being expensive, they are used to add meaning to the user interface. They are all over the place in the iOS; but after a few years of use, it would be nice to see something new.

Earlier this month Hakim El Hattab wrote an amazing scroll effects in CSS3 demo that you can try in your web browser (if it’s recent enough). While it works tremendously well on a desktop machine, it isn’t quite ready for mobile yet: browsing that page on an iPhone is rather slow, and worse, makes MobileSafari crash if you zoom in.

Still the concept is pretty awesome, and those demos beg to shine on an iPhone. So that’s precisely what we did.

Even better, we wrote all this code as a clean subclass of UITableView. So using it in your own project is as simple as drag’n’dropping two files, and turning any table view you want animated into a subclass (or an instance) of ADLivelyTableView. You can then pick whichever animation you like (or even build your own custom one).

The code is freely available under a BSD license on our GitHub repository.

Be careful though: they’re refreshing eye-candies, but don’t abuse those animations. Depending on the context, they can do more harm than good. Given your use case, you can also write more subtle transitions: for demo purposes the one shown here are rather bold, but it’s very easy to write custom ones that will better fit your app.

An overview of apps monetization

$
0
0

Mobile applications stores, be it Apple’s App Store or Google Play, allow publisher to sell their apps. Although it is an obvious way to monetize an app, it is not the only one. In this article, we will have a look at the various monetization means that are opened to apps developers.

Paid app

This is the classic and proven monetization method, well-known both by users and publishers. Some apps priced below one dollar have had a staggering success.

  • The model is very straightforward, the revenue is propotional to the downloads
  • 70% for the developer / 30% for the platform
  • Pricing can be different from one OS to the other
  • Some users may be reluctant to buy apps, mainly on Android
  • With paid apps, you are less likely to reach a lot of users

Trial version

In order to promote a paid app, a developer may decide to make a trial/lite/free version. Although limited, it should enable the user to make up his mind about the quality of the app and urge him to buy the paid version.

  • It multiplies the chances that your app will be bought (as long as it is worth it)
  • This model is a particularly good fit for games (levels, maps, characters, items, … )
  • Two versions on the store is a bit heavier for the developer

Advertisement

Often in the form of a banner or an interstitial, ads are used by developers who want to spread their app as largely as possible but still get some income.

  • Mobile advertising companies mostly pay by the click
  • Hard to estimate income from ads
  • Ads must not alter user experience (slowness, misclicks)
  • Ads integration should be part of the development process
  • Ads must be well-targeted

Sponsoring

It is a kind of advertisement that prompts the user to carry out an action against a virtual good. This business model, particularly adapted to games, allows to target the audience very well and potentially to increase the revenue of the developer.

  • Business model particularly suited for games
  • Well-targeted audience, thus ads seem less invasive than purely random ones
  • More users reached, thus potentially more income

Freemium app

This very fashionable business model trades digital content for real money. It is based on Apple’s in-app purchase or Google’s in-app billing, which can be implemented in both paid or free apps. Thus, developers can tune their business model at best. According to a study by Distimo, the freemium model is also more effective on Android than on iOS.

  • Quality apps increase loyalty, thus profit
  • In-app content must be worth the price
  • Purchase process must be simple and fast (as few clicks as possible)
  • 70% for the developer / 30% for the platform at each transaction
  • Experience must be limited but not damaged otherwise the user may end up being frustrated

Ask yourself a few questions before starting

Each of these monetization method has its strengths and weaknesses, which must be measured before publishing an app.

Do you target a niche market?

  • Yes: your app should be paid and relatively expensive (> $1)
  • No: you may consider displaying ads

What value would the audience give to this app?

  • < $.99: you may consider displaying ads
  • otherwise: your app may be paid

Which platform is aimed at this app?

  • iOS: a paid app can be successful. Users usually prefer to pay rather than having ads.
  • Android: a paid app will not be as successful as on iOS. Unlike iOS users, Android users mostly prefer to have ads rather than paying their apps.
  • Windows Phone: it is useless to make a trial version. In-app purchases are not yet available.

Is the app modular?

  • Yes: a trial or freemium version is suitable

Does the app have long-term costs? (use of webservices, push notifications, … )

  • Yes: ads can cover operating costs. It is also possible to consider subscription (recently on Android, quite tricky on iOS)

Finally, it is also possible to combine these monetization means. Disney does it with its “Where’s my water?” app: on the one hand a trial version with ads for other Disney apps, on the other hand a paid version with in-app purchase to unlock new levels. The business model should thus be adapted to the app and to the destination platform.

Introducing Shutterbug for Android

$
0
0

Displaying remote images is one of the top request made to a mobile developer. Most applications need it, be it for user profile pictures or news articles thumbnails. There are already a few implementations out there on Android (see LazyList or WebImageLoader). However, we wanted to hit the sweet spot between API simplicity, robustness, and efficiency. To us, SDWebImage hit it on iOS. That’s why we ported it to Android, leading to Shutterbug.

Shutterbug uses the same structure and interface as SDWebImage, with noticeable changes in the implementation to fit Android’s constraints, mainly on the caching part.

Shutterbug lets you fetch remote images and cache them. It is particularly well suited for displaying remote images in lists, grids, and maps as it includes convenience subclasses of ImageView (FetchableImageView) and OverlayItem (FetchableOverlayItem) that make implementation a one-liner.

The code was released as an Android library project. It is freely available under a BSD license on our GitHub repository.

Free those pins!

$
0
0

Six month 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!

VLC for the iPhone hits the AppStore

$
0
0

After the usual validation delay, we’re very happy to announce the availability of VLC on the AppStore !

This new version brings in the following major improvements :

  • It works on the iPhone 3GS and iPhone 4, as well as 3rd and 4th generation iPods.
  • Decoding is quite a lot faster than in the previous version
  • You can now open attachments from other applications, as well as RTSP and MMS streams.

Once again, all the source code is freely available. We’re now hosted on git.videolan.org, so feel free to submit patches if you would like to contribute!

Six AppStore pitfalls

$
0
0

Six AppStore pitfalls and how to avoid them: this is the presentation we gave at the AppStudies conference this monday. For those who couldn’t be there, we’re making our slides available online. We’re talking about internationalisation, updates, and AppStore reviews.

AppStories_Applidium.pdf

519.93 KoDownload

Paste to web : sharing screenshots made easy

$
0
0

Here’s a little utility we’ve been using internally for a while. We’ve decided to make it available to the public as an early christmas gift to Mac users. Introducing PasteToWeb : a very handy Mac OS dashboard widget that lets you upload screenshots on the web. It’s extremely easy to use, and efficient. Here’s how to use it :

  • Press “Ctrl-Shift-Cmd-4” on your Mac, and select the area you’d like to share
  • Go to the dashboard (by pressing F4 unless you’ve changed the setting)
  • Click the “PasteToWeb” upload button

That’s it, you’re done : the widget is uploading the image for you. Once the upload is finished, it will copy the image’s URL in your clipboard, ready for you to share.

PasteToWeb.wdgt.zip

66.43 KoDownload

Here’s why it’s so great :

  • It is super efficient. You can litteraly upload a screenshot in under a second.
  • Not another daemon : it only runs when you need it. No CPU or memory consumption if you don’t use it.
  • Never write anything to the disk at all : the bitmap data goes straight from your clipboard to the web.

Now here are some interesting things to know about PasteToWeb :

  • Ctrl-Shift-Cmd-4 is a standard OS X gesture to take a screenshot to the clipboard. PasteToWeb just uploads your clipboard, so any other way to put bitmap data in your clipboard will work just as well.
  • The images are sent to imgur.com

Apple pulled VLC off the AppStore

$
0
0

Much to our surprise, we received this friday an email from Apple that said “We regret that the dispute regarding your application named ‘VLC Media Player’ could not be resolved amicably between the parties. We have removed your application from the App Store. For any questions relating to this matter, please contact Rémi Denis-Courmont directly.”

This was a follow-up from an email we received from Apple last October : “On 10/20/2010, we received a notice from Rémi Denis-Courmont that Rémi Denis-Courmont believes your application named ‘VLC Media Player’ infringes Rémi Denis-Courmont’s intellectual property rights. In particular, Rémi Denis-Courmont believes you are infringing their copyright.”

Rémi Denis-Courmont’s complaint came pretty much unsuspected, since we did receive approval from the VideoLAN association before starting the iOS port of VLC. As a matter of fact, some members of VideoLAN even helped us porting VLC to the iOS.

It goes without saying, we still believe the AppStore licence is compatible with the GPLv2 under the which VLC is released. Therefore, together with the VideoLAN association, we’ll do our best to not let this be the end of VLC/iOS.

As a final word, we think it’s pretty sad to deny millions of users the right to enjoy a nice piece of open source software … in the name of freedom.

The AppStore mindset

$
0
0

Here’s an interesting story : as you may know, we’ve built an iOS Google Analytics app for our own use. It’s a rather simple (yet efficient) application that lets you check your Google Analytics stats on the go. So we decided to put it on the App Store, for free.

Here are some comments our app got on the US App Store :

  • “Quick access to quick stats. So we have the bait when is the switch? It’s free and no ads? Is my password safe?”
  • “Works perfectly for me. I can’t believe this is free!”

We find it really amazing how Apple managed to get its customers to expect to pay for pretty much anything.

On the web, nobody ever asked why Google Analytics itself was free in the first place while it’s a project several orders of magnitude more complex than our app.

Are universal iOS applications the best choice?

$
0
0

More often than not, iPad applications share a significant part of their codebase with their iPhone equivalent. As an editor, should we prefer publishing a dedicated application for each platform, or a universal one?

Advantages of a universal app

  • With iCloud and its over-the-air automatic synchronization between all our iOS devices, users won’t have your application twice on their iPads.
  • By merging the you minimize the number of app submissions, a difficult moment in which mistakes can easily be made.

Risks of a universal app

  • By spliting apps you won’t annoy users from a specific platform with upgrades that do not concern them.

Other leads

  • Leveraging iPhone downloads to rise in the iPad App Store rankings doesn’t seem to be possible 1. Whatever the method being used by Apple, that’s not a good reason to prefer a solution over the other.
  • Finally, in terms of earnings, it is rather difficult to make a universal app much more expensive because many users will only use it on a single device. Therefore most people price their universal application as if it was an iPhone-only one (this might lead to a slight loss of earnings though as iPad apps are traditionnaly more expensive).

In the end, both choices seem reasonable : two separate apps will offer more flexibilty in pricing and upgrades, whereas a universal one will be more simple. One should be rather careful when making his decision though, as there’s no coming back.

1 Cross Fingers, today #4 on the iPhone App Store is only #21 in the iPad one, far behind iPad-only applications.

2 Because of the way the App Store works, migrating from two separate apps to a universal one (or the other way round) will indeed break the “update link” with your users. Worse : in the case of a paid application, they would have to pay again.

Vim hits the App Store

$
0
0

At Applidium we really dig open source software. To celebrate Vim’s 20th birthday, we decided to port this incredible text editor to the iPad.

We could explain why Vim is so awesome, but many people already have :

So go grab Vim on the App Store. It also does run on the iPhone, but to be honest it works better on the iPad. Last but not least, feel free to report bugs or contribute on our GitHub page.

Too many pins on your map?

$
0
0

One of the most regularly used framework in the iOS SDK is certainly the Map Kit framework, which lets you easily embed and annotate maps in your applications. In this article we will show you an innovative way to make the best out of this framework.

Map Kit: a convenient but limited framework

In general, Map Kit usage follows this pattern:

  1. Instantiate an annotation (a model object which conforms to the MKAnnotation protocol)
  2. Add your annotation to your map (a MKMapView instance)
  3. Tell the map’s delegate what your annotation will look like when displayed on the map

Fairly simple, right? Not quite so: as soon as you have to display a large number of annotations, this naive approach doesn’t work anymore. Here’s why it doesn’t scale:

  • Performance: your device will struggle with all those annotations and you’ll experience dramatic frame drops when panning or zooming the map.
  • Usability: most annotations will overlap on screen, making them difficult to select.

Lately, when we were developing a transportation app, we had to display over a thousand train stations on the map. As the standard implementation wasn’t smooth enough to our liking, we decided it was time to do some research and figure out a solution to this prevalent problem.

Clustering

The solution is called clustering. The concept is simple: group together annotations (eg. photos, stations, restaurants: you name it) which are close to each other. But how do you define close? That’s all the question.

In fact, you probably already use clustering: you can find it in action in the Photos app shipped with the iPhone.

Unfortunately for us developers, Apple didn’t think it was a good idea to expose this neat feature in a public API. So we are on our own on this one.

State of the art

There are already few other clustering implementations around. Some of them are commercial (see Superpin or DTClusterMaker), some of them are open source projects (see REVClusterMap). Though these could be perfectly valid for some uses, neither of them seemed to really fit our expectations.

Clustering is an active field of research and there are already many interesting solutions to this problem. However, in our case, three constraints were prevalent:

  • The complexity of the algorithm must be as low as possible to allow for fast displaying of the map and smooth zooming and panning.
  • We want to be able to animate the transitions when an annotation expands to many (or when several annotations collapse into a single one), like in the Photos app. Thus, our algorithm should be deterministic (no random behavior is allowed while choosing the clusters).
  • We want a natural look which implicitly shows the density of the annotations (no grid/tile effect).

Grid effect in Superpin and REVClusterMap

Discussion

We tried several methods during our research. Let’s see how they perform:

  • Naive perfect method: we started grouping the annotations by evaluating the distance between each annotation to every other annotation. The complexity of the resulting algorithm was obviously (really) bad.
  • K-means: k-means clustering is a popular clustering method used in many domains including statistics and image segmentation. It leads to an easy-to-implement iterative algorithm. Unfortunately, it proved to be quite slow on our devices. And more important, it is not deterministic, thus we can’t animate during zooming and panning.
  • Quadtree: Using a quadtree structure is also a valid approach (used by Superpin, for example). The idea is to build the tree when adding the annotations to the map. Each node respresents the partitioning of the space into four regions. This step can be done offline (read “before showing the map”), so it’s ok if it takes a little time to compute. Updating the clusters to display each time you move the map can then be done quickly, which is nice. There is one major drawback though: you get this infamous grid effect.

Our implementation

We ended up using our own variant of the quadtree approach using another structure: a k-d tree, which in our case consists in a binary tree where the space is subdivided into two regions by a line at each level. What is nice about this structure is that you have full control over where you split your data. For example, you can choose to build a perfectly balanced binary tree by ensuring we have the same number of annotations in every newly created sub-region. But that’s not what we want. Instead, what we do at each step of the construction of the tree is:

  • do a Principal Component Analysis to estimate the principal vector describing the distribution of our annotations
  • compute the mean of the coordinates of the points
  • for each point (x,y), compute the scalar product between the principal vector p and the vector u (x-xMean, y-yMean), xMean and yMean being the mean of the two coordinates of our annotations. The sign of this product determines which partition the point belongs to.

Once the k-d tree is built, we just have to look for clusters through the tree for a given visible region of the map. We do a simple breadth-first search through all nodes of the tree belonging to the visible region of the map, until we reach a maximum number of clusters that we expose as a parameter in our API. So every time you pan or zoom the map, we won’t display more annotations than you need. Plus, you will get nice grouping/degrouping animations because our structure is consistent at any depth in the tree.

Conclusion

Et voilà! If there is one thing to remember of this, it’s that the iOS SDK is a great piece of software that’s just waiting for us to experiment with. It’s actually a lot of fun to work on extending the possibilities of all these frameworks we have in hand.

If you want to see our clustering in action, you can download the free app we developed this method for: RailTime. As you can see on this screenshot, the clusters accurately follow the path of the railway. This is something you wouldn’t see if we were using a quadtree.

We hope you liked this little research article and even maybe learned a little something. If you have any question, don’t hesitate to react to this blog post on Twitter: @applidium.

Viewing all 64 articles
Browse latest View live