We’re going to make some interactive maps using Carto, a freemium site.
We’ll make bubble maps and choropleth maps based on town snowfall data in Massachusetts.
Let’s get you signed up and logged in.
This is the default landing page. You don’t have any data or maps here yet so they offer you some suggestions.
Note that Carto has two sections: Maps and Datasets.
You’ll be alternating back and forth.
Click over to the Datasets section of the website and click New Dataset.
You might need to click on the arrow next to Maps to see the Datasets link.
Click on the Connect dataset tab.
Download this Massachusetts town snowfall totals dataset.
This is what the data looks like. Town and snowfall in inches.
Now upload it via the Browse button.
CartoDB will process your data and pop up this data viewer.
Notice there are three new columns added to the dataset:
What happened here was Carto guessed the column with the location data and automatically looked up the latitude and longitude of each one and added a new column with that information.
Pretty cool feature. It’s called geolocation. Usually, people have to use other services (that sometimes charges money) to determine the latitude and longitude for a given address.
But Carto does it automatically and for free. The downside is that you can only get that service if you use their service. You can’t just export the latitude and longitude data and put it into something hand-coded. Well, you can, but it’s a little tricky…
Dots on a map
Now click on the Create Map button at the top.
Well, a lot of this data is outside of Massachusetts, so that’s problematic.
That’s because the original dataset just listed town names without the context of the town being in Massachusetts.
Let’s add more context so it can geolocate accurately.
Click on the Analysis tab and click Add Analysis.
There are many options for advanced spatial analysis and visualization but we just want to choose the Georeference option on the top right.
- Your workflow
Input in Georeference is already filled out with source: snowfall. Because that’s the data set you’re using.
Type currently is
Longitude and Latitude.
Click into the pulldown of Type and select
Now, go into Parameters and select the
town column in CITY.
And then check the box next to Admin. Region and type in
Massachusetts and then select it when it appears in the pull down menu. It will now appear as
"Massachusetts" next to Admin.
Do the same thing for Country..
Check the box next to Country and type in
United States and then select it when it appears in the pull down menu. It will now appear as
"United States" next to Country.
Click Apply at the bottom.
You’ll get a notice that your georeferences were updated.
Only two cities were unsuccessfully geolocated to Massachusetts.
If you look through the data, you’ll see it’s because their names are mispelled (Milbury versus Millbury or are a hamlet instead of an actual town).
We’ll move on for now.
Styling the map
Click on the STYLE tab.
We want to use 1) Aggregation.
Select the circles option.
You can change the size of the circles by clicking next to fill.
Select BY VALUE and choose the
This is so we change the size of the circle based on the number of inches in the
You can also change the hue of the color based on value.
Click next to the number and select the gradient.
Choose BY VALUE again and choose the
Then you can choose what colors you’d like to use.
Want labels to appear on the map?
Let’s put in the snow fall values on the map.
Check the box next to LABELS and choose the column
Pop-ups and hover
Want information to show up when you hover or click on a circle?
Click on Pop-Up near the top.
Select the style and check the columns you want to appear.
You can customize it further by clicking the toggle at the bottom between values and HTML.
Here, you can see the code behind the interactive.
You can add more code and text here.
For example, I can add the word “inches” after the snow value so it’s clear in the pop ups.
Ready to publish?
Click on the settings icon under the pencil icon.
You can uncheck options if you don’t want to let people zoom or search.
Click the Share button when you’re ready.
Now, you need to click Publish at the top left.
Now you can get the embed code or a link to the map to share with others.