20

Is there a way of calculating the distance to the nearest points in QGIS?

In ArcGIS Desktop there is a function called Euclidean Distance, which can take an input vector or raster, and generate a raster of distances.

enter image description here

I seek a similar function in QGIS but I could not find one in the documentation. I did explore the Raster functions in QGIS, and also the Hub Distance calculation fromMMGIS (for a non-raster solution) but I was not able to figure out how do this using either. If a vector approach is the only solution, that could be fine also.

2 Answers 2

29

First, rasterize your vector layer. You can do it using Rasterize under Raster menu.

Before rasterizing, I'd recommend to create an additional field and fill it with '1' and then select this field when rasterizing.

Second, Raster\Analysis\Proximity

Note that you should have GDALTools turned on in plugins.

0
0

To add to this, I used

Create Constant Raster Layer to make the raster with the pixel size and extent I wanted in the output (and a constant value of 1)

In the points layer I created a attribute called PixelVal with a value of 2 in all rows

Then I used Rasterize to "add" the point layer into the constant raster

Then I used Proximity (Raster Distance) to calculate the distance from pixel values of 2 (I had the distance as pixel coordinates and the output data type as Int16 (not float) to save the raster containing excessive information of distances that was not useful to me)

This all feels a bit clunky and I wonder if there's a quicker way...

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.