1

Is there a way in QGIS to extract the coordinates of the nearest point on a polygon from an input point layer? I am looking for the coordinates not the distance, as provided by NNJoin.

2

You can achieve it using the Field Calculator. Considering that the expression

(closest_point($geometry,
aggregate(
'point',
'collect',
$geometry)))

will calculate the closest point between your point layer and the polygon layer, you can use this expression in the Field Calculator to create a new field in the polygon attribute table

x(closest_point($geometry,
aggregate(
'point',
'collect',
$geometry)))
 || ', ' || 
y(closest_point($geometry,
aggregate(
'point',
'collect',
$geometry)))

where the part || ', ' || is the delimitator between the two values.

enter image description here

1
  • Awesome, much appreciated!
    – mb5572
    Jun 3 '20 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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