Chapter 7 — Extending the Google API Examples 111
FIGURE7-4: Providing links for moving around a map.
Adding Overlays
In the previous example, the ability to move the user about the map was added to the map.
However, although the map has moved to show a different location, the exact point you are
highlighting is not clear. For example, although the map may move to One on Wharf, the
restaurant’s exact location is not really clear from just looking at the map.
There are two types of overlays: the marker and the polyline. The former is an icon or map
point that can be used to identify a specific point (for example, a restaurant). The latter is just
a line with start and end points (based on latitude/longitude) and a width specification.
Adding a Single Marker
The GMarker()object creates a simple icon based on a given GPointand can be used to
highlight a specific location, like a restaurant. To add a GMarkerto the map, add an overlay
(using addOverlay()) to place the marker object on the map.