Add Controls and Infowindow to Static Map
There is no JavaScript in this page (except Google Analytics)
Try to click markers and zoom or pan. There is no JavaScript (except Google Analytics) used in this page. Above map is created using code below.
require_once 'Google/Maps.php'; $map = Google_Maps::create('static'); $map->setKey(API_KEY); $map->setSize('540x300'); $coord_1 = new Google_Maps_Coordinate('58.378700', '26.731110'); $coord_2 = new Google_Maps_Coordinate('58.379646', '26.764090'); $marker_1 = new Google_Maps_Marker($coord_1); $marker_2 = new Google_Maps_Marker($coord_2); $map->addMarker($marker_1); $map->addMarker($marker_2); $map->zoomToFit(); $zoom = Google_Maps_Control::create('zoom'); $map->addControl($zoom); $pan = Google_Maps_Control::create('pan'); $map->addControl($pan); $bubble_1 = new Google_Maps_Infowindow('Foo Bar'); $bubble_2 = new Google_Maps_Infowindow('Pler pop'); $bubble_1->setMarker($marker_1); $bubble_2->setMarker($marker_2); $map->addInfowindow($bubble_1); $map->addInfowindow($bubble_2); $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.