How to Create a Radial Flow Map Using QGIS

Caitlin Dempsey

Updated:

A flow map is one technique used by cartographers to show the movement, or flow, of geographic data. A type of thematic map, a flow map can show the flow of people, animals, or goods, to name a few examples. Flow maps are also used to visualize the volume and types of flow between one place and another.

Flow maps come in different forms. One common type of flow map is called the radial flow map. Radial stems from the medieval Latin word, radialis, meaning shaft or rod. On a radial flow map, lines arc out from an origin point to connect with an end point. These types of maps were popularized by airlines in order to show their routes.

What data is needed to create a radial flow map?

Radial flow maps can easily be created in QGIS with a few steps to prepare the data needed. In order to create a radial flow map, a table containing the following columns is the minimum amount of data that is needed:

  1. Origin point with X, Y coordinates stored in separate columns
  2. End point with X, Y coordinates stored in separate columns

Additional columns of data can be added such as:

Radial Map Data Example: Flow map of metro to metro migration within the United States

The U.S. Census Bureau calculates estimates of internal migration within the United States as part of its suite of American Community Survey (ACS) data. This is the flow of residents from one part of the country to another. Internal migration is measured at different levels of geography, one being the movement of people from one city area to another.





Get the U.S. Census metro migration table and GIS data

For this GIS tutorial, we will be using the Metro Area-to-Metro Area Migration Flows: 2016-2020 table which quantifies estimate in, out, and net migration for the metro areas of the United States. More specifically, we are going to create a radial flow map showing the volume of migration from other U.S. cities to Twin Falls, Idaho. The U.S. Census Bureau estimate about 4,059 people moved from other areas of the country to this metro area between 2016-2020.

From the Metro Area-to-Metro Area Migration Flows: 2016-2020 table, copy just the rows and columns for the records for “Twin Falls, ID Metro Area” and remove any metro record with zero migration. Create a new CSV file and label the columns. Here is a truncated view of the table you should have created:

EndCityStartCityEndNameStartNameTotalMigrants
4630010380Twin Falls, ID Metro AreaAguadilla-Isabela, PR Metro Area152
4630011260Twin Falls, ID Metro AreaAnchorage, AK Metro Area15
4630012020Twin Falls, ID Metro AreaAthens-Clarke County, GA Metro Area4
4630012420Twin Falls, ID Metro AreaAustin-Round Rock-GeorgeTown, TX Metro Area5
4630012540Twin Falls, ID Metro AreaBakersfield, CA Metro Area87
4630012580Twin Falls, ID Metro AreaBaltimore-Columbia-Towson, MD Metro Area1
4630013460Twin Falls, ID Metro AreaBend, OR Metro Area2
4630014260Twin Falls, ID Metro AreaBoise City, ID Metro Area565
4630014740Twin Falls, ID Metro AreaBremerton-Silverdale-Port Orchard, WA Metro Area2

From Data.gov access the GIS data filed called tl_2020_us_cbsa that contains polygons of the metro areas in the United States (the U.S. Census Bureau’s Core Based Statistical Areas (CBSAs) is a combination of the agency’s Metropolitan and Micropolitan Statistical Areas). Within this file is an attribute called “GEOID” that contains the five-digit metro code for each area that corresponds to the start and end metro areas in the table above.

Transform the metro area GIS data

The first step in this GIS tutorial is to create the GIS data that contains the start and end points that anchor reach radial line along with the attribute values that will be used to symbolized the volume of migration from U.S. cities to Twin Falls, Idaho.

Start up a new QGIS session and add the tl_2020_us_cbsa shapefile to the map panel. Either locate the shapefile where you saved it on your computer or open up the file directory and drag and drop the .shp file into your QGIS session.

A map view with brown polygons of Core Based Statistical Areas (CBSAs) .
U.S Census Bureau’s Core Based Statistical Areas (CBSAs) polygon GIS data.

Calculate centroids from the metro area polygons

The Core Based Statistical Areas (CBSAs) for metropolitan and micropolitan areas in the United States are represented as polygons. In order to create great circles, we need to connect the arcs using two end points. For this tutorial, we will be using the center of each metro area as endpoints.

From the top menu on QGIS, select Vector –> Geometries –> Centroids…

A screenshot showing how to find the Centroids tool in QGIS>
The Centroids tool in QGIS creates a point layer calculated from the extent of polygons.

From the Centroids interface, make sure you have the tl_2020_us_cbsa shapefile selected. The default is to save this calculation as a temporary layer. Click on the ellipsoid (…) next to the grayed out [Create temporary layer] and then navigate to the folder where you want the new shapefile to be written to and create a name for the layer. Click save.

A screenshot showing the save centroid layer interface in QGIS.
Designate the location of the new centroid layer in QGIS.

Click the Run button in the Vector Geometry – Centroids window. (Note: after saving the output file, the window may move behind the map view.) Once the process completes, close the window. The new centroid layer will appear in the map view

Join metro migration data to geographic centroids

Next it’s time to join the CSV file containing the metro migration data to the geographic centroids.

Drag and drop the CSV file into your QGIS layers panel.

Layers panel in QGIS showing the added CSV file.
Layers panel showing the added CSV file.

Then right-click on the metro centroids layer and select properties, which is the last item on the menu. From the properties interface, select the Join option and then click on the green plus icon.

Screenshot showing the join option in QGIS.
You can create relational joins in QGIS through the Join tool found under the layer properties option.

In the Add Vector Join interface, select the CSV file as the join layer. For the join field, select the column containing the values for the metro code from the CSV file. For the target field, select the GEOID column which contains the matching metro codes from the centroids layer.

Screenshot showing selected field options for joining a CSV file to a point layer in QGIS.
Parameters for join the migration values from the metro CSV file to the metro centroids layer in QGIS.

