2

I am trying to calculate the distance of around 90 points from the closest edge of a polygon. I a currently using QGIS Version 3.22.8.

I have reviewed previous answers at this link that fits my requirements [https://gis.stackexchange.com/questions/427508/calculate-distance-in-miles-from-point-to-polygon-edge-in-qgis]

I found the following a approach through entry into the field calculator suitable for my requirements but I continue to get a null result:

distance($geometry, array_first(overlay_nearest(layer:='Lines', expression:=$geometry)))

The ESPG for both layers is 28356.

I did not need to convert to miles and therefore no need to multiply by 0.000621371192.

Interestingly the preview result at the bottom of the field calculator window appears to give an accurate result.

Is there an explanation for this?

1 Answer 1

3

You have to set the output field type to : Decimal number (real)

enter image description here

Otherwise, you'll get 0 or 1 as a result.

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.