Hacking Google Maps and Google Earth (ExtremeTech)

(Dana P.) #1

122 Part II — Instant Gratification


FIGURE7-11: An info window after a user has clicked a marker.

Because the information in the info window is HTML, you could easily add the address, a link
to the restaurant web site, and even a picture of the restaurant. There is no limit to what can
be displayed in this info window, although there are some obvious limitations to the size and
quantity of information that be effectively displayed in such a small window.

The method option (which automatically attaches the info window to the marker and the point
that triggers it) has been used in the example, but you can also create info windows separately
by using openInfoWindowHtml()and supplying the point and HTML to be displayed. As an
alternative to displaying HTML embedded into the call to openInfoWindowHtml(), you can
also use openInfoWindow(), which takes an HTML DOM reference of the information to
display, and openInfoWindowXslt(), which translates the supplied XSLT reference and
XML into HTML for display.

The entire map also has an info window that can be used to display information about the map
in general.
Free download pdf