To GeoCoordinateString

Description

The toGeoCoordinateString operation is performed on a geometry service resource. The operation converts an array of xy-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

f

Description:  (Optional) The response format. The default response format is html.
Values:   html | json

sr

Description: The well-known ID of the spatial reference or a spatial reference json object. For a list of valid WKID values, see Projected coordinate Systems and Geographic coordinate Systems.

coordinates

Description: An array of xy-coordinates in JSON format to be converted.

Syntax:[[x1,y1],...[xN,yN]]

Example:[[10,10],[10,20], [30,30]]

conversionType

Description: The conversion type of the input strings.

Valid conversion types are:

  • MGRS - Military Grid Reference System
  • USNG - United States National Grid
  • UTM - Universal Transverse Mercator
  • GeoRef - World Geographic Reference System
  • GARS - Global Area Reference System
  • DMS - Degree Minute Second
  • DDM - Degree Decimal Minute
  • DD - Decimal Degree
conversionMode

Description: (Optional) Conversion options for MGRS and UTM conversion types.

Valid conversion modes for MGRS are:

  • mgrsDefault - Default. Uses the spheroid from the given spatial reference.
  • mgrsNewStyle - Treats all spheroids as new, like WGS 1984. The 180 degree longitude falls into Zone 60.
  • mgrsOldStyle - Treats all spheroids as old, like Bessel 1841. The 180 degree longitude falls into Zone 60.
  • mgrsNewWith180InZone01 - Same as mgrsNewStyle except the 180 degree longitude falls into Zone 01.
  • mgrsOldWith180InZone01 - Same as mgrsOldStyle except the 180 degree longitude falls into Zone 01.

Valid conversion modes for UTM are:

  • utmDefault - Default. No options.
  • utmNorthSouth - Uses north/south latitude indicators instead of zone numbers. Non-standard. Default is recommended.
numOfDigits

Description: (Optional) The number of digits to output for each of the numerical portions in the string. The default value for numOfDigits varies depending on conversionType.

Conversion Type

Num Digits

MGRS

5

USNG

8

UTM

NA

GeoRef

5

GARS

NA

DMS

2

DDM

4

DD

6

Table: Default number of digits based on conversion type

rounding

Description: (Optional) true | false. If true, then 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.

addSpaces

Description: (Optional) true | false. If true, then 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.

Example Usage

In this example we convert three sets of xy-coordinates to geographic strings in the Military Grid Reference System (MGRS).

http://<geometry service url>/toGeoCoordinateString?sr=4326&coordinates=[[180,0],[-117,34],[0,52]]&conversionType=MGRS&conversionMode=mgrsNewWith180InZone01&numOfDigits=8&addSpaces=true

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 degree longitude is in Zone 01.

{"strings": [
 "01N AA 66021443 00000000",
 "11S NT 00000000 62155978",
 "31U BT 94071081 65288255"
]}

7/27/2017