# how to: constructing polygon boundary with circular arc segments

2540
8
07-29-2016 12:29 AM
New Contributor III

dear group members

I know how to construct polygons with linear boundary segments.

So here is a short python expample:

array = arcpy.Array()

coordinates=['some data']

for coordinate in coordinates:

polygon = arcpy.Polygon(array)

please, is there some advice on how to construct a polygon boundary with circular arc segments alternating with linear segments using python & arcpy?

thank you

Tags (1)
8 Replies
MVP Esteemed Contributor

no mention of python here Changing a segment into a straight line, a circular arc, or a Bézier curve—Help | ArcGIS for Desktop

nor is there an arc geometry objec Geometry—Help | ArcGIS for Desktop

perhaps if you could elaborate on what you are trying to do, then a solution might be at hand.  Circular arcs can be replaced by densified line segments and would suit most situations unless you are trying to replace CAD functionality

New Contributor III

I am searching for a technique for importing geographic data form ASCII files. In those data sets, circular arcs are described by three points on the arc.

MVP Esteemed Contributor

I am familiar with how circular arcs, I am just saying there is no built in way to generate an arc using builtin python for use in ArcMap. If you examine the arcpy interface you will see there is no arc class... you can connect the dots at worst or generate a multisegmented polyline, but if you intent is to generate a true arc, then you should look at arcobjects

New Contributor III

Dan, thank you again.

Esri Esteemed Contributor

Dan is right, no objects in arcpy to construct these. There is a possible solution provided here: arcgis - drawing a circular arc using arcpy - Stack Overflow . It uses arcpy.XYToLine_management: XY To Line—Help | ArcGIS for Desktop

Esri Regular Contributor

Ah the old arc-through-three-points problem.

In the attached is a script that has the math, you'll need to figure out how to clip the part of the circle you want.

Regards

MVP Esteemed Contributor

The ArcPy Geometry classes support curves, at least the internal data structures do.  Unfortunately, none of their constructors support curves, and several of their properties also don't work well with curves.  The following StackExchange thread demonstrates a way to do it:  Can ArcPy 10.1 be used to generate true curve elliptical polygons in a file geodatabase?  Basically, you use Esri JSON and arcpy.AsShape to create the geometry:

```>>> esri_json = {
...     "curvePaths": [[
...         [1,5],
...         {"c": [[7,3], [6,2]]}
...     ]],
...     "spatialReference": {"wkid": 0}
... }
...
>>> ln = arcpy.AsShape(esri_json, True)
>>> arcpy.CopyFeatures_management(ln, 'in_memory/tmpFC')
<Result 'in_memory\\tmpFC'>
>>>```

If you are going to take this approach, I encourage you to read the Geometry objects section of the ArcGIS REST API.  The Geometry objects section explains the syntax for working with the various curved objects.  Also, always define a spatial reference with the Esri json because not doing so causes some really strange behaviors with the geometry objects that are created.

New Contributor III

this is very interesting and helpful. thank you Joshua