Hi @aron, if the left hand side of a contour line was higher than the line, labels would be created with desired orientation, I think. If the logic was correct, this approach could be a solution.
- Add unique ID to every contour line (Counter).
- Create points at left hand side for each contour line (e.g. OffsetCurveGenerator + Snipper).
- Drape (i.e. add z-coordinate to) the points by the contour lines (SurfaceDraper).
- Extract z-coordinate from the point, then merge it to corresponding contour line, using the unique ID as join key (CoordinateExtractor or ElevationExtractor + FeatureMerger).
- If the z-coordinate is lower than elevation of the contour line, reverse its orientation (Tester + Orientor).
Hi @takashi
I tried something on my own before I saw your reply, and would like so see if I can get it working before I try something new.
What I did was use the Neigbourfinder to pick the closest contour line and extract its height value. In the next step I plan to use this to detect if the neighbouring contour is higher or lower than the label I want to create. This transformer also produces rotation of my point, rotation of the neighbouring contour line and the angle between them.
What is causing me headaches is calculating a heading/bearing that works in all possible combinations.
Any suggestions of how I can make my sorting hat (aka testfilter) do some magic?
Below is an example where the 700 and 900 labels are facing the wrong direction, they need to be flipped. The 600 label is looking just fine.
@aron
I would try something along the lines of
- Get the nearest adjacent contour (NeighborFinder)
- Determine which side it is on (LeftRightSpatialCalculator)
- Test to see if the contour is higher on the left or lower on the right (Tester)*
- If fail test 3, flip the orientation on the contour (Orientor)
*I may have these backwards, double check to confirm which combination of sidedness and slope yields the correct label orientation