I'm new to GIS (and QGIS in particular). I'm trying to create a raster layer that contains the distance to shoreline for a certain region.

I have both vector layers of the shoreline (line) and the region in question (polygon).

Is there a tool to create the raster using the line as the object to measure the distance and the polygon as a mask?

2 Answers 2


If I understand your problem, you can create a raster distance layer and clip that output to your region polygon.

  • Create a raster distance layer using the Raster > Analysis > Proximity (Raster Distance) tool in QGIS (some more info here) -- Using your shoreline layer as the input, this will create a raster where each cell has a value of its distance to the shoreline - you can set a max. distance if you want to cut off the analysis

  • Then, use the Raster > Analysis > Clipper tool -- This will allow you to clip and Input file (Raster) by a mask layer (choose the region polygon)

  • The output would be your region polygon as a raster with values of the distance to the shoreline.

Is that what you're after?

  • 3
    I'm bouncing back on your comment: I'm actually trying the same analysis as narra89, using QGIS 3.10. However, I can only chose a raster layer as the input. Should I rasterize my vector layer instead? The vector layer is a line, and I need the distance of each pixels to that line.
    – Tim56
    Jan 30, 2020 at 11:30

This is asking for QGIS, but just in case anyone wants to know for ArcGIS: You can also use the Euclidean distance tool. more information available here: http://desktop.arcgis.com/en/arcmap/10.3/tools/spatial-analyst-toolbox/understanding-euclidean-distance-analysis.htm

The euclidean distance tool is also possible with a line feature. If you are only interested in the distance towards your line feature you can skip the optional Euclidean direction output raster.

Do not forget to set the output cell size. When the input source data is a feature class, the source locations are converted internally to a raster before performing the analysis. The resolution of the raster can be controlled with the Output cell size parameter or the Cell Size environment. By default, the resolution will be determined by the shorter of the width or height of the extent of input feature, in the input spatial reference, divided by 250.

Hereafter you can use a clipping tool or mask.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.