Blog

Greek Villages EN

Greek Version

Database from MaxMind World Cities with Population with open data lisence. Edit with emacs to select greek villages and upload it to google documents.
Next step was the data visualization. For prototyping i used Processing. Amazing job for recieve data from google spreadsheet from Jer Thorp.
After this i map the values of Latitude and Longitude to screen distances:

float lonToX ( float lon ) {    
  return map( lon, 17, 31, 0, width ); 
}// convert a longitude value to screen space
float latToY ( float lat ){    
  return map( lat, 33, 43, 0, height );
}// convert a latitude value to screen space

Create the Arrays

float[] xPos = new float[23263]; 
float[] yPos = new float[23263]; 
String[] xoria = new String[23263]; 

using XlsReader by Florian Jenett and the code:

  reader = new XlsReader( this, "ellinikaXoria3colones.xls" );    
  reader.firstRow();
  reader.nextRow(); // legend
  while ( reader.hasMoreRows() )    // loop thru rows
  {
    reader.nextRow();
    xoria[count] = reader.getString();    // city name
    reader.nextCell();    // lon
    xPos[count] = lonToX( reader.getFloat() );    
    reader.nextCell();    // lat
    yPos[count] = height - latToY( reader.getFloat() ); 
    count++;
  }

After that is like programming game. Solve puzzles.

void mouseInteraction()  {
  fill(0,32);
  rect(-50, -50, width+100, height+100);
  fill(255);
  noFill();
  for (int i = 0; i < 23262; i++) {
    if(abs(xPos[i]-mouseX) < 2 && abs(yPos[i]-mouseY) < 2)  {
      if  (yPosRand > height-13)  yPosRand = 13;      
      stroke(int(random(255)),int(random(255)),int(random(255)), 125);
      curve(0,height, xPos[i], yPos[i], width - 250, yPosRand,  width - 250, yPosRand);          
      text(xoria[i], width - 250, yPosRand); 
      yPosRand = yPosRand + 13;
    }
    viewMouseInteraction = false;
  }  
}
void mousePressed()  {
    viewMouseInteraction = !viewMouseInteraction;  
}

The application has GNU licence is free and open source. Download application and processing code for Linux, for MacOSX and for Windows.

Aris Bezas Mon, 04 October 2010, 02:58PM

See also: