Hacking Google Maps and Google Earth (ExtremeTech)

(Dana P.) #1

Chapter 10 — Overlaying Statistical Data 191


pointpair.push(new GPoint(points[i].x,
secondlat));
var line = new GPolyline(pointpair,”#ff0000”,20);
map.addOverlay(line);
polylines.push(line);
}
}


The bar graph example is available at http://maps.mcslp.com/examples/ch10- 02
.html.


The resulting display is shown in Figure 10-2. You can see the polylines for each city overlay-
ing each city location, with standard markers highlighting the precise location. It is also clearer
from this display that the population of New York is large compared to the others.


FIGURE10-2: Bar graphs of population data.


Conveniently, polylines are also transparent, so you can see the information from multiple cities
even when the data overlaps. Also, as polylines, the information remains displayed on the map
even when the map is zoomed or moved, as shown in Figure 10-3.

Free download pdf