Hacking Google Maps and Google Earth (ExtremeTech)

(Dana P.) #1

228 Part III — Google Map Hacks


Although you can introduce any image as a marker, generating that image is not something
that can easily be handled on the fly. Adding text to a marker is only possible by providing an
info window that pops up when you click the marker, and there is very little control over the
opacity and appearance of the icon that is displayed.

The TLabel Extension


The answer to the problem is the TLabelv1 extension, written by Thomas C. Mangan and
available through his Google Maps web site (http://gmaps.tommangan.us/tlabel
.html).TLabelenables you to create a simple point on a map based on text or an image. It
is like creating a unique marker or info window, but without the hassle of creating the custom
icon first.

The result is best demonstrated with a simple text example, something which is not possible
with the standard Google Maps API. Figure 12-1 shows a basic TLabelobject overlaid on
top of a Google Map.

FIGURE12-1: The basic TLabel object.

You can see from the figure that the label is just that — a simple piece of text placed on top of
the map. The text in the label is completely dynamic; this is not an icon that I have previously
generated. The contents, layout, and opacity of the object are all controllable when the TLabel
object is generated.
Free download pdf