You can now swap your map service from Google Maps to Virtual Earth to Yahoo! and more on the fly with the Mapstraction views plugin.
The Mapstraction Project is a library that offers a common API for a lot of the key web-based mapping tools like Google Maps, Virtual Earth, and Yahoo!, which each have their own unique API for integration. Different APIs mean that when you add mapping features to your site, you’re usually forced to select a map provider at the beginning of the process. The problem is that then you’re stuck with the provider, as switching would require rewriting all integration code to use a new provider’s API.
Here’s a quick screencast showing how the Mapstractions views plugin works:
Andrew Turner from FortiusOne turned us on to Mapstraction (he’s one of the main developers behind the project) a couple of months ago because Mapstraction’s standard API allows developers to change mapping providers without rewriting any code. The Mapstraction module for Drupal allows you to create a view, specify which fields contain your geographic coordinates, and chose the mapping provider you want to use.
The view will display a map with each node represented by a point on the map. If you decide to switch to another mapping provider, you just make the change in the view settings. The mapping provider will switch, but the points will continue to appear properly as before.
There are 11 supported mapping providers:
- Google Maps
- Yahoo Maps
- Microsoft Virtual Earth
There is also support for loading custom map tiles provided by the new CloudMade service. Just create a custom map style in the CloudMade Editor, and specify the Style ID in the view settings.
This module was done in preparation for our work on a Knight Foundation grant, who will help fund new mapping tools for Drupal thought the Knight Drupal Initiative.