toLatitudeLongitude static method

String toLatitudeLongitude(
  1. {required ArcGISPoint point,
  2. required LatitudeLongitudeFormat format,
  3. required int decimalPlaces}
)

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.

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.

Return Value: A string representing the latitude-longitude of the given point.

Implementation

static String toLatitudeLongitude(
    {required ArcGISPoint point,
    required LatitudeLongitudeFormat format,
    required int decimalPlaces}) {
  _initializeArcGISEnvironmentIfNeeded();
  final stringHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_CoordinateFormatter_toLatitudeLongitude(
        point._handle, format.coreValue, decimalPlaces, errorHandler);
  });
  return stringHandle.toDartString();
}