Question

Creating arcs using 2DArcReplacer getting unexpected results


Badge

Hi all,

I'm trying to parse a cadastral xml file containing lists of points and parcels (containing line sub-lists) in order to reconstruct them into ESRI GDB feature classes. I have been able to create polygons easily when I'm just writing the points to lines, but when I try to create arcs, I not only get snapping issues, but the arcs sometimes appear on the wrong side of the central point.

From the xml I get the center x,y, start/from x,y, end/to x,y and the radius of the arcs. I'm trying to calculate the start, end and sweep angles from this in order to put into 2DArcReplacer and I think that's where I might be going wrong. I can't seem to get the CW / CCW values right here.

Also, when I create the polygon output, the snapping distance has to be lowered, as creating the arcs using 2DArcReplacer seems to change the start / end coords enough so that they don't snap.

I'm attaching both my workbench and sample dataset in case anyone can help.

Thank you in anticipation,


3 replies

Userlevel 3
Badge +17

Hi @katrinaopperman, it seems that positive radius indicates CW and negative radius indicates CCW. If so, these math expressions compute your desired arc properties.

angSweep (1) Calculate sweep angle from "from" to "to" in CCW.

angSweep (2) If the radius is positive, modify the sweep angle into CW orientation.

Userlevel 3
Badge +17

Hi @katrinaopperman, it seems that positive radius indicates CW and negative radius indicates CCW. If so, these math expressions compute your desired arc properties.

0684Q00000ArKpaQAF.png

angSweep (1) Calculate sweep angle from "from" to "to" in CCW.

0684Q00000ArLPrQAN.png

angSweep (2) If the radius is positive, modify the sweep angle into CW orientation.

0684Q00000ArL9ZQAV.png

In terms of accuracy on the from/to coordinates, this Python script might be better than creating arcs based on start/sweep angles.

 

# PythonCaller Script Example
# Create arc from from/to coordinates, radius and orientation (CW/CCW).
from fmeobjects import FMEPoint, FMEArc
def createArc(feature):
    x0 = float(feature.getAttribute('fromPointX'))
    y0 = float(feature.getAttribute('fromPointY'))
    x1 = float(feature.getAttribute('toPointX'))
    y1 = float(feature.getAttribute('toPointY'))
    r = float(feature.getAttribute('radius'))
    arc = FMEArc((FMEPoint(x0, y0), FMEPoint(x1, y1)), abs(r), r < 0)
    feature.setGeometry(arc)


 

Badge

Mr @takashi, you are a legend! Thank you so much for your help - both methods worked, but the Python is definitely the winner in terms of accuracy.

I used one of your previous answers to base my workbench off of, so your contributions to the community have really helped me solve this issue. Thank you.

Reply