Show / Hide Table of Contents

Method ToLatitudeLongitude

ToLatitudeLongitude(MapPoint, LatitudeLongitudeFormat, Int32)

Returns a formatted coordinate string in latitude-longitude notation representing the given MapPoint's location.

Declaration
public static string ToLatitudeLongitude(MapPoint point, LatitudeLongitudeFormat format, int decimalPlaces)
Parameters
Type Name Description
MapPoint point

The location to be represented as a formatted latitude-longitude string. It must have a SpatialReference set.

LatitudeLongitudeFormat format

The LatitudeLongitudeFormat to use for the latitude-longitude string.

System.Int32 decimalPlaces

The number of decimal places to use. Value is expected to be between 0 to 16 (inclusive), and will be clamped if necessary.

Returns
Type Description
System.String

A string representing the latitude-longitude of the given MapPoint.

Remarks

The latitude-longitude string contains a space separating the latitude from the longitude value. The characters 'N' or 'S', and 'E' or 'W' indicate the hemisphere of each value. The string also contains spaces separating the components (degrees, minutes, seconds) of each value. The precision of the output is controlled by both the format and decimalPlaces parameters. For example:

decimalPlaces
parameter value
format
parameter value
Example output Angular precision Approximate precision
(at the equator, to 1 significant figure)
0 DecimalDegrees 056N 0003W 1deg 100km
1 DecimalDegrees 55.9N 003.2W 0.1deg 10km
2 DecimalDegrees 55.94N 003.16W 0.01deg 1km
3 DecimalDegrees 55.944N 003.162W 0.001deg 100m
0 DegreesDecimalMinutes 55 057N 003 010W 1min 2km
1 DegreesDecimalMinutes 55 56.7N 003 09.7W 0.1min 200m
2 DegreesDecimalMinutes 55 56.65N 003 09.72W 0.01min 20m
3 DegreesDecimalMinutes 55 56.650N 003 09.717W 0.001min 2m
0 DegreesMinutesSeconds 55 56 039N 003 09 043W 1sec 30m
1 DegreesMinutesSeconds 55 56 39.1N 003 09 43.0W 0.1sec 3m
2 DegreesMinutesSeconds 55 56 39.12N 003 09 43.03W 0.01sec 300mm
3 DegreesMinutesSeconds 55 56 39.123N 003 09 43.034W 0.001sec 30mm

Exceptions
Type Condition
System.ArgumentNullException

point is null.

System.ArgumentException

point does not have a spatial reference.

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.