Automatic Digitizing of Imagery Using QGIS

Jeff Oppong

Updated:

QGIS, an open-source Geographic Information System (GIS), is constantly evolving with a plethora of plugins that expand its capabilities. Among these, specialized and customized plugins such as Mapflow have been developed, advancing QGIS’s automatic digitizing process.

Mapflow is a QGIS plugin designed to meet the complex demands of autonomous digitization. This plugin provides a sophisticated set of tools and features designed to speed up the conversion of raster data into exact vector geometries. While QGIS has tools for digitization and raster-to-vector conversion, Mapflow distinguishes itself by adding additional automation and customization possibilities.

Automatic digitizing, at its core, is the conversion of raster-based information, such as satellite images or scanned maps, into vectorized representations such as points, lines, and polygons. This conversion process is critical in a variety of industries, including cartography, urban planning, and environmental studies. Mapflow allows users to speed up and optimize digitization of features from aerials, minimizing manual labor while retaining accuracy and reliability.

Mapflow has a personalized approach to automation. To efficiently read raster data, the plugin uses algorithms and intelligent pattern recognition techniques. Mapflow identifies and generates vector geometries by analyzing image values, edge recognition, and feature extraction, reducing the need for lengthy manual input. Furthermore, Mapflow incorporates validation and refining functions in addition to automated operations. Users can inspect and change the produced vectors within QGIS after digitization to ensure precision and completeness. This iterative technique, which combines automation with manual intervention when needed, increases the dependability of the digitized output.

This tutorial uses geospatial techniques to outline how to add OpenStreetMap data as a base map and automatically digitize topographic features like roads, agricultural fields, and buildings. 

A black and white flow map showing the data and tool inputs for automatically digitizing aerials in QGIS.
Figure 1: Flow of method showing a summary of the geospatial approach used in automatic digitizing of open street map in QGIS.

Creating a new project and adding the OpenStreet map tiles

QGIS is an open-source mapping software that can be freely accessed. QGIS is available for Windows, MacOS, Linux, and BSD operating systems.

  1. Select Project from the menubar. 
  2. Select New to create a new project. 
  3. Use the Save command to save the project. Define project’s name and location. 
Screenshot showing an empty project window in QGIS.
Figure 2: Creating and saving a project in QGIS.

To add OpenStreetMap as a base layer in QGIS:

  1. Ensure that the Browser panel is enabled by right-clicking any aspect of the icon toolbars. 
  2. Check the Browser panel.
Screenshot showing how to find the Browser Panel in QGIS.
Figure 3: Enabling the Brower panel in QGIS.
  1. Once enabled, right-click on “XYZ tiles” from the Browser panel and select “New connection.” 
  2. Set Name to “OpenStreet Map.
  3. Set URL to https://a.tile.openstreetmap.org/{z}/{x}/{y}.png.
  4. Click Ok. 

For more information on how to add basemaps (Google maps, Google satellite, Google satellite hybrid, and global terrain) as tiles, reference this resource: How to add a Google Map/Terrain/Satellite Layer in QGIS 3.

Screenshot showing the XYZ tiles interface in QGIS.
Figure 4: Creating a new XYZ tiles connection in QGIS.
  1. Ensure that “Browser 2” toolbox is enabled by right-clicking on the menubar and checking the Browser 2 box. 
  2. From the Browser 2 window, double-click XYZ tiles and add Openstreet map to the map canvas. 

Adding the Mapflow plugin into QGIS. 

The Mapflow plugin enables QGIS users to extract buildings, fields, roads, and forests with heights from high-resolution imagery using AI models. This auto-digitization feature from high-resolution imagery saves tons of time. To retrieved the Mapflow plugin, visit the Mapflow — QGIS Python Plugins Repository. To import the plugin into QGIS for use:

  1. Select “Manage and Install Plugins” from the plugins tab on the menu bar. 
  2. From the plugins window, select “Install from Zip.”
  3. Click the three dots by the Zip file search space to toggle to the location of the Mapflow plugin file. 
  4. Click Install plugin. 
Screenshot showing the interface for adding plugins to QGIS.
Figure 5: Importing the Mapflow plugin into QGIS.

Automatically digitizing roads, fields, and buildings from imagery.

To automatically digitize features in QGIS using the Mapflow plugin, define an Area of Interest (AOI) by:

  1. Select “Create Layer” from the Layer tab. 
  2. Select “New shapefile layer.” 
  3. Set File name to desired name and location of the AOI. 
  4. Set Geometry type to polygon. 
  5. Click OK. 
  6. Highlight the new created shapefile from the Layers panel by selecting.
  7. Click on the pencil-like icon from the array of icons on the Digitizing toolbox. Ensure that the Digitizing toolbox is enabled. 
  8. Toggle to the location of interest from the QGIS map canvas and define AOI. 

After the AOI has been defined, use the steps outlined to auto-digitize some topographic features in AOI:

  • Select the Mapflow plugin, which appears as a red-rainbow like icon. 
  • Click “Register at mapflow.ai.”
  • The Mapflow webpage opens. Select “Try for free” for a limited use of the plugin.
Screenshot showing the Mapflow plugin wbebsite with a stylized globe.
Figure 6: Mapflow’s website.
  1. Select Sign up. 
  2. Provide personal details and select Signup.
  3. A link is sent to the provided email address for activation and further configuration. 
  4. From the API tab, select “Reset API” to generate an API code for use in QGIS. 
  5. Copy the code and input as the login details. 
  6. Click Login. 
Screenshot showing the Mapflow login screen.
Figure 7: Mapflow login (QGIS).
  1. Set Name to desired name. 
  2. Set Area to digitized AOI. 

Alternatively, plus sign option to define an AOI according to the map’s display extent. 

  1. Set Data source to Mapbox.
  2. Define AI model as buildings. 
  3. Click Start processing. 
Screenshot showing the Mapflow interface for digitizing.
Figure 8: Mapflow interface for autodigitizing.

Keep in mind that although free credits are offered for the digitization process after sign-up, only a 25 square kilometer area can be processed at a time with the free version of Mapflow.

To auto-digitize agricultural fields, forests, roads, and construction sites, set the AI model accordingly. 

A sample of what can be automatically digitized from OpenStreetMap imagery:

A screenshot of a QGIS map project with building footprints in medium orange over a clipped aerial image.
Figure 9: Auto-digitized building footprints in QGIS using the Mapflow plugin.

More QGIS tutorials

Photo of author
About the author
Jeff Oppong
Jeff Oppong holds a BSc in Geomatic Engineering and currently a graduate student at Hohai University in China, where he's studying MSc. Harbor, Coastal, and Offshore Engineering. Jeff is a prolific researcher and a GIS/Remote sensing expert who aspires to be a change-agent and a renowned Engineer. Jeff Oppong can be contacted via email

Free weekly newsletter

Fill out your e-mail address to receive our newsletter!
Email: