Geometry to Measure

Description

Converts one or more geographic locations into measure values along a set of routes.

If a point location cannot be converted to a measure value, an indication is returned with the reason the conversion failed.

StatusDescription

esriLocatingOK

Locating was successful.

esriLocatingMultipleLocation

Locating was successful, and the input point was located on more than one route.

esriLocatingCannotFindRoute

The route does not exist.

esriLocatingRouteShapeEmpty

The route does not have a shape or the shape is empty.

esriLocatingRouteMeasuresNull

The route does not have measures or the measures are null.

esriLocatingRouteNotMAware

The route is not an m-aware polyline.

esriLocatingCannotFindLocation

Could not find the route location's shape (the route has no measures or the route location's measures do not exist on the route).

Request Parameters

ParameterDetails
f

Description: The response format. The default response format is html.

Values: html | json

locations

Required

Description: A list of routes and point locations to convert to measure values.

If the route ID is omitted for a given point, the point is located on all nearby routes within the tolerance. In that case, the response contains multiple route IDs and measure values corresponding to the single point location.

Syntax:

[
  {
    "routeId" : "<routeId1>",  // route ID is optional, may be omitted or null
    "geometry" : { "x" : <x1>, "y" : <y1> }
  },
  {
    "routeId" : "<routeId2>",  // route ID is optional, may be omitted or null
    "geometry" : { "x" : <x2>, "y" : <y2> }
  },
  ...
]
tolerance

Description: 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, an indication is returned that the point is not locatable.

temporalViewDate

Description: The time instant to use as a temporal view date when locating route features.

The parameter value is a number that represents the number of milliseconds since epoch (January 1, 1970) in UTC.

Syntax: temporalViewDate=<timeInstant>

Example: temporalViewDate=1230768000000 (1 Jan 2009 00:00:00 GMT)

inSR

Description: The spatial reference of the input geometry.

The spatial reference can be specified as either a well-known ID or as a spatial reference JSON object.

If inSR is not specified, the geometry is assumed to be in the spatial reference of the map.

outSR

Description: The spatial reference of the returned geometry.

The spatial reference can be specified as either a well-known ID or as a spatial reference JSON object.

If outSR is not specified, the output geometries are in the spatial reference specified by inSR. If inSR is also not specified, they are in the spatial reference of the map.

gdbVersion

Description: The geodatabase version to use for the network feature class. This parameter applies only if the isDataVersioned property of the network layer is true.

If this parameter is not specified, the published map's version is used.

Example Usage

Example 1

URL for converting a single point to a station.

http://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/eventLayers/1/geometryToStation?f=json&locations=[{"routeId":"I90","geometry":{"x":-8479115,"y":5326520}}]&tolerance=50&inSR=102100

Example 2

URL for converting multiple points to stations.

http://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/eventLayers/1/geometryToStation?f=json&locations=[{"routeId":"I90","geometry":{"x":-8479115,"y":5326520}},{"routeId":"US20","geometry":{"x":-8472692,"y":5295686}}]&tolerance=25&inSR=102100

Example 3

URL for converting a single point on any nearby route to one or more stations.

http://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/eventLayers/1/geometryToStation?f=json&locations=[{"geometry":{"x":-8479100,"y":5326500}}]&tolerance=100&inSR=102100

JSON Response Syntax

{
  "unitsOfMeasure" : "<units>",
  "spatialReference" : <spatialReference>,
  "locations" : [
    { // result(s) for the first point location
      "status" : "<status1>",
      "results" : [
        {
          "routeId" : "<routeId1>",
          "measure" : <measure1>,
          "geometryType" : "<geometryType1>",  // esriGeometryPoint
          "geometry" : { "x" : <x>, "y" : <y> }
        },
        ...
      ]
    },
    { // result(s) for the second point location
      "status" : "<status2>",
      "results" : [
        {
          "routeId" : "<routeId2>",
          "measure" : <measure2>,
          "geometryType" : "<geometryType2>",
          "geometry" : { "x" : <x>, "y" : <y> }
        },
        ...
      ]
    },
    ...
  ]
}

JSON Response Example

{
  "unitsOfMeasure" : "esriMeters",
  "spatialReference" : { "wkid": 102100 },
  "locations" : [
    {
      "status" : "esriLocatingOK",
      "results" : [
        {
          "routeId" : "I90",
          "measure" : 25.05,
          "geometryType" : "esriGeometryPoint",
          "geometry" : { "x" : -8479118.349, "y" : 5326520.134 }
        }
      ]
    }
  ]
}