Assignment 1

The goal for next week is to have a visualization of French towns by displaying towns as dots then mapping population and a second variable (e.g. density, surface, or altitude) to color or size (or another visual variable of your choice). This should be achieved before the next class. To make up for the problems we had today, you do not have to send us your projects. We will grade Assignment 2 directly

You would have to calculate density yourself (as a measure of population over surface). OR you can just use surface area as a data variable to encode directly.

Before the assignment you will do a 85 min lab work where you will be explained how to setup and use a Processing IDE, how to load a dataset, how to use the draw function and how to use classes. Slides are available here

Instructions

Download the data file from hereThe first line of the data file contains pre-processed information in the following order: (number of places in the file, minX, maxX, minY, maxY, minPopulation, maxPopulation, minSurface, maxSurface, minAltitude, maxAltitude). The second line in the file contains the header describing what each column of the file represents: (Postal Code, x, y, iseecode, place, population, surface, altitude)

Code for reading the file info

This code describes how to read the first line of the file to get the pre-computed minimum and maximum values for each data variable

//globally
//declare the min and max variables that you need in parseInfo
float minX, maxX;
float minY, maxY;
float totalCount; // total number of places
float minPopulation, maxPopulation;
float minSurface, maxSurface;
float minAltitude, maxAltitude;

//in your readData method
  String[] lines = loadStrings("villes.tsv");
  parseInfo(lines[0]); // read the header line

void parseInfo(String line) {
  String infoString = line.substring(2); // remove the #
  String[] infoPieces = split(infoString, ',');
  totalCount = int(infoPieces[0]);
  minX = float(infoPieces[1]);
  maxX = float(infoPieces[2]);
  minY = float(infoPieces[3]);
  maxY = float(infoPieces[4]);
  minPopulation = float(infoPieces[5]);
  maxPopulation = float(infoPieces[6]);
  minSurface = float(infoPieces[7]);
  maxSurface = float(infoPieces[8]);
  minAltitude = float(infoPieces[9]);
  maxAltitude = float(infoPieces[10]);
}

For completing this assignment you are encouraged to refer to the numerous examples provided with the Processing IDE and to the online reference manual. This assignment does not have to be formally handed in but needs to be completed for the purpose of the second lab work session, where we will extend the application and make the map interactive.

License

You can reuse this content for your class if you acknowledge us (Petra Isenberg, Jean-Daniel Fekete, Pierre Dragicevic and Frédéric Vernier):