Geometry objects

Overview

This topic defines the JSON formats of the geometry and spatial reference objects as returned by ArcGIS REST API. ArcGIS REST API supports the following five geometry types:

Starting at 10.1, geometries containing m- and z-values are supported.

Starting at 10.3, polylines and polygons with curves are supported. See the sections on JSON curve object, Polyline with curve, and Polygon with curve for more information.

Spatial reference

A spatial reference can be defined using a well-known ID (wkid) or well-known text (wkt). The default tolerance and resolution values for the associated coordinate system are used. The xy and z tolerance values are 1 mm or the equivalent in the unit of the coordinate system. If the coordinate system uses feet, the tolerance is 0.00328083333 ft. The resolution values are 10x smaller or 1/10 the tolerance values. Thus, 0.0001 m or 0.0003280833333 ft. For geographic coordinate systems using degrees, the equivalent of a mm at the equator is used.

The well-known ID (WKID) for a given spatial reference can occasionally change. For example, the WGS 1984 Web Mercator (Auxiliary Sphere) projection was originally assigned WKID 102100 but was later changed to 3857. To ensure backward compatibility with older spatial data servers, the JSON wkid property will always be the value that was originally assigned to an SR when it was created.

An additional property, latestWkid, identifies the current WKID value (as of a given software release) associated with the same spatial reference.

A spatial reference can optionally include a definition for a vertical coordinate system (VCS), which is used to interpret the z-values of a geometry. A VCS defines units of measure, the location of z = 0, and whether the positive vertical direction is up or down. When a vertical coordinate system is specified with a WKID, the same caveat as mentioned above applies. There are two VCS WKID properties: vcsWkid and latestVcsWkid. A VCS WKT can also be embedded in the string value of the wkt property. In other words, the WKT syntax can be used to define an SR with both horizontal and vertical components in one string. If either part of an SR is custom, the entire SR will be serialized with only the wkt property.

Starting at 10.3, Image Service supports image coordinate systems. See Image Coordinate System for more information.

WKID-based syntax

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

JSON syntax

{
 "wkid" : <wkid>, 
 "latestWkid" : <wkid>,  
 "vcsWkid" : <wkid>,  
 "latestVcsWkid" : <wkid> 
 }

The latestWkid and/or latestVcsWkid can be omitted.

{
 "wkid" : <wkid>,  
 "vcsWkid" : <wkid>
 }

JSON example

{
 "wkid" : 102100,
 "latestWkid" : 3857
 }

{
  "wkid": 4246, 
  "vcsWkid": 5789
}

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. A point can also contain m and z fields. A point is empty when its x field is present and has the value null or the string "NaN". An empty point has no location in space.

JSON syntax

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

JSON example

A 2D point 
{"x" : -118.15, "y" : 33.80, "spatialReference" : {"wkid" : 4326}}

A 3D point 
{"x" : -118.15, "y" : 33.80, "z" : 10.0, "spatialReference" : {"wkid" : 4326}}

An empty point 
{"x" : null, "spatialReference" : {"wkid" : 4326}}

An empty point 
{"x" : "NaN", "y" : 22.2, "spatialReference" : {"wkid" : 4326}}

Multipoint

A multipoint contains an array of points, along with a spatialReference field. A multipoint can also have Boolean-valued hasZ and hasM fields. These fields control the interpretation of elements of the points array. Omitting an hasZ or hasM field is equivalent to setting it to false.

Each element of the points array is itself an array of two, three, or four numbers. It will have two elements for 2D points, two or three elements for 2D points with Ms, three elements for 3D points, and three or four elements for 3D points with Ms. In all cases, the x coordinate is at index 0 of a point's array, and the y coordinate is at index 1. For 2D points with Ms, the m coordinate, if present, is at index 2. For 3D points, the Z coordinate is required and is at index 2. For 3D points with Ms, the Z coordinate is at index 2, and the M coordinate, if present, is at index 3.

An empty multipoint has a points field with no elements. Empty points are ignored.

JSON syntax

{
  "hasM" : true | false,
  "hasZ" : true | false,
  "points" : [[ <x1>, <y1>, <z1>, <m1> ] , [ <x2>, <y2>, <z2>, <m2> ], ... ], 
  "spatialReference" : {<spatialReference>}
}

JSON example

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

A 3D multipoint 
{
  "hasZ" : true, 
  "points" : [[-97.06138,32.837,35.0], [-97.06133,32.836,35.1], [-97.06124,32.834,35.2]],
  "spatialReference" : {"wkid" : 4326}
}

An empty multipoint 
{
  "points" : [  ],
  "spatialReference" : {"wkid" : 4326}
}

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.

JSON syntax

{
  "hasZ" : true | false,
  "hasM" : true | false,
  "paths" : [[[<x11>, <y11>, <z11>, <m11>],...,[<x1N>, <y1N>, <z1N>, <m1N>]],
             ,...,[[<xk1>, <yk1>, <zk1>, <mk1>],...,[<xkM>, <ykM>, <zkM>, <mkM>]]],
  "spatialReference" : {<spatialReference>}
}

JSON example

