Skip to content

Instantly share code, notes, and snippets.

@ussjoin
Created November 21, 2010 21:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ussjoin/709150 to your computer and use it in GitHub Desktop.
Save ussjoin/709150 to your computer and use it in GitHub Desktop.
Draw Antenna Locations
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);
}
}
@alykat
Copy link

alykat commented Nov 22, 2010

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!

@ussjoin
Copy link
Author

ussjoin commented Nov 22, 2010

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