utmZone static method
A projection adapter between WGS84 geographic and UTM projected positions.
Use forward
of the adapter to return a projection for:
- source:
lon
andlat
geographic coordinates (WGS 84) - target:
easting
andnorthing
UTM projected coordinates in the given zone (UTM/WGS 84 or UTM in the target datum if specified)
Use inverse
of the adapter to return a projection for:
- source:
easting
andnorthing
UTM projected coordinates in the given zone (UTM/WGS 84 or UTM in the target datum if specified) - target:
lon
andlat
geographic coordinates (WGS 84)
By default both source and target are based on the WGS 84 datum. If
different datum is needed for the target, then specify it with both
targetCrs
and targetDatum
(both must be non-null then).
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.
The accuracy on conversions using other than the Datum.WGS84 datum is not guaranteed. The accuracy depends on the transformation parameter of the Helmert 7-parameter transformation used in the conversion.
Implementation
static ProjectionAdapter utmZone(
UtmZone zone, {
CoordRefSys? targetCrs,
Datum? targetDatum,
}) {
final isNonWGS84Target = targetCrs != null && targetDatum != null;
return UtmProjectionAdapter.geographicToProjected(
// source is geographic coordinates in WGS 84
sourceCrs: CoordRefSys.CRS84,
sourceDatum: Datum.WGS84,
// target is UTM projected coordinates of the target zone in WGS 84 or the
// given target datum
targetCrs: isNonWGS84Target
? targetCrs
: CoordRefSys.utmWgs84(zone.lonZone, zone.hemisphere),
targetDatum: isNonWGS84Target ? targetDatum : Datum.WGS84,
targetZone: zone,
);
}