I would like to combine existing text to the point attribute (z-coord). In the picture there is point and line string to point to it. In the other end of the line, there is a text object. All object are separate ones. Only the each object coordinates gives the hint, which text belongs to which point. Anyway Happy New Year from Finland despite the latest ice hockey result.
Is the connecting line always pointing in the same direction, from point to text? ie x1/y1 is always at the point feature and x2/y2 is always at the text end? I think it will help if that is true.
At least the game-winning goalscorer is with the Vancouver Canucks, I think. I look forward to him scoring many more goals at that venue!
I think the NeighborFinder will be of help here.
Use the points as base and the texts as candidate and find the closest text to each point.
Thx for your replies. Connecting line ( or multiple lines) are not in the same direction. Following the line path is the only way to find the right text for the point, because the text is not the nearest one to the point. There can be dozens other texts in the point proximity. Question about the Python interface: is there a ready made fast function which returns reference list to all objects inside a one small square?
Thx for your replies. Connecting line ( or multiple lines) are not in the same direction. Following the line path is the only way to find the right text for the point, because the text is not the nearest one to the point. There can be dozens other texts in the point proximity. Question about the Python interface: is there a ready made fast function which returns reference list to all objects inside a one small square?
The NeighborFinder transformer will return a list of objects within X distance, if that helps. And something like the PointOnAreaOverlayer will return a list of items within a small square. They would probably both be supported in FME Objects Python.
But I'll try and think of a way to handle this with transformers. I think there must be a way, I just wasn't sure if we could rely on line direction. The quick answer will be NeighborFinder to find the closest line to each point, then take the other end of that line and use the NeighborFinder again to find the closest text. But how that hangs together in a workspace I'm not quite sure yet.
If anyone wants to give it a try, here's a template containing a sample source dataset that you can use. Here the label is closest to each point, but in OP's scenario, this might not necessarily be true. We have to somehow follow the line from point to label...
OK, this was actually easier than I expected. It needs two NeighborFinders, but the twist is that you use the Line feature as the Base. So for each line you look up the ID numbers of the nearest point and the nearest text/label. Then merge that information onto the point feature (using a FeatureMerger) and now each point feature has the ID of its matching label.
At that point you can do a join or aggregation on point to label whichever way you want.
Here's a workspace that shows the technique.
Download: linetolabel2.fmwt
For some reason I have two unmatched features, but I think there must be something odd in my data, rather than the technique. Anyway, give it a try and let us know how it goes.