Hi,
I would use the NeighborFinder and the VertexCreator.
Send the point to the Base port; send the line to the Candidate port.
Set the Maximum Distance parameter to an appropriate tolerance.
The output point from the Matched port will have "_closest_candidate_x" and "_closest_candidate_y". Those attributes store the closest coordinate on the line.
And then, use the VertexCreator (Mode: Replace with Point) to move the point to the closest coordinate.
If the distance between the point and an end node of the line is always enough larger than the tolerance, the AnchoredSnapper (Snapping Type: Segment Snapping) also do that, possibly. But I think the NeighborFinder is better to prevent unexpected end node snapping.
Takashi
Hi,
You can easily turn neighbourfinder into a "iterative neighborfinder".
All parameters except Paralell processing level can be turned to parameters (just rightclick parameter on the transformer and seclet create user parameter)
For efficiency you add a counter so it can stop when all points are found before it reaches max distance.
Main:
and the custom:
Vertextcreator , create and or add mode to make the connectionline, or to create the realtion.
An alternative could also be to use a (unconditional) merger if the datapoints have a attribute that can link them to the borehole. (and then again Vertexcreator)
addendum.
All attributes that must pass trough the customtransformer must be chosen before it is saved as a blockingtransformer. If you change this afterwards you need to go to the procedure of creating it again: edit, create new custom in main, edit and save... (i hope Safe fixes this sometime...)
Hi,
yes, you can also use the AnchoredSnapper. Just make sure to select "Segment snapping" as the snapping type (FME 2014+). Look up the help text for more info on this setting.
David
Hi all,
I have to same situation. I use the VertexCreator after the Neighborhood to determine the closest x and y candidate to the object line. (Yellow line below). The red line I have to snap to it. However, the red line (horizontal line)has only two vertexes, one at the corner and the end of the horizontal line. I used a Chopper - vertex by - and set to 1. The result is unchanged. With the Yellow line I did the same. However, the chopper give unchange results either. The tolerance is 60 cm. The real distance between the vertexes of the red line and yellow line is shorter. So I am not sure if the AnchoredSnapper is working well in my case. MAVA
@MAVA.
For lines you should use buffering etc.
You can't chopp it fine enough to hope to find the shortest distance 2 of linepieces. (that would be iterative/recursive at best)
Intersecting lines have shortest distance 0...
You want to examine the distance between the peices.
Topology, extract begin and endnode (if its a ployline, chop down to 2 vertices and keep an ID), and then use a neighbourfinder to to find distance.
Thank you,that does exactly what I wanted. Gios idea is useful to know but in this case I have a common ID to group the data by.
My original idea was to use the anchored snapper after interpolating points very closely along the line (every 0.1 m) but couldn’t get it to work.
Hi,
I would use the NeighborFinder and the VertexCreator.
Send the point to the Base port; send the line to the Candidate port.
Set the Maximum Distance parameter to an appropriate tolerance.
The output point from the Matched port will have "_closest_candidate_x" and "_closest_candidate_y". Those attributes store the closest coordinate on the line.
And then, use the VertexCreator (Mode: Replace with Point) to move the point to the closest coordinate.
If the distance between the point and an end node of the line is always enough larger than the tolerance, the AnchoredSnapper (Snapping Type: Segment Snapping) also do that, possibly. But I think the NeighborFinder is better to prevent unexpected end node snapping.
Takashi
That works perfectly. Thank you!