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.
The REST API only supports spatial references that have well-known IDs
associated with them. Given this constraint, a spatial reference object only
contains one field - wkid
(i.e. the well-known ID of the spatial
reference).
For a list of valid WKID values, see Projected coordinate Systems and Geographic coordinate Systems.
{"wkid" : <wkid>}
{"wkid" : 4326}
A point contains x
and y
fields along with a
spatialReference
field.
{
"x" : <x>, "y" : <y>, "spatialReference" : {<spatialReference>}
}
{
"x" : -118.15, "y" : 33.80, "spatialReference" : {"wkid" : 4326}
}
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.
{
"paths" : [
[ [<x11>, <y11>], [<x12>, <y12>] ],
[ [<x21>, <y21>], [<x22>, <y22>] ]
],
"spatialReference" : {<spatialReference>}
}
{
"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}
}
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.
{
"rings" : [
[ [<x11>, <y11>], [<x12>, <y12>], ..., [<x11>, <y11>] ],
[ [<x21>, <y21>], [<x22>, <y22>], ..., [<x21>, <y21>] ]
],
"spatialReference" : {<spatialReference>}
}
{
"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}
}
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.
{
"points" : [ [<x1>, <y1>], [<x2>, <y2>] ],
"spatialReference" : {<spatialReference>}
}
{
"points" : [ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832] ],
"spatialReference" : {"wkid" : 4326}
}
xmin
, ymin
, xmax
, and
ymax
, along with a spatialReference
.
{
"xmin" : <xmin>, "ymin" : <ymin>, "xmax" : <xmax>, "ymax" : <ymax>,
"spatialReference" : {<spatialReference>}
}
{
"xmin" : -109.55, "ymin" : 25.76, "xmax" : -86.39, "ymax" : 49.94,
"spatialReference" : {"wkid" : 4326}
}