fromLatitudeLongitude static method

ArcGISPoint fromLatitudeLongitude(
  1. {required String coordinates,
  2. required SpatialReference? spatialReference}
)

Parses a coordinate in latitude-longitude notation, and returns a Point representing that location. The coordinate may use decimal degrees, degrees and decimal minutes, or degrees, minutes, and seconds format.

The spatial reference provided must have an ellipsoid and datum matching those used by the source of the latitude-longitude string. If no spatial reference is provided, it is assumed the latitude-longitude coordinates are referenced to WGS 84.

Supported characters
Symbol Character Name Unicode number HTML code
Degree * 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
Minute ' Apostrophe U+0027 '
Right Single Quotation Mark U+2019 ᾿
Prime U+2032
Second " Quotation Mark U+0022 "
˝ Double Acute Accent U+02DD ˝
Right Double Quotation Mark U+201D
Double Prime U+2033
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.
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*
Returns null on error, including when the given string cannot be interpreted.

Parameters:

  • coordinates — The latitude-longitude notation string for the coordinate.
  • spatialReference — A spatial reference that defines the datum and ellipsoid referenced by the latitude-longitude coordinate.

Return Value: A point with the location from the coordinate string in the spatial reference provided.

Implementation

static ArcGISPoint fromLatitudeLongitude(
    {required String coordinates,
    required SpatialReference? spatialReference}) {
  _initializeArcGISEnvironmentIfNeeded();
  final coreCoordinates = _CString(coordinates);
  final objectHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_CoordinateFormatter_fromLatitudeLongitude(
        coreCoordinates.bytes,
        spatialReference?._handle ?? ffi.nullptr,
        errorHandler);
  });
  return ArcGISPoint._fromHandle(objectHandle)!;
}