Creating Distance Rasters

This tutorial reviews how to create a simple (Euclidean, straight-line) distance raster using the Proximity (raster distance) tool in QGIS. The resulting raster layer contains values that indicate the distance from each raster cell to the nearest target locations from the input layer.

Included in this tutorial:

  • Accessing the Proximity (Raster Distance) tool

  • Reviewing the tool parameters

  • Running the tool and examining the results, with an example

Software version in examples: QGIS 3.34 Prinzen

Tutorial Data: The tutorial includes demonstration with sample data available here.

Credits: L. Meisterlin (2025)

Related: The Proximity (raster distance) calculation in QGIS requires a raster input. In this tutorial’s example, we are using a raster generated from vector  point feature locations. The steps to create this input layer are demonstrated in the Converting Vector Features to Rasters tutorial.

 

Accessing the Proximity (raster distance) tool

Access the Proximity (raster distance) tool by clicking through Raster > Analysis > Proximity (Raster Distance) in the main menu. 

Alternatively, you can navigate through (or search) the Processing Toolbox, wherein you will find the same tool within the GDAL tools > Raster analysis > Proximity (raster distance).

the Proximity (raster distance) tool in the Main Menu

the Proximity (raster distance) tool in the Processing Toolbox


Proximity tool Parameters

The Proximity (Raster Distance) tool generates a raster layer with values indicating the distance from each cell to the nearest “target” cell in an input raster. Thus, as we would expect, the tool’s parameters include specifying information about how to read the input layer and characteristics of the output raster.

The input characteristics include

  • Input layer: the input raster layer with “target” cells to/from which distances will be calculated.

  • Band Number: If the input layer is a multiband raster, here you will specify the relevant band. If it is a single-band raster, then its sole band will be assigned by default.

  • A list of pixel values in the source image to be considered target pixels: This optional parameter allows you to specify which cell values in the raster layer indicate a “target” location. In the example below, the input raster layer is binary (with values of zero or one), and cells with a value of 1 are considered targets by default.

The output parameters are

  • Distance units: You can choose pixel coordinates or georeferenced coordinates based on the coordinate reference system (CRS) of the input layer for the distance calculation. Reminder: Calculate distances in linear units (not angular degrees).

  • The maximum distance to be generated: This optional parameter specifies the distance from a target location beyond which distances will not be calculated.

  • Value to be applied to all pixels that are within the -maxdist of target pixels: This optional parameter allows you to assign a single value to all output raster cells within the maximum distance specified in the previous option. (This will override the default cell value which represents the distance from the output cell to the nearest target.)

  • Nodata value to use for the destination proximity raster: This optional parameter allows you to specify a value for any “no data” cells generated in the output raster layer.

  • Within the Advanced Parameters you will also find the options for the output data type to specify the value format for the output raster.

  • Lastly, at the bottom of the dialogue box you will find the options for naming and saving the output raster as well as the checkbox option to add the new raster layer to the current project. 

the Proximity (Raster Distance) dialogue box with standard parameters

the Proximity (Raster Distance) dialogue box’s Advanced Parameters


Examining Example Results

The results of the example shown in the images above are provided below (along with an image of the input raster layer). 

Output Values: Notice in our example that we maintained most of the default options such that the resulting raster layer includes values that indicate the distance from each of its cells to the nearest target cell of the input raster. The distance units are feet, because the CRS unit of the input layer (and the map canvas) is feet.

Output Resolution and Extents: Notice that the raster resolution and its overall extents are identical to the the resolution and extents of the input layer.

the example input layer of target locations

the example output raster layer with distance values

 
Next
Next

Converting Vector Features to Rasters