- Version Introduced:10.0
The distance operation is performed on a geometry service resource. It reports the 2D Euclidean or geodesic distance between the two geometries. At 10.1 and later, this operation calls simplify on the input geometry1 and geometry2 values when the geodesic parameter is true. You can provide arguments to the distance operation as query parameters defined in the following parameters table.
Specifies the geometry from which the distance is measured. The structure of the geometry is the same as the structure of the JSON geometry objects returned by ArcGIS REST API. The use of simple syntax is not supported.
Specifies the geometry to which the distance is measured. The structure of the geometry is the same as the structure of the JSON geometry objects returned by ArcGIS REST API. The use of simple syntax is not supported.
Specifies the well-known ID (WKID) or a spatial reference JSON object for input geometries. The spatial reference can be either a projected coordinate system (PCS) or a geographic coordinate system (GCS). For a list of valid WKID values, see Using spatial references.
For planar distance, if distanceUnit is not specified, the distance is in the units of the given spatial reference. If distanceUnit is specified, the unit must be compatible with the given spatial reference. That is, if sr is a PCS, distanceUnit must be linear. If sr is a GCS, distanceUnit must be angular.
For geodesic distance, If distanceUnit is not specified, the distance is measured in meters. If distanceUnit is specified, the unit must be linear.
| geodesic |
If geodesic is set to true, the geodesic distance between the geometry1 and geometry2 geometries is returned. Geodesic distance is the shortest path between two points along the ellipsoid of the earth. If geodesic is set to false or not specified, the planar distance is returned. The default value is false.
Values: true | false
The response format. The default response format is html.
Values: html | json | pjson
The following is a sample request URL for distance that demonstrates how the geodesic distance in meters is computed between a polygon and a point:
JSON Response syntax
JSON Response example