Hacking Google Maps and Google Earth (ExtremeTech)

(Dana P.) #1

Chapter 3 — The Google Maps API 47


The created marker supports a number of methods for adding information windows based on
an HTML reference, HTML string, or XSLT transformation of XML data. You can also con-
figure a GMarkerobject to force a zoomed version of the map for that point. Table 3-7 shows
the full list of supported methods.


Table 3-7: Methods for the GMarker Object

Method Description

openInfoWindow(htmlElem) Opens an info window with the given HTML content
over this marker. htmlElemshould be an HTML
DOM element.
openInfoWindowHtml(htmlStr) Like openInfoWindow, but takes an HTML string
rather than an HTML DOM element.
openInfoWindowXslt(xmlElem, Like openInfoWindow, but takes an XML element
xsltUri) and the URI of an XSLT document to produce the
content of the info window. The first time a URI is
given, the file at that URI is downloaded with
GXmlHttpand subsequently cached.
showMapBlowup(zoomLevel?, Shows a blowup of the map over this marker. You use
mapType?) a default zoom level of 1 and the current map type if
the zoomLeveland mapTypeparameters are not
given.

All GMarkers also support the following triggers when the specified event occurs:


click: Triggered when the user clicks the marker.
 infowindowopen: Triggered when the info window is opened.

infowindowclose: Triggered when the info window is closed.

GPolyline


This class creates a line made up of two (or more) GPoints for display on a map. The format
of the function is as follows:


GPolyline(points,color,weight,opacity)


The pointsargument should be an array of GPointobjects.

Free download pdf