Hacking Google Maps and Google Earth (ExtremeTech)

(Dana P.) #1

214 Part III — Google Map Hacks


the visibility of stacked icons. You can see the effect in a sample of the map application show-
ing many different types in Figure 11-2; even though the map is quite busy with information,
you can still clearly see the different icon types on the map.

FIGURE11-2: Busy, but clear, map information.

To match the icon with the entity type, you give each icon a name that is the lowercase version
of the entity type that was given when the data was inserted into the database table. That way,
when entities of a particular type are loaded from the database, the correct icon can be selected
by name.

You can generate the icon within the Google Maps application with a simple icon-building
sequence. Reference points are made for the bottom-left corner as the anchor point, and info
panels are offset from the top-right corner of each icon:
var baseIcon = new GIcon();
baseIcon.iconSize = new GSize(32,32);
baseIcon.iconAnchor = new GPoint(0,32);
baseIcon.infoWindowAnchor = new GPoint(32,0);
baseIcon.image = “http://maps.mcslp.com/examples/” + ;
types[index].toLowerCase() + “.png”;
Free download pdf