-
Get a Google Maps API Key : http://code.google.com/apis/maps/signup.html
-
Put the googlemap folder into the base installation folder (attention : the folder name is case sensitive)
-
Modify settings as you wish in googlemap.yml.example :
a. GoogleMapAPIKey: "abc" ///here the abc stands for the key you obtained at step 1.
b. Copy the parts from googlemap.yml.example in to your mysite config.yml that you want
-
Run a dev/build
-
The page type (lets call it TestPage for which you want to add a location must contain in the controller class:
a. private static $allowed_actions = array('showPagePointsMapXML');
b. public function init() { parent::init(); if($this->HasGeoInfo) { //only add when there are points added $this->addMap("showPagePointsMapXML"); } }
-
Run a dev/build
-
Create a new page in the TestPage type
-
Go tho the Map tab in the CMS for the test page, add a full address, save and publish
-
Find your template file and add the following: <% include GoogleMap %>
-
to customise information in pop-ups, add the following function to your pages with map: CustomAjaxInfoWindow
-
enter CustomPopUpWindowTitle and CustomPopUpWindowInfo in CMS (overrules everything)
-
add the method: CustomAjaxInfoWindow to the PARENT of the point.
this module does NOT work if the html of your page starts with :
http://code.google.com/p/gmaps-api-issues/issues/detail?id=530
- add one or more locations per page
- convert addresses to LAT LNG
- convert LAT LNG to addresses
- map with the following side features
- warns when points are overlapping
- lists of points and layers with ability to hide
- move markers
- add markers
- delete markers
- find antipodeans
- find around me (points closest to point)
- add polygons, lines and points
- add directions
- customise the...
- icons
- map size
- viewfinder
- zoom
- map type
- map control type
- starting lat, lng, zoom
- infowindow
- country
- locale
- icons
- static maps and interactive maps
- use data directly in GoogleEarth Application
- update database using map itself (e.g. drag marker to update location)
Data: The idea of this module is that you attach zero or more (has_many) datapoints to any page.
Presentation: you can select any number of pages and pass them to the DataObjectDecorator as a DataObjectSet. From there, the module works out what points it should use.
Interaction: If the user can edit the current page, then it can also edit the locations (points) associated with current page. Add/Edit/Delete can be done on the map itself.
How it works: Basically, you add a bunch of pages to the viewer, using the decorator. The viewer then creates a XML dataset, and JS files. The JS scripts are loaded inline with html and load the map The JS scripts also use ajax to retrieve data for map (as xml). The XML file can be used as a KML file for Google Earth as well.
- review _config.php settings
- add extension: DataObject::add_extension('SiteTree', 'GoogleMapLocationsDOD'));
- run db/build/?flush=1 you can add maps as follows by adding the following to your init() function in a page controller: $this->addMap("showPagePointsMapXML"); //SEE GoogleMapLocationsDOD for the type of maps you can add
for each page type you must / can:
- static $defaults = array ("HasGeoInfo" => 1); - allow points to be added in the CMS
- add a map and static map icon (to be implemented)
you can filter the map data for particular pagetypes
- see GoogleMapDecorator for more information
- lines
- polygons
- integrate with GIS model
- automatically add map IF it has been added to the CMS
- NO STATIC option
- NO dynamic option
- static maps not working
- layer management
- implement:
class GoogleMaps extends RequestHandlingData { function __construct($parent, $name) { $this->parent = $parent; $this->name = $name; }
function Link() {
return Controller::join_links($this->parent->Link(), $this->name);
}
function aroundMe($request) {
$x = $request->getVar('x');
$y = $request->getVar('y');
return json_encode(....);
}
}
class Page_Controller ... { function GoogleMaps() { return new GoogleMaps($this, 'GoogleMaps'); } }
many thanks to : http://econym.googlepages.com/index.htm created by www.sunnysideup.co.nz to do: -. map.setZoom(marker.accuracy*2 + 3); -. replace add marker title from longitue, lattitude to address -. replace javascript(void) with a warning message that the command did not work. -. allow an icon to be anchored anywhere (right now it is at the center bottom) -. zoom to in xml does not work.... -. make all human added markers dragable -. implement this:
<Style id="randomColorIcon"> http://maps.google.com/mapfiles/kml/pal3/icon21.png </Style> IconStyle.kml #randomColorIcon -122.36868,37.831145,0 1. if points has styleUrl 2. find id for styleUrl 3. get location from styleUrl 4. replace icon URL with styleUrl