Utm.fromGeographic constructor
- Geographic geographic, {
- UtmZone? zone,
- Datum datum = Datum.WGS84,
- bool roundResults = true,
- bool verifyEN = true,
Creates projected UTM coordinates by converting it from a geographic
position based on the datum.
Set zone to specify a zone explicitely rather than using the
zone within which the geographic position lies. Note that overriding the
UTM zone has the potential to result in negative eastings, and strange
results within Norway/Svalbard exceptions (you may need to set verifyEN
to false when overriding the zone).
If roundResults is true (default), then the results are rounded to the
reasonable precision, that is nm precision (1nm = 10^-14°).
Throws FormatException if coordinates are invalid (eg. latitude outside UTM limits).
Use datum to set the datum for calculations with a reference ellipsoid
and datum transformation parameters.
If verifyEN is true it's validated that easting/northing is within
'normal' values (may be suppressed for extended coherent coordinates or
alternative datums e.g. ED50, see epsg.io/23029). The 'normal' values are
roughly 0..1000000m for easting, and 0..9329006m for northing in the
northern hemisphere and 1116914..10000000m in the southern hemisphere.
Examples:
const geographic = Geographic(lat: 48.8582, lon: 2.2945);
// UTM projected coordinates: 31 N 448252 5411933
final utmCoord = Utm.fromGeographic(geographic, datum: Datum.WGS84);
Implementation
factory Utm.fromGeographic(
Geographic geographic, {
UtmZone? zone,
Datum datum = Datum.WGS84,
bool roundResults = true,
bool verifyEN = true,
}) {
final result = geographicToUtm(
lon: geographic.lon,
lat: geographic.lat,
elev: geographic.optElev,
m: geographic.optM,
zone: zone,
datum: datum,
roundResults: roundResults,
to: Projected.new,
);
return Utm.from(
result.zone,
result.position,
datum: datum,
verifyEN: verifyEN,
);
}