Click the OK button to close the Add Vector Join interface. Then click the OK button in the Layer properties interface to complete the join process.

Next, right-click on the centroids layer and select Open Attribute Table. Verify that the join was successful by making sure the fields from the CSV file were appended to the centroids point layer. The StartCity column was joined to the GEOID column in the centroid layer and the four additional columns from the CSV file have been added to the attribute table.

Screenshot showing attributes from a point layer that has appended attributes from a CSV file that was joined to it.
After a relational join, the additional attributes from the CSV file are appended to the centroid layer.

Adding geographic coordinates to the centroids layers

The final step in preparing the data for generating radial flow lines is to add geographic coordinates to the attribute table. The starting coordinates represent the location of the metro area where the migrants originated. The ending coordinates are the same for all records, which is the location of Twin Falls, Idaho.

To add the X,Y coordinates for each start location, add the Processing Toolbox from the View –> Panels menu option. Then in the Processing Toolbox search bar, type in “xy” and then double-click on “Add X/Y fields to layer” from the results.

QGIS has a tool for adding X,Y coordinate attributes to any vector file.
QGIS has a tool for adding X,Y coordinate attributes to any vector file.

In the Vector Table – Add X/Y Fields to Layer window, select the centroids as the input layer, select the coordinate system you want to apply, and designate a new shapefile name and location. Next click the Run button.

Tool for adding X and Y coordinates to the attributes of a point Laye win QGIS.
Tool for adding X and Y coordinates to the attributes of a point layer in QGIS.

When the process has finished running, click on the Close button. Now if you look at the attribute information for your centroid file, each record has attributes with two additional fields containing X and Y coordinate values.

These coordinate values are the starting points for each radial line. We need a second set of X and Y coordinates added to each record for the end point, which is the location Twin Falls.

To do this, open up the attributes for the new metro shapefile and search for the Twin Falls Metro Area record. Right click on the X coordinate and copy the value.

X and Y coordinate values for Twin Falls in Idaho.
X and Y coordinate values for Twin Falls in Idaho.

Next click on the Open Field Calculator button which looks like an icon of an abacus.

Open Field Calculator tool in QGIS.
Open Field Calculator tool in QGIS.

The next step is to calculator the X coordinate value for Twin Falls, Idaho for each record in the metro centroid layer.

Make sure the Create a new field box option is checked. Then give the new field a name such as “Xend”. Change the Field Type to Decimal Number and adjust the Output field length (to 20) and Precision (to 10).

In the Expression window, type in a single quote (‘) and then paste in the value you copied and close it with another single quote. Click on the OK button to run the calculation and click the Save Edits icon.

Field calculator in QGIS.
Field calculator in QGIS.

Repeat the process to add the Y coordinates to a new field called Yend by copying and pasting the Y coordinate value from the Twin Falls record and running the field calculator. Click the Save Edits icon again. Click the pencil icon to turn off editing mode for the attribute field.

You can verify that the values were correctly added by browsing through the attribute records. Each record should now have a set of starting coordinates for each specific metro area and ending coordinates matching the coordinates for Twin Falls.

Start and end XY coordinates in QGIS.
Start and end XY coordinates in QGIS.

Filter for only records with migrants

Not all metro areas in the United States had residents that moved to Twin Falls, Idaho. Of the 939 metro areas, only 64 had someone migrate to Twin Falls. We want to filter our metro centroids layer to only show centroids that had at least one person move to Twin Falls.

Right click on the centroid layer and select Filter from the menu. Next, filter out all locations where the field value for the number of migrants is 1 or greater. In the example below, the expression to use would be: “twin-fal_3” >= ‘1’.

Screenshot of the Query Builder in QGIS and before and after maps of filtered points in a deep red color.
Use the query builder to filter out all locations with no residents who moved to Twin Falls, Idaho. The second map of red points is only those metro centroids with at least one resident who moved to Twin Falls.

XY to Line

To create a vector layer with lines connecting the metro areas with migrants to the single location of Twin Falls, you will need to add the QGIS plugin Shape Tools. From the top menu item select Plugins –> Manage and Install Plugins…

From the Plugins interface, search under All for Shape Tools. Click on the search result for Shape Tools and then click the Install button. The menu for Shape Tools can then be accessed from the Vector menu.

To create the great circles, go to Vector –> Shape Tools –> XY to line.

XY to Line tool in QGIS.
XY to Line tool in QGIS.

In the Vector Geometry – XY to Line window set the parameters: choose the point layer, select the projection for input and out layers, and select the fields for the starting and end points. For Line Type select Great Circle to generate lines with an arc.

The default is to create a temporary layer so select a location and name of the output line file. Since the input centroids doesn’t have the location of Twin Falls, check the Show ending point box. This will generate a single point for Twin Falls.

XY to line window in QGIS.
XY to line window in QGIS.

Click Run. Next click Close once the calculations have run.

Radial flow map: Migration to Twin Falls From Other U.S. Cities

The final step is the symbolize the radial line by line thickness and/or color in order to visually represent migration patterns. Add underlying base layers for context. Click on the map below for a larger PDF version.

Mapping Migration to Twin Falls From Other U.S. Citie, 2016-2020.  Data: U.S. Census Bureau, Natural Earth.  Map: Caitlin Dempsey.
Mapping Migration to Twin Falls From Other U.S. Cities, 2016-2020. Data: U.S. Census Bureau, Natural Earth. Click on the map for a PDF version. Map: Caitlin Dempsey.

More QGIS tutorials

Photo of author
About the author
Caitlin Dempsey
Caitlin Dempsey is the editor of Geography Realm and holds a master's degree in Geography from UCLA as well as a Master of Library and Information Science (MLIS) from SJSU.