Mapping with CartoDB

Have some data you’d like to map using CartoDB? This post will walk you through the process.

These instructions assume you are using the  list of geocoded conference participant towns that you will find here (csv format). Just download the file to your machine.

Of course you are very welcome to use any other geocoded dataset you happen to have lying around. (If your data describes countries or street addresses but is not yet geocoded, CartoDB will – in theory – be able to handle geocoding them automatically. I hope to add a post on that sometime soon.)

Here goes.

  1. First, create an account on CartoDB (www.cartodb.com). To create an account you will need to provide a name and an email address. That’s all.
  2. Once you have an account and are logged in, look at the blue banner at the top – you will see your username. Use the dropdown arrow to select “Datasets”.
  3. Then click on the green “New Dataset” button.
  4. Drag your csv file over from Windows Explorer or navigate to it.
  5. At the bottom of the screen you will see a green “Connect Data” button – click.
  6. You should now see the data in “dataview”.

Want to map it?

  1. At the center of the blue banner on the top of the screen, click on “Map view”.
  2. At the lower left of the map screen you will see that CartoDB is suggesting two possible ways of looking at your data. Click on “Show”. Your choices are Heatmap or Bubble. Click on Heatmap.
  3. Doesn’t that look fancy? Sure does. Zoom in and out a few times to get a sense of how the heatmap changes.
  4. Now let’s look at the data in another way. Look at the vertical column on the right side of the screen. Click on the paintbrush icon (“wizards”).
  5. Use the arrows to navigate to “Bubble”. You will see that the “column” is automatically set to visualize the “latitude” field, which doesn’t make a whole lot of sense. Use the dropdown arrow to select “participants”. Now the bubble size will be determined by the number of participants from each location.
  6. You can play with the settings. Change the bubble radius or color or stroke type until you like the way everything looks.
  7. Just below the paintbrush icon click on the “infowindow” icon. This is where you control what a user will see when they click on a point on your map. I’ll toggle on “school”, “state”, and “town”. You can change the order in which they appear by resting the cursor on the label until you see the 4-arrowed icon and dragging the field up or down.
  8. Click anywhere on the map itself to make the editing box fold away.

Taking It Up a Notch

  1. Let’s pretend you are making a map of towns that sent more than one participant to the conference. You need to filter your data. Toward the bottom of the vertical editing column you will see a graph icon. Rest your cursor – the “filters” label will show up. Click on the icon.
  2. To filter on # of participants, select the participants column.
  3. Drag the slider to the right until the display reads 2.00-4.00.
  4. Click anywhere on the map itself to minimize the editing box.

Finish the Job

  1. In the upper right corner, click on “Visualize”
  2. Click “Create Map”
  3. In the bottom left you will see “Change basemap” and “Options”. Explore.
  4. In the upper left you will see “Add element”. Here is where you can add a map title, annotations, images, etc.
  5. When you are satisfied, click “Publish” in the upper right. Now you can harvest the URL or embed code for your map. That’s it!

 

Advertisements

How to geocode lots (and lots) of points

Want to take a crack at mapping a set of points from an Excel spreadsheet?

Excellent. You need to do 2 things. First, geocode your data (in other words, assign latitude and longitude to each point). Second, map it on CartoDB. This post will walk through the first process, step by step. (Please note that this process will work with town/state data, or with street addresses.)

If you have a small number of points, you can hunt down the lat/longs individually (see the “Basic Geocoding” post. If your data describes lots of points on the map AND they are located in the United States, BatchGeo will do the work for you. Here’s how:

  1. Get your data here: https://dl.dropboxusercontent.com/u/9298678/NEHTA%20data_town.xlsx
  2. Save it to your computer and/or open the Excel file.
  3. Copy the contents (on a PC, just control+ A to select, then control+c to copy)
  4. go to https://batchgeo.com/
  5. paste your data in the box (click in the box, then control+v)
  6. Wait until it shows up. Then click “Map now”.
  7. If BatchGeo tells you your data lacks column names, don’t worry. Just click “ok”.
  8. Wait for BatchGeo to work its magic. It will geocode all 50 rows.
  9. Click “Save and Continue”
  10. Give your map a name (it doesn’t really matter) and enter your email address. Then “Save map”. Then “Ok”.
  11. Now you will see then map of your data. Great. But how do you get it out of BatchGeo? Scroll to the very bottom of the screen. Click on “Download XXX Google Earth (KML)”.

You now have everything you need. (As long as you know where your downloaded data went on your computer – most likely into the “Downloads” folder.) Your geocoded data is in KML format. You can open it right up in Google Earth or your favorite GIS software. If you want to map it in CartoDB, see the Mapping with CartoDB post.