Skip to Main Content

Class-Specific Resources

Mapping Data from

In this tutorial, we’ll go through what it takes to download data from the database and prepare that data for mapping in the software QGIS. This is essentially a three-step process. First, we need to utilize website interface to filter out the dataset we want to work with and then download that dataset. The next step is to modify and expand two aspects of that data—port locations and the year of the journey. Finally, we’ll load this data into QGIS and apply a simple data visualization.


Materials Needed

Here’s what you’ll need to complete this tutorial:

STEP 1: Downloading Data from

Our first step is fairly straightforward, especially if you’re already familiar with the characteristics of the slave voyages database and the website’s basic layout. For the purpose of this tutorial, we’ll do a very basic filtering of the data based on a year range, but there are many other filters you could apply depending on your research question.

  1. Open and navigate to the Trans-Atlantic Slave Trade Database
  2. Use the first category “Year range” and set the year range to 1750 to 1808. Note that the line “Showing x to x of x entries” indicates the number of results

Slave Voyages spreadsheet

  1. At the top right of the results, click Download > Excel > Filtered results with visible columns.
  2. The download may take a minute or two. Once it has completed, find the file and give it the name sv-1750-1808, then move it to its own folder somewhere on your machine where you can easily find it. Note: each row in the spreadsheet represent one entire voyage, including the place of origin, the port where captives were taken on board, and the primary port where those captives disembarked.

STEP 2: Cleaning the Data

The data you can download from is rich, but it does not yet have all the necessary information to easily map it in software like QGIS. It only has a single column of information for locations, and that information can vary from a city name, to a country name, to a general area of ports. Normally, we would ask a program like QGIS to geocode our locations in order to map them. Geocoding is when a program takes a place name, searches for a match in its locational database, and returns latitude and longitude coordinates to plot that place as a point on the map. This process works best when you have at least city and country information, presented in separate columns.


But, as we’ve just noted, SlaveVoyages data does not come with all that information. The main reason is that this historical data, in many cases, does not easily correspond to modern day city, state, and country names. Sometimes the historical record itself is unclear. For that reason, we need to take another approach.


Thankfully, the SlaveVoyages project team has created a separate spreadsheet that lists the latitude and longitude coordinates for the most common ports in their database. It’s the “slave-voyages-ports.csv” file you opened or downloaded at the beginning of the tutorial, but in case you forgot you can access the file here.


We can use this ports spreadsheet in conjunction with the data we’ve downloaded to autofill the locational data we need. We will do this all in a spreadsheet, before we ever load it into QGIS, using a relatively simple formula called VLOOKUP. You can use either Excel or Google Sheets.


Before we use VLOOKUP, however, we’ll do a quick transformation of the Year column in our sv-1750-1808.xls spreadsheet. This will help us down the line when we want to apply a timeline animation feature. The timeline plugin in QGIS requires a full date rather than just a year, so we’ll simply add a January 1st to each year. Although this is not the precise month and day, it will make the timeline work and we’ll be able to just display the year.


To get started, open the sv-1750-1808.xls spreadsheet in either Excel or Google Sheets. Then follow these steps:


  1. Create a new column in the spreadsheet you downloaded to the right of the column "Year of arrival at port of disembarkation." Name the new column “Date.” In the second row of this column paste in the following formula: =CONCATENATE(F2,"-01-01"). Make sure that “F2” corresponds to the “Year of arrival at port of disembarkation.” If it doesn’t, change the letter to the appropriate column. When you hit enter, you should see a date appear in the format of YYYY-mm-dd. If that works, hover over the bottom right corner of that cell and double click to extend that formula to the bottom of the column. Then drag or cut/copy that column over to the far right of the sheet—having it there at the end will make things easier as we add additional columns below.

Slave Voyages spreadsheet columns

  1. Now create a new sheet in the spreadsheet by clicking the + tab at the bottom of your screen. Paste in the contents of “slave-voyages-ports.csv.” You can copy that data simply by opening the ports CSV file in Excel or Google Sheets, highlighting the entire set of columns and rows, and hitting copy. Once you have pasted this information, name the new sheet you create in your data spreadsheet “ports” (you can do so by right-clicking on the new tab and then clicking “Rename”).
  2. Create third sheet, named “1750-1808-embark”, and copy and paste the contents of the “Data” sheet into it. Following the last column in this sheet (which should be "Date"), create two new columns named “latitude” and “longitude.”

Data Tab

  1. In the first row in the “latitude” column, paste in the following formula: =VLOOKUP(D2,ports!$A$1:$E$973,5,FALSE). Make sure that “D2” corresponds to the column “Voyage itinerary imputed principal place of slave purchase (mjbyptimp) .” If it doesn’t, change the letter to the appropriate column. When you hit enter in the latitude column cell, you should see a latitude coordinate appear. If that works, hover over the bottom right corner of that cell and double click to extend that formula to the bottom of the column. (Note: Some rows will not have values returned for them [they will say "#N/A"] because the slave voyages ports spreadsheet only covers the most frequently listed ports.) What VLOOKUP just did for us is take the port name in our column D2, look for it in the ports sheet, and return the value listed in the latitude column.

