Maps in Midgard, abstracted

We had some discussion about what features make CMS a GeoCMS with GeoPress and Drupal geo developers in State of the Map, and a list should be published soon. Based on our discussions I decided that Midgard should also make it easy to actually display positioned data on maps.

To make this happen, the Mapstraction javascript library was chosen. Mapstraction is nice in that with it site builders can use same API to display maps from OpenStreetMaps, Google Maps, Microsoft Virtual Earth or other providers.

During train ride from Manchester to Birmingham I made a quick PHP wrapper to make map display even easier.

Now to display an object on a map site builder only needs to do:

<?php
$map = new org_routamc_positioning_map('my_example_map');
$map->add_object($article);
$map->show();
?>

Multiple objects and arbitrary map points can also be shown:

// Add some positioned objects
$map->add_object($article);
$map->add_object($another_article);

// Add arbitrary marker
$marker = array
(
    'coordinates' => array
    (
        'latitude' => 52.4827,
        'longitude' => -1.89739,
    ),
    'title' => 'Bergie',
);
$map->add_marker($marker);

Grab it from SVN while it is hot!


Read more Midgard posts.