FRAMES  NO FRAMES  Description  Parameters  Examples  Response 
URL  http://<geometryserviceurl>/distance 

Parent Resource  Geometry Service 
The distance operation is performed on a geometry service resource. It reports the planar (projected space) or geodesic distance between A and B.
From 10.1 onwards this operation will call Simplify on the input geometry1
and geometry2
when the parameter geodesic
is true
.
You can provide arguments to the distance operation as query parameters defined in the parameters table below.
Parameter  Details 

f  Description: The response format.
The default response format is html. Values: html  json 
geometry1  Description: The geometry from where the distance is to be measured. The structure of geometry is same as the structure
of the JSON geometry objects returned by the ArcGIS REST API. The use of simple syntax is not supported. Syntax and Examples: JSON Structures:Syntax:{ { "geometryType" : "esriGeometryPoint", "geometry" : { "x" : 118.15, "y" : 33.80, "spatialReference" : {"wkid" : 4326} } } 
geometry2  Description: The geometry to which the distance is to be measured. The structure of geometry is same as the structure
of the JSON geometry objects returned by the ArcGIS REST API. The use of simple syntax is not supported. Syntax and Examples: JSON Structures:Syntax:{ { "geometryType" : "esriGeometryPoint", "geometry" : { "x" : 118.15, "y" : 33.80, "spatialReference" : {"wkid" : 4326} } } 
sr  Description: The wellknown ID or a spatial reference json object for input geometries. can be either PCS or GCS. For a list of valid WKID values, see Projected coordinate Systems and Geographic coordinate Systems. 
distanceUnit 
Description : Specifies the units for measuring distance between the geometry1 and
geometry2 geometries. For a list of valid units, see esriSRUnitType constants and esriSRUnit2Type constants.
For planar distance: If unit is not specified, the distance is in the units of the given spatial reference. If unit is specified, the unit has to be compatible with the given spatial reference. For PCS the unit is linear and for GCS the unit is angular. For geodesic distance: If unit is not specified, the distance is in meter. If unit is specified, the unit has to be a linear unit. 
geodesic 
Description : If true then the geodesic distance between the geometries geometry1 and geometry2 is returned. If false , or not specified, the planar distance is returned.

Example 1: In this example, the distance in miles is computed between two points.
http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/distance?f=html{
"distance" : <distance>
}
{ "distance" : 10 }