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?