Resources

Google Maps API Tutorial

How GLayers Work

When you add GLayer()s to your map, the API creates something like a GTileLayerOverlay() onto the G_MAP_OVERLAY_LAYER_PANE (pane 1).

The images on the layer are not individual icons, they’re painted onto tiles. The tiles look like this:

and have URLs like:
http://mlt3.google.com/mapslt?lyrs=lmc:panoramio&x=2013&y=1318&z=12&w=256&h=256
http://mlt3.google.com/mapslt?lyrs=lmc:youtube&x=2013&y=1318&z=12&w=256&h=256
http://mlt3.google.com/mapslt?lyrs=lmc:wikipedia_en&x=2013&y=1318&z=12&w=256&h=256

If you have more than one GLayer() on your map, there’s still only one layer of tiles. The different types of content are all assembled onto the same set of tiles, like this:

with URLs like:
http://mlt1.google.com/mapslt?lyrs=lmc:panoramio,lmc:wikipedia_en,lmc:youtube&x=2013&y=1316&z=12&w=256&h=256

The order in which you addOverlay the GLayers onto the map controls the order in which the LMCs appear in the URL. The order of the LMCs within the URL controls the order in which the images overlap. In the above example, the panoramio images are on the bottom, then the wikipedia images, and the youtube images are on the top.

The tiles are normally palletized PNG files with 8 bits per pixel, if the beowser is MSIE they will be full colour PNG files with 32 bits per pixel. I guess that the API chooses the smaller 8-bit images if the browser environment supports it.

Clicks

GLayer()s reside below all other clickable overlays. Polygons and polylines reside on thge same pane, but at a higher z-index value. All other clickable overlays reside in higher panes.

If there’s a clickable overlay covering a particular point, then a click at that point will be grabbed by that overlay, and won’t reach the GLayer(). So, if you want the GLayer() to be clicked when below a semitransparent GPOlygon, you’ll need to make that GPolygon unclickable by using {clickable:false}

When the user clicks on a GLayer icon, the click does not trigger a map “click” event.

When the user right-clicks on the map while a GLayer() is present, the details returned by the “singlerightclick” event are those of the GLayer(), not those of the map.

As well as the images, the API receives information about the positions of the hot spots, which it uses for changing the cursor when you hover over a hot spot. This information is not accessible.

There doesn’t appear to be any way to programmatically trigger a click on a GLayer hot spot.

LMCs

All possible layers are identified by an LMC. The documented layers also have IDs. You can use either an ID or an LMC when you create your GLayer. E.g. GLayer(“lmc:panoramio/0”) is the same thing as GLayer(“com.panoramio.popular”). It’s a good idea to use the ID whenever you’re adding a documented layer, because Google just might change the details of undocumented features.

Advertisements