FRAMES | NO FRAMES | Description | Parameters | Examples | Response |
URL | http://<geometryservice-url>/distance |
---|---|
Parent Resource | Geometry Service |
The distance operation is performed on a geometry service resource.
It reports the planar (projected space) / geodesic shortest distance between A and B. sr
is a projected coordinate system. Distance is reported in the
linear units specified by units
or the units of sr
if units is null
.
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 well-known ID or a spatial reference json object for input geometries.
If the planar distance is being measured sr can be PCS, and if the geodesic distance is being measured sr
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. If unit is not specified, the units are derived from sr. For a list of valid units, see esriSRUnitType constants and esriSRUnit2Type constants.
|
geodesic |
Description : If true then measures the geodesic distance between the geometries geometry1 and
geometry2 . This option when not specified is treated as false .
|
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 }