Due: 8:00am, Thursday, March 25. Value: 30 pts. Submit to Sauron.
The text file ar-zips.txt [link] contains a line for each zip code in Arkansas, including the latitude, longitude, zip code, and location name. [About the data source.] For this assignment, you won't use the zip code and location names.
Your assignment is to create a window that contains a circle located at the point associated with each zip code you find in the file. Each circle should have a radius of 5 pixels and should be solid green. The result should be a constellation in the shape of Arkansas, with a heavier concentration of circles where the larger population centers are located.
Converting latitude-longitude pairs to x-y
coordinates is, to say the least, complex. People have come up
with many complex techniques, based on different map projections. To
save you the work of figuring this out, I found some reasonable
code that I adapted into a function [link] that you can copy and paste into your
program. This function takes two parameters representing the latitude
and longitude, and it returns a Point (as defined in the graphics
library). For points in Arkansas, the x-coordinate will
be between 0 and 424, while the y-coordinate be between
0 to 382. (You will accordingly want to create your
GraphWin window 425 pixels wide and 383 pixels
tall.)
Below is the program we saw in class that illustrates how a Python program can process a text file line by line.
dict_file = open('words.txt')
for line in dict_file:
word = line.rstrip()
if word.find('vv') >= 0:
print word