fromGeoRef static method

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

Parses a coordinate in World Geographic Reference System (GEOREF) notation, and returns a Point representing that location.

The spatial reference provided must have an ellipsoid and datum matching those used by the source of the GEOREF string. If no spatial reference is provided, it is assumed the GEOREF string is referenced to WGS 84. The GEOREF string may contain leading and trailing whitespace.

GEOREF notation examples
MKML5056
MKML50285665
Returns null on error, including when the given string is not valid GEOREF notation.

Parameters:

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

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

Implementation

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