Possible ways of selecting x/y points that are on or close to a path in R

79 Views Asked by At

I am trying to extract data from a line of points which are part of a 2D map that consists of 5,000–6,000 points. I used to be able to do this using the Point Profile Tool in ArcMap but am now looking for a way to do it in R instead, if at all possible.

In short, with the Point Profile Tool you select a start and an end point (or a polyline), which extracts the values of points that it crosses or closely passes (this closeness can be defined by a buffer value). The result is a line graph that displays the selected data along an x-axis that uses the start point as 0 and the end point as however long the line is. (do check the link above for pictures and better explanations).

Any solutions that come to mind would be very helpful. Obviously it doesn't have to have point&click functionality (although I had quick look at how Plotly does it). Just finding points that are close to a line and putting them into order would be a big step.

In my dataset each point has three values: x coordinate, y coordinate and elemental ratio.

df <-  tibble::tribble(
      ~x,    ~y,   ~ratio,
  14706, 2839, 0.381695,
  14675, 2880,   0.3673,
  14643, 2922, 0.397345,
  14612, 2963,  0.38444,
  14581, 3005, 0.348379,
  14549, 3046, 0.413543,
  14518, 3087, 0.422341,
  14487, 3129, 0.425183,
  14456, 3170,  0.41884,
  14424, 3211, 0.410218
  )
0

There are 0 best solutions below