Mapstraction Updates

mapstraction v2 logoIt's been a long while since I've talked here in-depth about a project I've been helping with for a few years now. If you're not familiar with it, Mapstraction is a JavaScript library that provides a common interface to more than 11 other major mapping providers such as Google, Microsoft, MapQuest, OpenLayers, and FreeEarth, just to name a few.

The project originally started with just three providers: Google, Yahoo, and Microsoft; and was developed by three developers: Tom Carden, Mikel Maron, and Steve Coast. At the time, it was succint and easy - using constructs such as switch statements in a single mapstraction.js file.

Over time, as more providers were added - this became quite unwieldy. 11 case statements in any method, various callback hooks necessary, and in general quite slow to load and run for the client.

Fortunately, some very bright JavaScript experts: Rob Moran, Derek Fowler, and Adam DuVander, all congregated to help architect a complete new version that takes incorporates the current evolution of Mapstraction to provide a smaller file download and computation overhead. In addition, because each provider is now split out into an individual file such as, it makes it easier for developers to support single providers without having to worry about any other provider or their impact on other code.

New Code Neighborhood

In order to start promoting the new API and encouraging developers to come and help out, we put the source code and tickets into a Google Code project. Although, being Subversion, you still have to submit patches to get changes accepted for now. So I personally suggest working from the Github version, which will be kept up to speed with git-svn, and then you can submit patches from here to push into the 'official' subversion repository.

The demos on the Mapstraction homepage do well at showing the capabilities of the library, but are difficult to maintain and users and potential contributors can't really play with them at all. So as part of our Where2.0 workshop, I put together a Mapstraction API Sandbox, built with Google's AJAX API Playground, and running on AppEngine.

In this sandbox, you can see more demonstrations of the API, associated code, and even modify JavaScript or HTML and create your own personal copies. For example, you can see complex marker creation, the initial version 2 demo, or the marker filtering demo.

Mapstraction API Sandbox

There is definitely a lot of recent excitement around the API. We decided to use Mapstraction as the basis for our own GeoCommons Maker map integration - making it easy for developers to work within a common framework (demo). So get started contributing!

For more recent news on Mapstraction checkout the recent posts onO'Reilly Radar and ProgrammableWeb.

About this article

written on
posted in Mapstraction Back to Top

About the Author

Andrew Turner is an advocate of open standards and open data. He is actively involved in many organizations developing and supporting open standards, including OpenStreetMap, Open Geospatial Consortium, Open Web Foundation, OSGeo, and the World Wide Web Consortium. He co-founded CrisisCommons, a community of volunteers that, in coordination with government agencies and disaster response groups, build technology tools to help people in need during and after a crisis such as an earthquake, tsunami, tornado, hurricane, flood, or wildfire.