Select to view content in your preferred language

Create a circular arc with ArcPy

207
3
3 weeks ago
MeleKoneya
Frequent Contributor

Hello,

I am trying to create a circular arc between two points but am not able to find examples or documentation.

I'd also like my circular arcs to also have Z values so they look like an arc extending up a specified Z value.  I can create the polylines easy enough, I think, but how to create a circular arcs with the start and end points.

Here is what I am working off of now.

import arcpy
start_point = arcpy.Point(10, 10, 100 )
end_point = arcpy.Point(20, 20, 200)
arc_geometry = arcpy.Geometry()
arc_geometry.geometry = "circular arc"


point_array = arcpy.Array()
point_array.add(start_point)
point_array.add(end_point)
arc_geometry = arcpy.Polyline(point_array)

Thank you for any suggestions on how to create a circular arc given the start and end points.   

Mele 

0 Kudos
3 Replies
JoshuaBixby
MVP Esteemed Contributor

The ArcPy Geometry constructors do not support true curves of any kind.  You will need to use AsShape—ArcGIS Pro | Documentation and feed it an Esri JSON definition based on the syntax from the 'Curve objects' section of Geometry objects | ArcGIS REST APIs | ArcGIS Developers

MeleKoneya
Frequent Contributor

Thank you @JoshuaBixby  I am able to create curves with the info you sent.    The documentation is not clear at all, but you did help get me going in the right direction.   My next step is to create the curves with Z, but if I add a Z value to the curve.   

 

esri_json = {

"curvePaths": [
[
[pt1.X, pt1.Y],
{"c": [[pt2.X, pt2.Y], [midpt.X, midpt.Y]]}
]

]
,
"spatialReference" : {"wkid" : 2868}
}

Any thoughts on how to this?   I want an circular arc from pt1 to pt2 with Z and an elevation by midpoint

Thank you 

 

 

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Looking at the documentation, Geometry objects | ArcGIS REST APIs | ArcGIS Developers

An open circular arc is represented by the c property. This is defined by an end point and an interior point.

{  "c": [    [<x>, <y>, <z>, <m>],    [<interior_x>, <interior_y>]  ]}

It appears that the interior point of a circular arc cannot specify a Z or M value, only the end point can. 

The same behavior with center points and control points exists for elliptic arcs and bezier curves.