This week, we explored the concepts of generative text and data visualization. I particularly enjoyed working with data and finding ways to represent the data visually. For the assignment, I decided to map the airports of the world using points.
I began by importing a data set containing the airport code, country, latitudes, and longitudes. Three arrays have been created to extract the Longitude, Latitude, and Code columns. Using a for loop to iterate through the range of possible values, the longitude and latitude values have been used as the x and y coordinates of the points.
The points have been given a randomized color through stroke(). Further, to add an element of interactivity, the screen displays the airport codes when the mouse is pressed.
for (let i=0; i<=rowNum; i++){ stroke(random(255),random(255),random(255)) strokeWeight(6) x=map(latitude[i],90,-70,0,width) //Mapping the latitude to the width of the canvas y=map(longitude[i],-130,170,0,height) //Mapping the longitude to the height of the canvas point(y,x) if (mouseIsPressed) { //Executes when the mouse is pressed strokeWeight(2) stroke(255) text(code[i],y,x) //Displays the corresponding airport code for each i value textSize(10) } }
This was an interesting assignment that allowed us to map existing data and produce beautiful artwork. I would like to extend my learning by exploring the different ways in which data can be represented to make it better understood by the viewer.