View on GitHub
import InlineCode from "@esri-dx/starship-doc-components/components/InlineCode.astro";

Format coordinates in a variety of common notations.

Images of show coordinates in multiple formats

Use case

The coordinate formatter can format a map location in WGS84 in a number of common coordinate notations. Parsing one of these formats to a location is also supported. Formats include decimal degrees; degrees, minutes, seconds; Universal Transverse Mercator (UTM), and United States National Grid (USNG).

How to use the sample

Tap on the map to see the text fields update with the tapped location’s coordinates formatted in 4 different ways. You can also put a coordinate string in the corresponding text field. Tap return and the coordinate string will be parsed to a map location which will move the map point and update the other text fields’ coordinate strings.

How it works

  1. Get or create a map
    with a spatial reference.
  2. To get the formatted string, use one of the static methods below.
  3. To get an
    from a formatted string, use one of the static methods below.

Relevant API

  • CoordinateFormatter
  • CoordinateFormatter.LatitudeLongitudeFormat
  • CoordinateFormatter.UTMConversionMode

Tags

convert, coordinate, decimal degrees, degree minutes seconds, format, latitude, longitude, USNG, UTM