Hi @jelle,
If you wanted to connect the points from every rectangle to create the blue line in this image then I believe the LineBuilder is the transformer you should use, rather than the ShortestPathFinder since without a line network to follow this will not pass through all the points. A line builder will connect the points in the order they enter so if the centre points from the polygons are not already in the correct order then you can use the Sorter transformer - providing they have a unique ID attribute that is ascending/descending.
Hi @jelle, since the PointOnLineOverlayer will transfer the measure value at the intersection on the line to each intersected point, the following procedure could be a solution.
- Save the original polygon geometry as an attribute with the GeometryExtractor.
- Transform the polygons to their center point and send them to the Point port of the PointOnLineOverlayer.
- Send the line to a MeasureGenerator, and then to the Line port of the PointOnLineOverlayer.
- Set an appropriate value to the Point Tolerance parameter in the PointOnLIneOverlayer.
- Use the MeasureExtractor to extract measure from the resulting points output from the Point port of the POintOnLineOverlayer.
- Sort the resulting points by the measure value.
- Apply the GeometryReplacer to the points, in order to restore the original polygons.
Hi,
If you convert all polygons to points then "NeighborFinder" will provide the distance between point A (Base) to all points (candidate)
you can further use sorter based on distance, to identify the order of existence
Pratap
Hi,
If you convert all polygons to points then "NeighborFinder" will provide the distance between point A (Base) to all points (candidate)
you can further use sorter based on distance, to identify the order of existence
Pratap
Hi Pratap, thanks for the suggestion, but as you can see, the line is reversing direction at some point, so I cannot just use the distance to Point (Polygon) A
Hi @jelle, since the PointOnLineOverlayer will transfer the measure value at the intersection on the line to each intersected point, the following procedure could be a solution.
- Save the original polygon geometry as an attribute with the GeometryExtractor.
- Transform the polygons to their center point and send them to the Point port of the PointOnLineOverlayer.
- Send the line to a MeasureGenerator, and then to the Line port of the PointOnLineOverlayer.
- Set an appropriate value to the Point Tolerance parameter in the PointOnLIneOverlayer.
- Use the MeasureExtractor to extract measure from the resulting points output from the Point port of the POintOnLineOverlayer.
- Sort the resulting points by the measure value.
- Apply the GeometryReplacer to the points, in order to restore the original polygons.
Hi Takashi, after 12 years of FME, I still discover new transformers. I had never heard of the MeasureGenerator. I'll give it a try. Thank you for the suggestion.
BTW @safe: great, these tolerance parameters!
Hi Pratap, thanks for the suggestion, but as you can see, the line is reversing direction at some point, so I cannot just use the distance to Point (Polygon) A
Hi @jelle,
Try the same logic from both ends (start and end) and merge the results.
Something like 50%-50%
Hope this helps
Other option:
1. Send the line to MeasureGenerator
2. Save the polygon geometry
3. Use a Clipper to clip the line with polygons (keep inside features), merge clipper attribute to have the geometry
4. Use a Snipper (50%-50%) to have the middle point of the inside segments with a measure
5. Use a MeasureExtractor to get the distance
And optionnaly:
6. Restore the geometry and sort
or
6. Build a list and sort
Sample workspace attached.