KML Data With Static Maps
There is no JavaScript in this page (except Google Analytics)
Markers and infowindow data comes from KML. Zooming and panning works. There is noJavaScript (except Google Analytics) used in this page. Markers are clustered using distance based clustering. Map is created using following code:
require_once 'Google/Maps.php'; $map = Google_Maps::create('static'); $map->setKey(API_KEY); $map->setSize('540x300'); $zoom = Google_Maps_Control::create('zoom'); $map->addControl($zoom); $pan = Google_Maps_Control::create('pan'); $map->addControl($pan); $clusterer = Google_Maps_Clusterer::create('distance'); $map->setClusterer($clusterer); $xml = simplexml_load_file('http://kaskoabi.ergoaitab.ee/ergo2.kml', null, LIBXML_NOCDATA); foreach ($xml->Document->Placemark as $placemark) { list($longitude, $latitude, $elevation) = explode(',', $placemark->Point->coordinates, 3); $coordinate = new Google_Maps_Coordinate($latitude, $longitude); $marker = new Google_Maps_Marker($coordinate); $marker->setSize('small'); $marker->setColor('blue'); $bubble = new Google_Maps_Infowindow($placemark->description); $bubble->setMarker($marker); $map->addMarker($marker); $map->addInfowindow($bubble); } $map->zoomToFit(); $map->setProperties($_GET);
Where's the Source?
Code uses work in progress Simple Static Maps PHP class. It aims to make working with static maps jolly good. Code is still alpha quality. API might change any time. Use at your own risk.
If you like this you might also want to see walkthrough and other features.