We’ve just open sourced code that brings embedded interactivity to maps on the iPhone and iPad. The code is available in our interactivity branch of the Route-Me mapping library for iOS. We will maintain this branch as a separate sub-project so you can easily merge it using GitHub’s (and Git’s) excellent branching and merging tools.

If you are new to map interactivity, check out Visible Map, which demos the interactivity in our maps. Tom also has a must-read post talking about how UTFGrid works in plain English. Lastly, we’ve coded up an example iPhone app to show how easy it is to use.

We hope iOS developers will take advantage of this library to make more interactive maps for use on the platform. TileMill, our open source map design studio, allows you to make web-based interactive maps and with the MapBox iPad app you can use these maps offline and on mobile platforms. And now with this code, and since all of this technology is open source, you can make apps yourself that have this interactivity built-in.

The example app makes use of a subset of our beautiful Geography Class tile set, which is included in the both the sample code as well as every installation of TileMill. In a data file of just 29MB, we are able to pack in contextual data - in this case the country name and a flag image - for every pixel at every zoom level, making it available when used offline. The main class in the app is barely a page of code and covers displaying the map as well as responding to touches and displaying a popup in response.

Open sourcing this code rounds out the contribution of all our map libraries as open source. iOS developers now have the ability to use MBTiles sets for offline use, MapBox Hosting sets from either our hosted service or your own installation of our open source tile hosting software, and full interactivity support for both types, local or remote.