Washington, DC
Subscribe to GeoRSS Subscribe to KML

Mapstraction Updates

Published in Mapstraction  |  5 Comments

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.

Similar Posts


  1. Steven Citron-Pousty says:

    June 1st, 2009 at 5:25 pm (#)

    Hey Andrew
    Thanks for the history and summary. So how does mapstraction and openlayers fit together in the ecosystem. Why would somebody choose one over the other? Where are there strengths and weaknesses. It would be really helpful if someone could lay this out for the users. Not in a snipey way but in a “one person’s take” kinda way – would probably strike an interesting discussion. I know you and Chris/Schuyler are friends and this would be really interesting to hear.
    Thanks again

  2. Timmie says:

    June 3rd, 2009 at 12:27 pm (#)

    this library looks really nice.

    I would like to have some more information:
    * Can you highlight the main differences towards mapfish?
    * How do I add WMS, WFS and kamap layers?


  3. Andrew Turner says:

    June 5th, 2009 at 7:35 pm (#)

    @Steven & @Timmy – there is a fundamental difference between what the goals of Mapstraction and OpenLayers are:

    Mapstraction is an abstraction library that provides a common interface around the primary base functionality of the broad range of mapping providers. It will still provide the native interface of those providers (e.g. a GoogleMap will still look and act like a Google Map, and same for Yahoo, MS, etc.)

    OpenLayers is an entirely (except for gmap wrapper?) open-source, built from the ground up mapping and geo library that implements all of it’s own functionality rather than use a third-parties.

    As for use-cases, Mapstraction is meant for users that want choice in which provider or library they are using, but still use that provider; OpenLayers provides a more feature rich, advanced interface more appropriate to “GIS” applications.

    And any discussion of lightweight vs. GIS is a red-herring – you know what I mean.

    @Timmie – specific to your question. MapFish is a set of controls that sit on OpenLayers, right? It’s not a mapping library.

    And you can bring in WMS/WFS/kamap if the provider supports it. Again, the difference between Mapstraction and OpenLayers.

  4. JamesD says:

    June 11th, 2009 at 9:05 am (#)

    Thanks for the useful info. It’s so interesting

  5. FLorin Homone says:

    June 18th, 2009 at 7:43 am (#)

    That;s nice
    However we are having Multimap provider. When trying to access
    it is saying:
    “Multimap viewer is not defined”.