toLatitudeLongitudeOrNull

fun toLatitudeLongitudeOrNull(point: Point, format: LatitudeLongitudeFormat, decimalPlaces: Int): String?

Returns a formatted coordinate in latitude-longitude notation representing the given point's location. The latitude-longitude string contains a space separating the latitude from the longitude value, and the characters 'N' or 'S', and 'E' and 'W', to 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 'decimal_places' parameters. For example: decimal_places | format | Example output | Angular precision | Approx precision* -------------- | ------------------------------------------------- | ---------------------------- | ----------------- | ----------------- 0 | LatitudeLongitudeFormat.DecimalDegrees | 056N 0003W | 1deg | 100km 1 | LatitudeLongitudeFormat.DecimalDegrees | 55.9N 003.2W | 0.1deg | 10km 2 | LatitudeLongitudeFormat.DecimalDegrees | 55.94N 003.16W | 0.01deg | 1km 3 | LatitudeLongitudeFormat.DecimalDegrees | 55.944N 003.162W | 0.001deg | 100m 0 | LatitudeLongitudeFormat.DegreesDecimalMinutes | 55 057N 003 010W | 1min | 2km 1 | LatitudeLongitudeFormat.DegreesDecimalMinutes | 55 56.7N 003 09.7W | 0.1min | 200m 2 | LatitudeLongitudeFormat.DegreesDecimalMinutes | 55 56.65N 003 09.72W | 0.01min | 20m 3 | LatitudeLongitudeFormat.DegreesDecimalMinutes | 55 56.650N 003 09.717W | 0.001min | 2m 0 | LatitudeLongitudeFormat.DegreesMinutesSeconds | 55 56 039N 003 09 043W | 1sec | 30m 1 | LatitudeLongitudeFormat.DegreesMinutesSeconds | 55 56 39.1N 003 09 43.0W | 0.1sec | 3m 2 | LatitudeLongitudeFormat.DegreesMinutesSeconds | 55 56 39.12N 003 09 43.03W | 0.01sec | 300mm 3 | LatitudeLongitudeFormat.DegreesMinutesSeconds | 55 56 39.123N 003 09 43.034W | 0.001sec | 30mm

At the equator to 1 significant figure. 'decimal_places' should be in the interval 0, 16. The point must have a spatial reference. Returns null on error.

Return

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

Since

200.1.0

Parameters

point

The location to be represented as a formatted latitude-longitude string.

format

The mode to use when formatting the latitude-longitude string.

decimalPlaces

The number of decimal places to use.

See also