Question

Point Attribute copied Over to Line Attribute, closest point to beginning of line

  • 10 December 2019
  • 6 replies
  • 1 view

I'm looking for a workflow suggestion or a transformer suggestion. I'm a light user of FME and I have Drill Traces, 3D Polyline files, that are missing their DrillHole ID. I have a DrillHole point file with the correct HoleID in it. The DrillHoles are typically within 0.02m of the beginning of the drill trace. I'm looking for a way to populate an Attribute added to the Drill Trace file to add the Hole ID to it. Both files are Shapefiles. I have attached a screen shot showing the Drill Hole and the Drill trace. I have about 7000 of these I need to match so doing it manually is not an option. Is there a proximity transformer or something that will pull the Hole ID into an attribute into the Drill Trace file from from the Hole point file that is closest to the beginning of the trace? Thank you!

 


6 replies

Badge

The NeighborFinder will do this for you. To be sure that it doesn't catch the wrong line you could either trim down the length of the line or use a CoordinateExtractor and a VertexCreator to create a new point on the beginning of the line. That point will inherit the attributes from the line and they can then be transfered to the DrillHole point with the NeighborFinder.

Badge +3

Similar methodology as danullen's, the only variation is that can use a single Snipper transfomer (in Vertex Mode with the FromVertex Index=0 ad the ToVertex index=0) to get the Drill Line end points rather than a CoordinateExtractor+VertexCreator combination, but in my performance testing they both execute in about the same time so in outcome basically identical.

You can also make the points and lines obey an explicit spatial relationship by first snapping the Points to the Ends of the Lines using AnchoredSnapper in End Point mode.

Then SpatialRelator can pull the Drill Point ID across to the Lines: Lines as the Requestor and the Points as the Supplier with Predicates of where Requestor Touches Supplier (A line "touches" if it is the end point only that intersects the shape it is being tested against). It is more expensive to execute, but if you wanted to use further Transformers beyond your immediate problem where later in the Workspace it becomes more convenient if the underlying geometries are snapped together and intersect precisely on the line end points, then this can work well too.

Similar methodology as danullen's, the only variation is that can use a single Snipper transfomer (in Vertex Mode with the FromVertex Index=0 ad the ToVertex index=0) to get the Drill Line end points rather than a CoordinateExtractor+VertexCreator combination, but in my performance testing they both execute in about the same time so in outcome basically identical.

You can also make the points and lines obey an explicit spatial relationship by first snapping the Points to the Ends of the Lines using AnchoredSnapper in End Point mode.

Then SpatialRelator can pull the Drill Point ID across to the Lines: Lines as the Requestor and the Points as the Supplier with Predicates of where Requestor Touches Supplier (A line "touches" if it is the end point only that intersects the shape it is being tested against). It is more expensive to execute, but if you wanted to use further Transformers beyond your immediate problem where later in the Workspace it becomes more convenient if the underlying geometries are snapped together and intersect precisely on the line end points, then this can work well too.

Thank you for the reply and advice. I think this is more what I'm looking for as, when I ran the other method, I was getting some traces picking up the same hole ID. HoleID should be unique for each trace. I will give this a shot.

The NeighborFinder will do this for you. To be sure that it doesn't catch the wrong line you could either trim down the length of the line or use a CoordinateExtractor and a VertexCreator to create a new point on the beginning of the line. That point will inherit the attributes from the line and they can then be transfered to the DrillHole point with the NeighborFinder.

Thank you for your reposne. This works for me, albeit it needs some tweaking to ensure each trace gets a unique HoleID, this has been a good start for me. I will try what BWN said above and see if that helps. Appreciate the response!

Userlevel 2
Badge +12

Another option would be:

Store the line geometry in an attribute (GeometryExtractor).

Replace the line by its starting point (VertexCreator).

Find the closest point to the start points (NeighborFinder).

Replace the starting points (That now contain the attribute from the Drill) by the stored line (GeometryReplacer).

Hope this helps.

Another option would be:

Store the line geometry in an attribute (GeometryExtractor).

Replace the line by its starting point (VertexCreator).

Find the closest point to the start points (NeighborFinder).

Replace the starting points (That now contain the attribute from the Drill) by the stored line (GeometryReplacer).

Hope this helps.

Thank you! I will try this failing the other methods. I think this would be a better option than shortening the line and would ensure Unique value for each trace.

Reply