FRAMES | NO FRAMES
Geometry Objects

This is an archive of a previous version of the ArcGIS REST API. The current version can be found at http://resources.arcgis.com/en/help/arcgis-rest-api/

Overview

This document discusses the JSON geometry and spatial reference objects as returned by the REST API. The REST API supports 4 geometry types - points, polylines, polygons and envelopes.

Spatial Reference

The spatial reference can be specified using a well-known ID (wkid) or well-known text (wkt). Note that pre-10 only wkid was supported.

wkid based syntax:

For a list of valid WKID values, see Projected coordinate Systems and Geographic coordinate Systems.

JSON Syntax

{"wkid" : <wkid>}

JSON Example

{"wkid" : 4326}

wkt based syntax:

JSON Syntax

{"wkt" : "<wkt>"}

JSON Example

{"wkt" : "GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]]"}

Point

A point contains x and y fields along with a spatialReference field.

JSON Syntax

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

JSON Example

{
"x" : -118.15, "y" : 33.80, "spatialReference" : {"wkid" : 4326}
}

Polyline

A polyline contains an array of paths and a spatialReference. Each path is represented as an array of points. And each point in the path is represented as a 2-element array. The 0-index is the x-coordinate and the 1-index is the y-coordinate.

JSON Syntax

{
"paths" : [
[ [<x11>, <y11>], [<x12>, <y12>] ],
[ [<x21>, <y21>], [<x22>, <y22>] ]
],
"spatialReference" : {<spatialReference>}
}

JSON Example

{
"paths" : [
[ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832] ],
[ [-97.06326,32.759], [-97.06298,32.755] ]
],
"spatialReference" : {"wkid" : 4326}
}

Polygon

A polygon contains an array of rings and a spatialReference. Each ring is represented as an array of points. The first point of each ring is always the same as the last point. And each point in the ring is represented as a 2-element array. The 0-index is the x-coordinate and the 1-index is the y-coordinate.

JSON Syntax

{
"rings" : [
[ [<x11>, <y11>], [<x12>, <y12>], ..., [<x11>, <y11>] ],
[ [<x21>, <y21>], [<x22>, <y22>], ..., [<x21>, <y21>] ]
],
"spatialReference" : {<spatialReference>}
}

JSON Example

{
"rings" : [
[ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832], [-97.06138,32.837] ],
[ [-97.06326,32.759], [-97.06298,32.755], [-97.06153,32.749], [-97.06326,32.759] ]
],
"spatialReference" : {"wkid" : 4326}
}

Multipoint

A multipoint contains an array of points and a spatialReference. Each point is represented as a 2-element array. The 0-index is the x-coordinate and the 1-index is the y-coordinate.

JSON Syntax

{
"points" : [ [<x1>, <y1>], [<x2>, <y2>] ],
"spatialReference" : {<spatialReference>}
}

JSON Example

{
"points" : [ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832] ],
"spatialReference" : {"wkid" : 4326}
}

Envelope

An envelope contains the corner points of an extent and is represented by xmin, ymin, xmax, and ymax, along with a spatialReference.

JSON Syntax

{
"xmin" : <xmin>, "ymin" : <ymin>, "xmax" : <xmax>, "ymax" : <ymax>,
"spatialReference" : {<spatialReference>}
}

JSON Example

{
"xmin" : -109.55, "ymin" : 25.76, "xmax" : -86.39, "ymax" : 49.94,
"spatialReference" : {"wkid" : 4326}
}