Created
November 21, 2010 21:00
-
-
Save ussjoin/709150 to your computer and use it in GitHub Desktop.
Draw Antenna Locations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import processing.opengl.*; | |
String[] lines; | |
void setup() | |
{ | |
size(1024,768, OPENGL); | |
lines = loadStrings("CO.dat"); | |
noLoop(); | |
} | |
void draw() | |
{ | |
background(0); | |
stroke(#ffffff); | |
for (int i=0; i<lines.length; i++) | |
{ | |
//Parse the data | |
String[] parts = split(lines[i], '|'); | |
//6/7/8 is Lat, 11/12/13 is Lon | |
float lat = float(parts[6]); | |
lat += float(parts[7])/60.0; | |
lat += float(parts[8])/3600.0; | |
float lon = float(parts[11]); | |
lon += float(parts[12])/60.0; | |
lon += float(parts[13])/3600.0; | |
float dlat = map(lat, 25, 50, height, 0); | |
float dlon = map(lon, 68, 125, width, 0); | |
point(dlon, dlat); | |
} | |
} |
Sure! I didn't include it because it was too big, but the data comes from the CSV pack at http://www.data.gov/raw/2000 - just download it and grab the named file out. Good luck!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very cool! I wasn't at pubcamp, but by odd coincidence was at an Intro to Processing workshop that day. The source code you posted looks interesting, but I can't see the output without the .dat file. Any chance that can be shared as well? In any case, thanks!