project static method

Geometry project(
  1. Geometry geometry, {
  2. required SpatialReference outputSpatialReference,
  3. DatumTransformation? datumTransformation,
})

Projects the given geometry from its current spatial reference system into the given output spatial reference system, applying the datum transformation provided.

Use this overload to project a geometry if the difference between the input geometry's SpatialReference and the outputSpatialReference involves a change of datum, and you do not wish to use the default datum transformation used by GeometryEngine.project.

Supports true curves. Projecting curves located at poles and coordinate system horizons using the ArcGIS Maps API may give results that differ slightly from other ArcGIS software. This is because it uses a different geometry projection function.

Parameters:

  • geometry — A geometry object.
  • outputSpatialReference — The spatial reference system to project to.
  • datumTransformation — The datum transformation used to convert coordinates from one coordinate system to another. If the geometry has z-values and its SpatialReference and outputSpatialReference have a vertical coordinate system set, use a HorizontalVerticalTransformation to transform the z-values.

Return Value: The geometry projected into the given SpatialReference. If the input geometry has a null SpatialReference, no projection occurs; instead, an identical geometry with the given SpatialReference is returned.

Implementation

static Geometry project(
  Geometry geometry, {
  required SpatialReference outputSpatialReference,
  DatumTransformation? datumTransformation,
}) {
  _initializeArcGISEnvironmentIfNeeded();
  final objectHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_GeometryEngine_projectWithTransformation(
      geometry._handle,
      outputSpatialReference._handle,
      datumTransformation?._handle ?? ffi.nullptr,
      errorHandler,
    );
  });
  return Geometry._fromHandle(
    objectHandle,
  )!;
}