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 |
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 |
---|---|
ArgumentException |
|
ArcGISRuntimeException | Given coordinates could not be parsed or converted. |
Applies to
Platforms and versions
Target | Versions |
---|---|
.NET Standard 2.0 | 100.3 - 100.15 |
.NET 6.0 | 100.13 - 100.15 |
.NET 6.0 Windows | 100.13 - 100.15 |
.NET Framework | 100.1 - 100.15 |
.NET 5 | 100.10 - 100.12 |
.NET Core 3.1 | 100.7 - 100.12 |
Xamarin.Android | 100.1 - 100.15 |
Xamarin.iOS | 100.1 - 100.15 |
UWP | 100.1 - 100.15 |