Select to view content in your preferred language

creat arc

790
2
11-18-2018 01:42 PM
abdallahilemrabott
Emerging Contributor

helo evrybody 

I would like to create an arc (a quarter of the circle to which I know the center, the radius, the angle of orientation (

α)

0 Kudos
2 Replies
JoshuaBixby
MVP Esteemed Contributor

The arcgis.geometry.Polyline — arcgis 1.5.1 documentation references arcs/curves, but it doesn't follow through:

Polylinehttps://esri.github.io/arcgis-python-api/apidoc/html/arcgis.geometry.html#polyline

classarcgis.geometry.Polyline(iterable=None, **kwargs)https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.geometry.html#arcgis.geometry.Polyline

A polyline contains an array of paths or curvePaths and a spatialReference. For polylines with curvePaths, see the sections on JSON curve object and Polyline with curve. Each path is represented as an array of points, and each point in the path is represented as an array of numbers. A polyline can also have boolean-valued hasM and hasZ fields. See the description of multipoints for details on how the point arrays are interpreted. An empty polyline is represented with an empty array for the paths field. Nulls and/or NaNs embedded in an otherwise defined coordinate stream for polylines/polygons is a syntax error.

coordinates()

So where are the "sections on JSON curve object and Polyline with curve" that the documentation mentions?  They are in the Geometry objects—Common Data Types | ArcGIS for Developers  documentation:

JSON curve object

At 10.3, a circular arc, an elliptical arc, and a Bézier curve can be represented as a JSON curve object. A curve object is a segment in a polyline or polygon. It cannot be used as a stand-alone object.

A curve object is given in a compact "curve to" manner with the first element representing the "to" point or end point. The "from" point is derived from the previous segment or curve object.

The supported curve objects are as follows:

  • Circular Arc "c"
    • Defined by an end point and an interior point
    • {"c": [[x, y, <z>, <m>],[interior_x, interior_y]]}

and

Polyline with curves

A polyline with curves contains an array of curvePaths and an optional spatialReference. See the section on JSON curve object. If you need to interoperate with a new (10.3 or later) and an older server (prior to 10.3), you can pass two variants in the JSON object using curvePaths for the new server and paths for the old server, which are interpreted as line segments.

Each curve path is represented as an array containing points and curve objects.

{"curvePaths": [start point, next point or curve object, … ] }

JSON examples

Example 1

A polyline that is a circular arc from (0, 0) to (3, 3) through (1, 4).

{"curvePaths": [[[0,0], {"c": [[3,3],[1,4]]} ]]}

Using Example 1 above:

>>> from arcgis.geometry import Polyline
>>> arc = Polyline({"curvePaths": [[[0,0], {"c": [[3,3],[1,4]]} ]]})
>>> arc.length
7.777257539739537
>>>