Hacking Google Maps and Google Earth (ExtremeTech)

(Dana P.) #1

182 Part III — Google Map Hacks


The U.S. Census Data


For the examples in this chapter the population of different cities in the U.S. is used to provide
the statistical information that is displayed on the map. The information used comes from the
U.S. Census data and is based on questionnaires completed by the public. Looking at a table of
that information (Table 10-1) is not a clear way to view the data. The table has been deliber-
ately sorted alphabetically so there isn’t any order to the population statistics.

Table 10-1 U.S. Census City Population Data

City 2004 2000 1990

Chicago, Ill. 2,862,244 2,896,016 2,783,726
Columbus, Ohio 730,008 711,470 632,910
Dallas, Tex. 1,210,393 1,188,580 1,006,877
Detroit, Mich. 900,198 951,270 1,027,974
Houston, Tex. 2,012,626 1,953,631 1,630,553
Indianapolis, Ind. 784,242 781,870 741,952
Jacksonville, Fla. 777,704 735,617 635,230
Los Angeles, Calif. 3,845,541 3,694,820 3,485,398
New York, N.Y. 8,104,079 8,008,278 7,322,564
Philadelphia, Pa. 1,470,151 1,517,550 1,585,577
Phoenix, Ariz. 1,418,041 1,321,045 983,403
San Antonio, Tex. 1,236,249 1,144,646 935,933
San Diego, Calif. 1,263,756 1,223,400 1,110,549
San Francisco, Calif. 744,230 776,733 723,959
San Jose, Calif. 904,522 894,943 782,248

With a little work it is possible to pull out key points, such as the number of people living in
New York is obviously quite high, but making comparisons can be quite difficult.

Two columns were added to the table: the latitude and longitude of each city shown.
Otherwise, the data used is exactly as shown here.

Converting the Source Data to XML


The preceding table was saved as a tab-delimited text file and then processed through the
following simple script. The script is designed to handle as many years (identified by extracting
the years from the “header” row in the text file), even though the data used throughout this
chapter consists of just the three years shown, 1990, 2000, and 2004.
Free download pdf