QGIS Plugin: Desire Lines
Facilitating the creation of flow maps for Transportation Engineering.
The Problem
In geoprocessing classes for the Transportation Engineering course, there was a major difficulty in using GIS software, as QGIS is not exclusive to the transport sector. Some existing flow tools simply did not work or required old versions of the software.
For a period, I taught the creation of flow maps using SQL programming directly in QGIS. However, being a 3rd-semester course, students faced a steep technical barrier. Since not everyone masters coding, even colleagues and professionals in the field ended up asking for help to solve this common analytical problem (there are even videos on the SQL approach on the channel of my academic project, Mobiliza CEFETMG).
The Solution
Faced with the difficulties of applying the flow map concept in QGIS in a native and accessible way, I decided to develop a dedicated tool. The project became functional on September 28, 2024, and was initially distributed manually via a .ZIP file for installation.
The Desire Lines plugin was created to automate and democratize the generation of desire maps (straight lines connecting origins to destinations). This type of visualization is an essential step for traffic engineering, urban mobility analysis, and strategic planning of public transport networks.
The development was accompanied by publications on Medium to document the process and assist the community:
- September 16, 2024: Publication of the first article introducing the topic: Do you know what an O-D Matrix is? (Portuguese)
- September 26, 2024: The project became fully functional, marked by the publication detailing its use: Flow Map in QGIS with DesireLines (Portuguese). Initially, distribution was done manually via .ZIP.
- May 21, 2026: The plugin was officially approved and included in the official QGIS repository, facilitating direct installation through the software.
- June 2026: Version 0.2.0, with All-or-Nothing (AoN) flow allocation over a network built by Delaunay triangulation of the zone centroids. Details in the post Desire Lines 0.2.0: AoN allocation on Delaunay networks.
- July 2026: Version 0.3.2, with the interface translated into Portuguese and compatibility with QGIS 4.x (Qt6), keeping QGIS 3.x support in the same package.
- September 2026: Versions 0.4.0 and 0.5.0, with highway traffic assignment over the official road network (DNIT/SNV and state DERs) downloaded through the GisBR plugin. Per-direction capacity is computed with HCM (6th edition) procedures, and the assignment can be All-or-Nothing or equilibrium (MSA with a BPR function). In 0.5.0 the tool moved to a dockable panel.
Technologies Used
- Python for the core logic development.
- PyQGIS (QGIS API) for GUI integration and processing of spatial features.
- Analytical Methodology based on Transportation Engineering concepts (Origin-Destination Matrices).
- HCM methodology (Highway Capacity Manual, 6th edition) to compute per-direction capacity on two-lane (ch. 15) and multilane (ch. 12) highways, the basis of the highway assignment.
Next Steps
The development of the plugin is ongoing. The next mapped improvements are:
- 1. Create integrated visual style: Allow users to apply and configure the visual style of the lines (colors, thickness based on demand) directly through the plugin's user interface.
- 2. Traffic loading filter: Develop a feature to automatically filter and highlight only the routes with the highest traffic volumes, making it easier to read dense maps.