Skip to main content
Solved

get a given point distance


Forum|alt.badge.img

Hello,

I am interested in how to get a given point distnce with FME.

I have points arranged by counter (pontID is ascending) and I want to get the next point's distance. I tried NeighborFinder, but the problem is that sometimes an other point is closer,so it gives a wrong distance.

Thanks!

Best answer by ebygomm

Another way, if the points are in order

  • Coordinate extractor to get coordinates if they don't already exists as attributes
  • Attributecreator with adjacent feature mapping turned on look at one subsequent feature
  • Arithmetic expression to calculate distance using the coordinates of the existing feature, and the coordinates of the adjacent feature
View original
Did this help you find an answer to your question?

6 replies

david_r
Celebrity
  • March 5, 2020

Lots of different ways, but one way could be

  1. Sorter on point ID, in ascending, numerical order
  2. LineBuilder to get a line from all the points
  3. Chopper, mode = By Vertex, max vertices = 2 to split into individual line segments
  4. LengthCalculator to get segment lengths

ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • Best Answer
  • March 5, 2020

Another way, if the points are in order

  • Coordinate extractor to get coordinates if they don't already exists as attributes
  • Attributecreator with adjacent feature mapping turned on look at one subsequent feature
  • Arithmetic expression to calculate distance using the coordinates of the existing feature, and the coordinates of the adjacent feature

ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • March 5, 2020

A neighbourfinder with a group by then?


Forum|alt.badge.img
  • Author
  • March 6, 2020
david_r wrote:

Lots of different ways, but one way could be

  1. Sorter on point ID, in ascending, numerical order
  2. LineBuilder to get a line from all the points
  3. Chopper, mode = By Vertex, max vertices = 2 to split into individual line segments
  4. LengthCalculator to get segment lengths

i tried this way, but I got in trouble to match the points with the line attributes, cause the line builder gets only the first point's datas...


david_r
Celebrity
  • March 6, 2020
gylona wrote:

i tried this way, but I got in trouble to match the points with the line attributes, cause the line builder gets only the first point's datas...

Can you post a small sample dataset here? Or at least post some screenshots that details the issue?


bwn
Evangelist
Forum|alt.badge.img+26
  • Evangelist
  • March 6, 2020

Like so. Use LineBuilder to also act kind of like a Chopper by pairing the Points first by making a copy of the Points with ID incremented by +1, and then creating Line segments. The LengthCalculator will the measure the distance between the line vertices.

*EDIT* And just realised how similar this solution is to the concepts from @david_r and @ebygomm! Without meaning to, I ended up sketching a hybrid of the 2 solutions. In theory @ebygomm 's solution will be a bit more efficient, although I'm not sure whether NeighborFinder's distance is a Geographic or Cartesian calculation? I went to building Lines instead to make sure the right length for the coordinate system could be extracted. I think the Help implies it is a Cartesian distance only whereas I think the solution you wanted was a Geographic distance that accounted for surface curvature?

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings