I have points on a QGIS map, and want to determine the distance between each of the points in Rstudio. Each Unique ID is a tree. The coordinates are UTM coordinates (x = East, y = North)

My dataset looks like this:

Unique_ID EW_X EW_Y
45 573500 775011
49 572224 774700
70 573573 775200
71 573573 775200

What formula would I use so I can get an output that describes the distance between each tree, looking like this (where x is the distance between each tree):

Unique_ID 45 49 70 71
45 x x x
49 x x x
70 x x x
71 x x x

Or perhaps if it is more simple, repeated rows (e.g. 45 against 49, 45 against 70, 45 against 71; and etc. with each repetition being a new row).

  • $\begingroup$ Are you looking for help with the mathematical formula to calculate the distance between UTM coordinates or with how to code this in R? $\endgroup$
    – Oxbowerce
    Commented Aug 6, 2021 at 13:50
  • $\begingroup$ How to code this in R - if I've published this question on the wrong Stackexchange website my apologies! $\endgroup$ Commented Aug 6, 2021 at 20:06


Your Answer

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

Browse other questions tagged or ask your own question.