A 2D polyline 
{
  "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 2D polyline with m-values (note that the 2nd path does not have m-values defined) 
{
  "hasM" : true,
  "paths" : [[[-97.06138,32.837,5],[-97.06133,32.836,6],[-97.06124,32.834,7],[-97.06127,32.832,8]],
             [[-97.06326,32.759],[-97.06298,32.755]]],
  "spatialReference" : {"wkid" : 4326}
}

An empty polyline 
{
  "paths" : [ ]
}

Polygon

A polygon contains an array of rings or curveRings and a spatialReference. For polygons with curveRings, see the sections on JSON curve object and Polygon with curve. Each ring is represented as an array of points. The first point of each ring is always the same as the last point. Each point in the ring is represented as an array of numbers. A polygon 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 polygon is represented with an empty array for the rings field. Nulls and/or NaNs embedded in an otherwise defined coordinate stream for polylines/polygons is a syntax error.

Polygons should be topologically simple. Exterior rings are oriented clockwise, while holes are oriented counter-clockwise. Rings can touch at a vertex or self-touch at a vertex, but there should be no other intersections. Polygons returned by services are topologically simple.

When drawing a polygon, use the even-odd fill rule. The even-odd fill rule will guarantee that the polygon will draw correctly even if the ring orientation is not as described above.

JSON syntax

{
  "hasZ" : true | false,
  "hasM" : true | false,
  "rings" : [[[<x11>, <y11>, <z11>, <m11>],...,[<x1N>, <y1N>, <z1N>, <m1N>]],
             ,...,[[<xk1>, <yk1>, <zk1>, <mk1>],...,[<xkM>, <ykM>, <zkM>, <mkM>]]],
  "spatialReference" : {<spatialReference>}
}

JSON examples

A 2D polygon 
{
  "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 3D polygon with m-values (note that the second ring does not have m-values defined for it) 
{
 "hasZ" : true,
 "hasM" : true,
 "rings" : [[[-97.06138,32.837,35.1,4],[-97.06133,32.836,35.2,4.1],[-97.06124,32.834,35.3,4.2],
             [-97.06127,32.832, 35.2,44.3],[-97.06138,32.837,35.1,4]],[[-97.06326,32.759,35.4],
             [-97.06298,32.755,35.5],[-97.06153,32.749,35.6],[-97.06326,32.759,35.4]]],
  "spatialReference" : {"wkid" : 4326}
}

An empty polygon 
{
  "rings" : [ ]
}

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:

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]]} ]]}

Example 2

A polyline containing a segment from (6, 3) to (5, 3); a Bézier curve from (5, 3) to (3, 2) with control points (6, 1) and (2, 4); a segment from (3, 2) to (1, 2); and an elliptical arc from (1, 2) to (0, 2) with center point (0, 3), minor = 0, clockwise = 0, rotation = 2.094395102393195 (120 degrees), semi-major axis = 1.83, ratio = 0.33333333.

{
  "curvePaths":[[
    [6,3],[5,3],
    {"b":[[3,2],[6,1],[2,4]]},
    [1,2],
    {"a":[[0,2],[0,3],0,0,2.094395102393195,1.83,0.33333333]}
  ]]
}

Polygon with curves

A polygon with curves contains an array of curveRings and an optional spatialReference. Similar to polylines, if you need to interoperate with a new (10.3 or later) and an older server (prior to 10.3), pass two variants in the JSON object using curveRings for the new server and rings for the old server, which are interpreted as line segments.

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

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

JSON example

A multipart polygon with m-values containing a triangle with start/end point (11, 11), a Bézier curve from (11, 11) to (15, 15) with control points (10, 17) and (18, 20), a circular arc from (15, 15) to (20, 16) through (20, 14), and paths for connecting to an older server.

{
  "hasM":true,
  "curveRings":[
    [
      [11,11,1],[10,10,2],[10,11,3],[11,11,4],
      {"b":[[15,15,2],[10,17],[18,20]]},
      [11,11,4]
    ],
    [
      [15,15,1],
      {"c":[[20,16,3],[20,14]]},
      [15,15,3]
    ]
  ],
  "rings":[
    [[11,11,1],[10,10,2],[10,11,3],[11,11,4]],
    [[15,15,1],[11,11,2],[12,15.5],[15.4,17.3],[15,15,3]],
    [[20,16,1],[20,14],[17.6,12.5],[15,15,2],[20,16,3]]
  ]
}

Envelope

An envelope is a rectangle defined by a range of values for each coordinate and attribute. It also has a spatialReference field. The fields for the z and m ranges are optional. An empty envelope has no location in space and is defined by the presence of an xmin field, a null value, or a "NaN" string.

JSON syntax

{
  "xmin" : <xmin>, "ymin" : <ymin>, 
  "xmax" : <xmax>, "ymax" : <ymax>,
  "zmin" : <zmin>, "zmax" : <zmax>,
  "mmin" : <mmin>, "mmax" : <mmax>,
  "spatialReference" : {<spatialReference>}
}

JSON example

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

A 3D envelope 
{
  "xmin" : -109.55, "ymin" : 25.76, "xmax" : -86.39, "ymax" : 49.94, 
  "zmin" : -12.0, "zmax" : 13.3, 
  "spatialReference" : {"wkid" : 4326}
}

An empty envelope 
{"xmin" : null, "spatialReference" : {"wkid" : 4326}}

An empty envelope 
{"xmin" : "NaN"}

10/6/2017