Hacking Google Maps and Google Earth (ExtremeTech)

(Dana P.) #1

194 Part III — Google Map Hacks


FIGURE10-5: California’s population data.

Plotting Multiple Data Sets


An alternative to plotting all the data for one year across multiple cities is to show the popula-
tion data for a single city but across multiple years. This can be achieved with the circle trick in
the previous section by overlaying the data for different years in different circles (which should
be represented by different sizes, as the data changes).

For plotting that information there are a few things to consider. First, the data for different
years must be represented in different colors for it to be distinguishable. Also, although by
default polylines are transparent, the transparency will need to be adjusted slightly to ensure the
information is properly visible.

It also worth considering the visibility of the information for those with disabilities, espe-
cially those with color blindness. Using contrasting colors that color blind users cannot see will
completely hide or even confuse the information you are trying to portray. Use the color charts
available at the Colors for the Color Blind web site (http://www.toledo-bend.com/
colorblind), which even includes guides for Web colors and combinations that are safe
to use.

The color issue can be fixed by defining an array of colors as the HTML string used by the
Google Maps API to color a polyline. You know there are only three values in your dataset, so
you can specify that number of colors. For clarity, each color is one of the primary colors:
var colors = [‘#ff0000’,’#00ff00’,’#0000ff’];
var colorsindex = 0;
Free download pdf