Add Graphic

A graphic is a vector representation of real-world geographic phenomena. It can contain geometry and a symbol. Add a graphic to ArcGIS Earth and return the graphic ID and its information.

Request URL

<baseUrl>/arcgisearth/graphics(POST only)

Request parameters

ParameterDescription

ID

(optional)

Specifies the ID of a graphic.

Type: string

geometry

(required)

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

Point parameters:

  • type
    • The geometry type.
    • Possible values: "point"
    • Type: string
  • x
    • x-coordinate measured along the east–west axis.
    • Type: double
  • y
    • y-coordinate measured along the north–south axis.
    • Type: double
  • latitude
    • The latitude of the point.
    • Type: double
  • longitude
    • The longitude of the point.
    • Type: double
  • spatialReference

JSON syntax:

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

Polyline parameters:

  • type
    • The geometry type.
    • Possible values: "polyline"
    • Type: string
  • paths
    • An array of paths, or line segments, that make up the polyline. Only for polyline type geometry.
    • Type: number[][][]
  • spatialReference

JSON syntax:

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

Polygon parameters:

  • type
    • The geometry type. The first vertex of each ring should always be the same as the last vertex.
    • Possible values: "polygon"
    • Type: string
  • rings
    • An array of rings.
    • Type: number[][][]
  • spatialReference

JSON syntax:

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

symbol

(optional)

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

Type: double

  • type
    • The symbol type.
    • Possible values: "picture-marker"| "simple-line"| "simple-fill"
    • Type: string
  • url
    • Specifies the URL or path of a PictureMarkerSymbol. Only for PictureMarkerSymbol.
    • Type: string
  • width
    • The width of the line symbol.
    • Type: number
  • height
    • The height of the symbol in points. Only for PictureMarkerSymbol.
    • Type: number
  • angle
    • The angle of the marker relative to the screen in degrees. Only for PictureMarkerSymbol.
    • Type: number
  • xoffset
    • The offset on the x-axis in points. Only for PictureMarkerSymbol.
    • Type: number
  • color
    • The color of the symbol.
    • Type: color
  • outline
    • The outline of the polygon.
    • Type: SimplelineSymbol

Example usage

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

{
  "id": " 4b75ea4a-e10f-d676-307d-aa945e2a0719", 
  "geometry": { 
		   "type": "polygon", 
     "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 
	   		} 
   } 
}

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

{
  "id": "polyline-simple-line-graphic",
  "geometry": {
         "type": "polyline",
         "paths": [
             [
                -118,
                34
              ],
             [
                -100,
                40
              ],
             [
                -82,
                34
              ]
          ]
       },
        "symbol": {
           "type": "simple-line",
           "color": "#33cc33",
           "width": "2px"
        }
 }

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

{
  "id": " 4b75ea4a-e10f-d676-307d-aa945e2a0719", 
  "geometry": { 
					"type": "polygon", 
                 "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 point graphic:

{
    "id": "point-picture-marker-graphic",
    "geometry": {
        "x": -100,
        "y": 40,
        "type": "point"
    },
    "symbol": {
        "angle": 0,
        "height": 48,
        "type": "picture-marker",
        "url": "https://static.arcgis.com/images/Symbols/Shapes/BlackStarLargeB.png",
        "width": 48,
        "xoffset": 7.5,
        "yoffset": 7.5
    }
}

The following is a JSON response example for adding a line graphic:

{
    "id": "polyline-simple-line-graphic",
    "geometry": {
        "paths": [
            [
                [
                    -118,
                    34
                ],
                [
                    -100,
                    40
                ],
                [
                    -82,
                    34
                ]
            ]
        ],
        "type": "polyline"
    },
    "symbol": {
        "color": [
            51,
            204,
            51,
            255
        ],
        "type": "simple-line",
        "width": 1.5
    }
}

The following is a JSON response example for adding a polygon graphic:

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

}