- URL:https://<geometry service url>/toGeoCoordinateString
- Related Resources:From GeoCoordinateString
- Version Introduced:10.3
Description
The toGeoCoordinateString operation is performed on a geometry service resource. The operation converts an array of x,y coordinates into well-known strings based on the conversion type and spatial reference supplied by the user. Optional parameters are available for some conversion types. Note that if an optional parameter is not applicable for a particular conversion type, but a value is supplied for that parameter, the value will be ignored.
Request parameters
Parameter | Details |
---|---|
sr | Specifies the well-known ID of the spatial reference or a spatial reference json object. For a list of valid WKID values, see Using spatial references. |
coordinates | Specifies an array of x,y coordinates in JSON format to be converted. Syntax
Example
|
conversionType | Specifies the conversion type of the input strings. Valid conversion types are as follows:
|
conversionMode (Optional) | Specifies the conversion options for MGRS and UTM conversion types. Valid conversion modes for MGRS are as follows:
Valid conversion modes for UTM are as follows:
|
numOfDigits (Optional) | Sets the number of digits to output for each of the numerical portions in the string. The default value for numOfDigits varies depending on conversionType:
|
rounding (Optional) | If true, numeric portions of the string are rounded to the nearest whole magnitude as specified by numOfDigits. Otherwise, numeric portions of the string are truncated. The rounding parameter applies only to conversion types MGRS, USNG, and GeoRef. The default value is true. Values: true | false |
addSpaces (Optional) | If true, spaces are added between components of the string. The addSpaces parameter applies only to conversion types MGRS, USNG, and UTM. The default value for MGRS is false, while the default value for both USNG and UTM is true. Values: true | false |
f | The response format. The default format is html. Values: html | json | pjson |
Example usage
The following is a sample request URL for toGeoCoordinateString that demonstrates how to convert three sets of x,y coordinates to geographic strings in MGRS.
https://machine.domain.com/webadaptor/rest/services/Utilities/Geometry/GeometryServer/toGeoCoordinateString?sr=4326&coordinates=[[180,0],[-117,34],[0,52]]&conversionType=MGRS&conversionMode=mgrsNewWith180InZone01&numOfDigits=8&addSpaces=true&f=pjson
JSON Response syntax
The output is a JSON object containing an array of strings.
{"strings":[<string1>,...,<stringN>]}
JSON Response example
The output of the example given above is a JSON object containing an array of three strings. Notice that 180 degrees longitude is in Zone 01.
{
"strings": [
"01N AA 66021443 00000000",
"11S NT 00000000 62155978",
"31U BT 94071081 65288255"
]
}