Washington, DC
Subscribe to GeoRSS Subscribe to KML

Mapstraction adds support for OpenLayers

Published in Mapstraction, Technology  |  3 Comments

OpenLayers MapstractionMapstraction, the mapping abstraction library (write once, use any map provider) recently added increased support for OpenLayers, the very powerful, open-source Javascript mapping library. With this support Mapstraction users can now easily use the open-source OpenLayers API that is free from potentially restricting terms of service, or even use in offline and intranet applications.

You can see a demo of OpenLayers here or grab the latest revision here (r163 as of this posting).

This effort was headed up by Henri Bergius (aka Bergie), of Midgard fame, and now Mapstraction-OpenLayers will be supported in the Midgard CMS. Read more on Bergie’s blog.

In addition, by default the Mapstraction-OpenLayers creation uses the OpenStreetMap tiles, therefore no longer requiring a Google Maps API key just to use OSM in Mapstraction.

Why wrap one wrapper in another?

At conferences and get togethers, the devs and users of Mapstraction and OpenLayers frequently ask the question “What’s the difference between Mapstraction and OpenLayers?”

The primary distinction between the libraries is a difference in objective. Mapstraction seeks to provide a simple wrapper to meet the primary needs of a mapping user. The purpose being to make it easy for a user to read a single API and then easily switch to any of the major providers. By contrast, OpenLayers provides a very powerful, but potentially complex, interface that allows for bringing in content from OGC services, data feeds, overlays, and tile servers.

With Mapstraction generally targeting the ‘lowest-common denominator’ of all the API’s there isn’t built-in support for the additional capabilities of OpenLayers for layers, drawing, and services. However, Mapstraction goes provide a simple mechanism for gaining access to the underlying mapping provider such that a developer can utilize Mapstraction for the 80% of their development, and then access the remaining 20% provider specific capabilities directly.

All you need to do is call getMap() on the Mapstraction object to get the underlying OpenLayers object and go to town.

With this new support, it now brings Mapstraction up to 9 supported map interfaces (Yahoo, Google, Microsoft, Map24, MultiMap, MapQuest, FreeEarth, OpenLayers, OpenStreetMap). If you are a map provider and would like to find out how to be the 10th provider feel free to email the dev team –

Similar Posts


  1. Ghillie Suits » Mapstraction adds support for OpenLayers says:

    October 30th, 2007 at 9:50 am (#)

    […] Check it out! While looking through the blogosphere we stumbled on an interesting post today.Here’s a quick excerptMapstraction , the mapping abstraction library recently added increased support for OpenLayers , the very powerful, open-source Javascript mapping library. […]

  2. newToOpenLayers says:

    August 29th, 2008 at 10:44 am (#)

    Would you mind give me a clue how the variable “tbFixedNavigation1r2” defined? Thanks in advance, i really need it urgent.

    var history_control = new OpenLayers.Control.NavigationHistory();
    buttonPrevious =
    tooltip: {text:’Toon de vorig gekozen uitsnede.’, title:’Vorige
    uitsnede’}, disabled: true, buttonid:’ZOOMPREV’});
    buttonNext = tbFixedNavigation1r2.addControl(,
    tooltip: {text:’Toon de volgende gekozen uitsnede.’,
    title:’Volgende uitsnede’}, disabled: true, buttonid:’ZOOMNEXT’});“activate”, buttonPrevious,
    function() { this.setDisabled(false); });“deactivate”, buttonPrevious,
    function() { this.setDisabled(true); });“activate”, buttonNext, function()
    { this.setDisabled(false); });“deactivate”, buttonNext,
    function() { this.setDisabled(true); });

  3. Vamsi says:

    January 31st, 2012 at 8:14 am (#)

    I am big fan of Mapstraction,it is awesome library.

    I am working on mapstraction with openlayers,In that is not working , could you please tell me the right way to use it with some simple example

    Thank u very much