utmZoneToZone static method

ProjectionAdapter utmZoneToZone(
  1. UtmZone sourceZone,
  2. UtmZone targetZone
)

A projection adapter between positions projected to different UTM zones based on the WGS84 datum.

Use forward of the adapter to return a projection for:

  • source: easting and northing UTM projected coordinates in the source zone (UTM/WGS 84)
  • target: easting and northing UTM projected coordinates in the target zone (UTM/WGS 84)

Use inverse of the adapter to return a projection for:

  • source: easting and northing UTM projected coordinates in the target zone (UTM/WGS 84)
  • target: easting and northing UTM projected coordinates in the source zone (UTM/WGS 84)

Projected UTM positions are based on the WGS 84 ellipsoidal datum. Positions locate inside on of the 60 UTM zones (1-60) and in one of the two hemispheres (north or south). The zone is determined by the longitude and the hemisphere by the latitude of the position.

It's possible to specify the zone and the hemisphere so that the source position is not actually inside the zone. In such case projected coordinates may contain strange values.

You can also use the Utm class from the geodesy sub package to convert between geographic and UTM projected coordinates. This also allows converting from a geographic position to a UTM position with the zone and the hemisphere determined by that position without setting them. It also supports accessing metadata like the convergence and the scale factor related to the UTM projection.

With UtmZone.fromGeographic it's possible to calculate the UTM zone and the hemisphere for a geographic position.

Implementation

static ProjectionAdapter utmZoneToZone(
  UtmZone sourceZone,
  UtmZone targetZone,
) {
  return UtmProjectionAdapter.projectedToProjected(
    // source is UTM projected coordinates of the source zone in WGS 84
    sourceCrs:
        CoordRefSys.utmWgs84(sourceZone.lonZone, sourceZone.hemisphere),
    sourceDatum: Datum.WGS84,
    sourceZone: sourceZone,

    // target is UTM projected coordinates of the target zone in WGS 84
    targetCrs:
        CoordRefSys.utmWgs84(targetZone.lonZone, targetZone.hemisphere),
    targetDatum: Datum.WGS84,
    targetZone: targetZone,
  );
}