Google Maps API Tutorial

© 2006, 2007 Mike Williams

 

Using Tom Mangan's TLabel extension as markers

It is possible to use Tom Mangan's TLabel instead of Google's GMarker to draw simple markers, and open info windows on them.

Here's an example that uses GIFs and an example that uses PNGs

There's a few disadvantages:

  1. There are no shadows. Or if you build shadows into the image they don't overlap properly.
  2. TLabels don't overlap intelligently. The last one added sits on top of the older ones.
  3. TLabels aren't clickable when they're in the shadow of an info window.
With those disadvatages, why would you ever want to consider doing this?

Because getting rid of all those fancy features allows the code to run a lot faster. Depending on the browser environment, TLabels run between 3 and 4 times faster than GMarkers.

That means that the number of markers that you can sensibly have on screen at once is tripled.


Full details on using TLabel can be found here: gmaps.tommangan.us/tlabel2.html

Significant things to keep in mind are:

  1. Every TLabel must have a unique "id".
  2. That "id" is used as the id of the div that TLabel places on the map, so you can access the div by document.getElementById(label.id) and do things like performing GEvent.addDomListener() on them to open info windows.
Back to Mike's Homepage
Up to the start of this tutorial