Add Drawing

With the Automation drawing API , you can add placemarks, paths, and polygons in ArcGIS Earth. The drawing can contain geometry and a symbol. Add a drawing to ArcGIS Earth that will return the drawing ID. Drawings will be saved in the My Drawings folder in the table of contents once it is successfully added, and you can manage and update them in ArcGIS Earth.

Request URL

<baseUrl>/arcgisearth/Drawings(POST only)

Request parameters

ParameterDescription

ID

(optional)

Specifies the ID of a drawing.

Type: string

visible

(optional)

Indicates if the drawing is visible in the table of contents.

title

(optional)

The title for the drawing.

geometry

(required)

The position and geometry type of a drawing. It defines the JSON formats of the geometry and spatial reference objects. Supports point, polyline, and polygon geometry.

Point parameters:

  • x
    • x-coordinate measured along the east–west axis.
    • Type: double
  • y
    • y-coordinate measured along the north–south axis.
    • Type: double
  • spatialReference

JSON syntax:

{ 
    "x": <x>, 
    "y": <y>, 
    "spatialReference": { 
        <spatialReference> 
    } 
}

Polyline parameters:

  • paths
    • An array of paths, or line segments, that make up the polyline. It is only for polyline type geometry.
    • Type: number[][][]
  • spatialReference

JSON syntax:

{ 
 "paths": [[[<x11>, <y11>, <z11>],...,[<x1N>,
<y1N>, <z1N>]],
,...,[[<xk1>, <yk1>, <zk1>]
,...,[<xkM>, <ykM>, <zkM>]]],                               
"spatialReference":{ 
<spatialReference> 
} 
}

Polygon parameters:

  • rings
    • An array of rings.
    • Type: number[][][]
  • spatialReference

JSON syntax:

{ 
   "rings": [ 
        [<x11>, <y11>, <z11>], 
        ...
        [<x1N>, <y1N>, <z1N>] 
     ], 
    "spatialReference":{
        <spatialReference> 
    } 
}

symbol

(optional)

The symbol for the drawing. Choosing a symbol for a drawing depends on the geometry type of the drawing.

  • type
    • The symbol type.
    • Possible values: "picture-marker"| "simple-line"| "simple-fill"
    • Type: string
  • url
    • Specifies the URL or path of a PictureMarkerSymbol. It is only for PictureMarkerSymbol.
    • Type: string
  • size
    • The width of the picture symbol in points. It is only for PictureMarkerSymbol.
    • Type: number
  • width
    • The width of the line symbol in points. It is only for SimpleLineSymbol and SimpleFillSymbol.
    • Type: number
  • color
    • The color of the symbol.
    • Type: color
  • outline
    • The outline of the SimpleFillSymbol.
    • Type: SimplelineSymbol

labelSymbol

(optional)

The label text symbol is used to add a label to a point drawing.

  • type
    • The labelSymbol type.
    • Possible values: "text"
    • Type: string
  • color
    • The color of the labelSymbol.
    • Type: color
  • font
    • The font of the labelSymbol.
    • Type: Font

JSON syntax:

{ 
 "type" : "text", 
  "color" : <color>, 
  "size" : <fontSize> 
}

Example usage

The following is a sample input for adding a point drawing:

{
  "id": "4b75ea4a-e10f-d676-307d-aa945e2a0712",
  "visible": true,
  "title": "addPoint",
  "geometry": {
      "x": -100,
      "y": 40,
      "spatialReference": {"wkid": 4326}
      },
   "symbol": {
       "type": "picture-marker",
       "url":"https://static.arcgis.com/images/Symbols/Shapes/BlackStarLargeB.png",
       "size": "64px"
      },
   "labelSymbol":{
        "type":"text",
        "color": [76,115,0,255],
        "size":12
    }
}

The following is a sample input for adding a line drawing:

{
  "id": "4b75ea4a-e10f-d676-307d-aa945e2a071922",
  "visible": true,
  "title": "addLine",
  "geometry": {
         "paths": [
             [
                -118,
                34
              ],
             [
                -100,
                40
              ],
             [
                -82,
                34
              ]
          ],
        "spatialReference": {"wkid": 4326}
       },
  "symbol": {
         "type": "simple-line",
         "color": "#33cc33",
         "width": "2px"
        }
 }

The following is a sample input for adding a polygon drawing:

{
  "id": " 4b75ea4a-e10f-d676-307d-aa945e2a0719", 
  "visible": true,
  "title": "addPolygon",
  "geometry": {  
       "rings": [[ 
           [-96.06138,32.837], 
	          [-97.06133,34.836], 
	          [-98.06124,34.834], 
         	 [-97.06127,32.832], 
	          [-97.06138,32.837] 
       ]], 
       "spatialReference": {"wkid": 4326} 
    }, 
  "symbol": { 
        "type": "simple-fill", 
        "color": [76,115,0,255], 
        "outline": { 
	  "color": [110,110,110,255], 
	  "width": 1 
         } 
     } 
}

JSON Response example

The following is a JSON response example for adding a drawing:

{
  "id": "4b75ea4a-e10f-d676-307d-aa945e2a0712",
  "result": "Success"
}