[MUSIC] In this part of the project you'll be customizing a map using dynamic data. So in the next three videos what we'll be doing is stepping through an example that has a similar objective. So you can see how you might want to design your thinking for the next part of the project and also see how we might do it in practice. So by the end of this sequence of videos, you'll be able to approach customizing maps, and you'll be reading in data files and working with the data that you get from those files. And then you'll organize that data using objects both from the unfolding libraries and objects that you define yourself, and we'll be thinking about organizing data using some abstract data types. So let's start by setting up the problem, and this example I just find really striking. So what we'll be doing is annotating a map of the world, so we'll look at all countries in the world and we'll be thinking about data for average life expectancy at birth. You can think about a person born on the other side of the world from you, and as they start off their life journey, how long might they expect to have on this world? So there's data collected by the World Bank and you can read it in. And what we've done is annotate this picture of the world, this map of the world, so that the bright red spots are countries where the average life expectancy at birth is somewhere around 45 years. And the bright blue spots have average life expectancy around 85 to 90 years. And so just in this visualization we see that the range of life expectancies we find globally. And this is pretty striking, and so by the end of the videos, you'll be able to do similar visualizations with all sorts of data sets that are available online and in other sources and that we'll also make available for you through this course. So the life expectancy data that we might get, say from the World Bank, for example, comes to us as a spreadsheet, comma separated values. Lots and lots of rows in this file. And we want to make sense of it, we want to present it in a way that's easier to understand and organize. So when we have a high level objective like drawing pictures or visualizing data on a map, it's useful to break it down into manageable chunks before we sit down to program a solution up. And so for this particular problem, we can think of our project in three stages. First, we might setup the map, configure the window and display the countries. Then we might go to reading in the data, and looking at the data file that we have. And finally we can convert that data into a visualization on the map. So the videos will be separated into these three stages and we'll wrap up this video by setting up our map. So this is a good opportunity to think back to the beginning of your project. And you've already played around with similar code where we declare a class, we create a new class, that extends PApplet and uses the UnfoldingMaps library. So in this class definition we are in a new file, the LifeExpectancy file. And remember that the file name has to match the class name. And what we're going to do is create a map and then we have to define two methods, the two methods that will setup our applet and then draw it continuously while the applet is running to update the view. Okay, so let's start by setting up the map and that first line of code is setting up the size of the canvas. We've seen that in a few earlier videos so hopefully it's familiar at this point. And then beyond that we're creating a new map. So we're using the constructor for the UnfoldingMap, and we're creating a new map object that we'll be manipulating and using throughout the project. All right, this is slightly new and what we're doing here is using one of the built-in methods in the UnfoldingMaps library. And what this method does is allow the user to interact with the map in some limited ways. So by invoking MapUtils.createDefaultEventDispatcher, which all seem like magic words at this point, but if you invoke this little magic command, What that happens when we run our applet is that double-clicking leads to zooming in in the map and we can do some panning around in the world. Now, computer science is not magic and we will make all of this clear in a future module. We will talk about event handlers. We'll talk about what's going on under the hood, but for now in order to add some added interactivity, we use this line of code. Okay, so we've set up the map a little bit, we've created a map object and we've configured its size. And now if we go ahead into that draw method, we can call the map's own draw method, each UnfoldingMap comes with its own draw method, that will refresh the screen based on the current objects and parameters associated with the map. And so at this point what we have is that default canvas with the map of the globe. And what we'll do in the next two videos is start bringing in our data and shading the countries of the world based on the life expectancy data that we talked about earlier.