- URL:
- https://<network-layer-url>/geometryToReferent
- Methods:
GET
- Required Capability:
- The ArcGIS Location Referencing license is required to use this resource.
- Version Introduced:
- 11.2
Description
This operation converts one or more coordinate locations or route and measure inputs along a route into a referent and offset value.
A status message is returned indicating success or details on why the conversion failed.
Status messages
The following table contains an enumeration of the possible locating statuses:
Status | Description |
---|---|
| Locating was successful. |
| Locating was successful and the input point was located on more than one route. |
| The route does not exist. |
| The route does not have a shape or the shape is empty. |
| The route does not have measures or the measures are null. |
| The route is not an m-aware polyline. |
| The route location's shape cannot be found because the route has no measures or the route location's measures do not exist on the route. |
| The offset value found spans across a gap. |
Request parameters
Parameter | Details |
---|---|
(Optional) |
Specifies the response format. The default response format is Values: |
| A list of geometries used to convert to referent and offset values. Syntax:
|
(Optional) | Specifies the unit used for output offset values. If this parameter is not specified, the network units are used to return the referent offset value. Values: |
(Optional) | Specifies how the referent will be selected along a route. Values: |
(Optional) | A field of the referent layer returned by the REST endpoint instead of the default ObjectID. Syntax:
Example:
|
(Optional) | The maximum distance in map units to snap a point to the closest location on a nearby route. If a point is farther than the tolerance from a route, a message is returned stating that the point can't be located. |
(Optional) |
The time instant to use as a temporal view date when locating route features. If this parameter is not specified, the current date is used. The parameter value is a number that represents the number of milliseconds since epoch (January 1, 1970) in UTC. Syntax:
Example:
|
(Optional) |
The spatial reference of the input geometry. The spatial reference can be specified as either a Well-Known ID (WKID) or a spatial reference JSON object. If |
(Optional) |
The spatial reference of the returned geometry. The spatial reference can be specified as either a Well-Known ID (WKID) or a spatial reference JSON object. If |
(Optional) |
Specifies the geodatabase version to use. If this parameter is not specified, the published map's version is used. Syntax:
Example:
|
Example usage
Example 1
The following is a URL for converting a single geometry to a referent and offset:
http://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRSServer/networkLayers/1/geometryToReferent?f=json&locations=[{"layerId":2,"geometry":{"x":260631,"y":-437080}}]&offsetUnit=esriMeters&referentSelectionType=”nearestUpstream”&featureIdFieldName=”EventId”&outSR=3310
Example 2
The following is a URL for converting multiple geometries to referents and offsets:
http://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRSServer/networkLayers/1/geometryToReferent?f=json&locations=[{"layerId":2,"geometry":{"x":260631,"y":-437080}},{"layerId":2,"geometry":{"x":260639,"y":-437080}}]&offsetUnit=esriFeet&outSR=3310
JSON Response syntax
{
{
"offsetUnit": "<units>",
"distanceUnit": "<units>",
"spatialReference": "<spatialReference>",
"locations": [
{
"status": "<status1>",
"results": [
{
"objectId": "<objectId1>",
"featureId": "<featureId1>",
"offset": "<offset1>",
"routeId": "<routeId1>",
"distance": <distance1>,
"geometryType": "esriGeometryPoint",
"geometry": { "x": <x>, "y": <y>, "z": <z> }
},
...
]
},
{
"status": "<status2>",
"results": [
{
"objectId": "<objectId2>",
"featureId": "<featureId2>",
"offset": "<offset2>",
"routeId": "<routeId2>",
"distance": <distance2>,
"geometryType": "esriGeometryPoint",
"geometry": { "x": <x>, "y": <y>, "z": <z> }
},
...
]
},
...
}
}
JSON Response example
The following is an example of a successful response:
{
"offsetUnit": "esriMeters",
"distanceUnit": "esriMeters",
"spatialReference": {
"wkid": 3310
},
"locations": [
{
"status": "esriLocatingOK",
"results": [
{
"objectId": 1317,
"featureId": "Event17",
"offset": -3,
"routeId": "R10",
"distance": 0,
"geometryType": "esriGeometryPoint",
"geometry": {
"x": 260675,
"y": -437072,
"z": 0
}
}
]
}
]
}```