Show / Hide Table of Contents

Method FromLatitudeLongitude

FromLatitudeLongitude(String, SpatialReference)

Parses a coordinate string in latitude-longitude notation, and returns a MapPoint representing that location. The coordinate may use decimal degrees (DD); degrees and decimal minutes (DDM); or degrees, minutes, and seconds (DMS) format.

Declaration
public static MapPoint FromLatitudeLongitude(string coordinates, SpatialReference spatialReference)
Parameters
Type Name Description
System.String coordinates

The latitude-longitude notation string for the coordinate.

SpatialReference spatialReference

An optional SpatialReference that defines the datum and ellipsoid referenced by the latitude-longitude coordinate. May be null, in which case Wgs84 is used.

Returns
Type Description
MapPoint

A MapPoint with the location from the coordinate string in the spatial reference provided.

Remarks

The provided spatialReference parameter must have an ellipsoid and datum matching those used by the source of the latitude-longitude string. If no SpatialReference is provided, it is assumed that the latitude-longitude coordinates are referenced to Wgs84.

The latitude-longitude string may contain leading and trailing whitespace, and may also contain a space, comma, or vertical bar symbol to separate the latitude from the longitude. It may also contain the characters 'N', 'S', 'E' and 'W', or use a minus (-) symbol to indicate the hemisphere of each value.

Supported Degree characters

Character Name Unicode number HTML code
Asterisk U+002A *
^ Circumflex Accent U+005E ^
~ Tilde U+007E ~
° Degree Sign U+00B0 °
º Masculine Ordinal Indicator U+00BA º
˚ Ring Above U+02DA ˚
⁰ Superscript Zero U+2070 ⁰

Supported Minute characters

Character Name Unicode number HTML code
' Apostrophe U+0027 '
’ Right Single Quotation Mark U+2019 ᾿
′ Prime U+2032 ′

Supported Second characters

Character Name Unicode number HTML code
" Quotation Mark U+0022 "
˝ Double Acute Accent U+02DD ˝
” Right Double Quotation Mark U+201D ”
″ Double Prime U+2033 ″

Latitude-Longitude notation examples
55 56 39.123N 003 09 43.034W
55°56′39″N 3°09′43″W
55~56.65205', -003~09.71723'
55.9442008 | -3.1619539*

Exceptions
Type Condition
System.ArgumentException

coordinates is null.

ArcGISRuntimeException

Given coordinates could not be parsed or converted.

Applies to

Platforms and versions
TargetVersions
.NET Standard 2.0100.3 - 200.7
.NET100.13 - 200.7
.NET Windows100.13 - 200.7
.NET Android200.0 - 200.7
.NET iOS200.0 - 200.7
.NET Framework100.1 - 200.7
Xamarin.Android100.1 - 100.15
Xamarin.iOS100.1 - 100.15
UWP100.1 - 200.7
Relevant samples
Format coordinates: Format coordinates in a variety of common notations.
In This Article
Back to top Copyright © 2022 Esri.