Embarkment tab

  1. In the first row in the “longitude” column, paste in the following formula: =VLOOKUP(D2,ports!$A$1:$E$973,4,FALSE). It is the same formula as the previous one, with the “5” changed to a “4”. This should return the longitude value for that same location. Again, if it seems to work, hover over the bottom right corner of that cell and double click to extend that formula to the bottom of the column.

Disembarkment tab

  1. Repeat this process one more time—create a copy of the Data sheet, rename it “1750-1808-disembark”), create “latitude” and “longitude” columns at the end of the sheet, and paste in the VLOOKUP formulas. This time, you’ll have to change the column letter at the beginning of the formula to correspond to the column "Voyage itinerary imputed principal port of slave disembarkation (mjslptimp) place." It should look like this: =VLOOKUP(E2,ports!$A$1:$E$973,5,FALSE) for the latitude column and =VLOOKUP(E2,ports!$A$1:$E$973,4,FALSE) for the longitude column.
  2. Save your spreadsheet file. Now go through the two new sheets you created (excluding “ports”) and save each one as a CSV file. Your data is now ready to load into QGIS!

STEP 3: Loading the Cleaned Data into QGIS

Before we proceed to loading data into QGIS, a quick note about why we needed to create two separate CSV files rather than simply adding more columns to the original spreadsheet. A GIS program assigns a single geographical representation (a point, a line, or a polygon) to each row in a given spreadsheet. That means that we have to create a new spreadsheet for each set of points we want to show on the map. In our case, we have the locations of where captives were purchased (embark) and where they were sold (disembark). Now that we have separated those locations, loading them into QGIS is a fairly simple process.


  1. Open QGIS and create a new project. Name the project “sv-1750-1808” and save it to the folder where your other files are located.
  2. Now add in your countries basemap. It’s the “countries-1880.geojson” file you opened or downloaded at the beginning of the tutorial, but in case you forgot you can access the basemap file here. To add it, in the top menu for to Layer > Add Layer > Add Vector Layer and browse to find the file.

Add Vector Layer in menu

  1. Again from the top menu, select Layer > Add Layer > Add Delimited Text Layer. Select the CSV file you want to add.
  2. Make sure File Format is set to CSV.
  3. Under Geometry Definition, make sure “Point coordinates” is selected and set the X field to your longitude column and the Y field to your latitude column.

Point Coordinates selected

  1. Select Add and then Close. Your data should be on the map.
  2. Repeat this process for your other two CSV files and you’ll see the embark and disembark data together.


STEP 4: Styling Data with Graduated Symbols

Seeing clusters of points on a map can be useful, but when we get a larger number of points that overlap and that spread over large geographic areas, it can be helpful to have other ways of representing those locations. More than that, there may be additional data attributes for those points—in our case, the number of captives that arrived at the first port, as a proxy for the overall size of that particular voyage—that would be meaningful to show.


One approach to show that additional data is through graduated symbols. Basically, what this does is take the particular column of data you want to focus on, calculate an appropriate set of number ranges, sort your points into those ranges, and then represent each range with a set size of circle symbol. In action, this means that your points on the map will be resized in proportion to the number of captives transported to that particular stop.


  1. Find one of your new data layers in the left hand “Layers” pane. Double click on the layer name and select "Symbology”.

Symbology menu

  1. At the very top of that window, click the dropdown menu and select Graduated.
  2. Now select the “Column” dropdown and select the column “Slaves arrived at 1st port.”
  3. A few rows down, change the Method selector from “Color” to “Size.”
  4. Move down below the large “Classes” field and set Mode to "Equal Interval."
  5. Now hit the “Classify” button. You should see your data classified into a series of value ranges, each corresponding to a particular size of symbol.
  6. Click Apply and Ok. You should see your data visualized on the map with different sized circles.
  7. Repeat this process for your other two data layers and you’ll see all three visualized with graduated symbols.

Data visualized on map

You’ll note that many of your points are still overlapping, so in a sort of bullseye formation. This is due to the fact that ports received multiple stops, and because each of those stops is represented by exactly the same lat-long, and because we are visualizing data over a range of years. There are a few ways of dealing with this issue that will go over the next tutorial. For now, you can zoom in to particular locations (i.e. the Caribbean) to see the difference between sites.

Be sure to save your project and take a screenshot to upload on Canvas. If you would like to save your map as an image, in the top menu select Project > Import/Export > Export map to image.