Convert geographic coordinates (longitude/latitude) to UTM or UPS projected coordinates, or convert projected coordinates back to geographic coordinates.

utmups_fwd(x)

utmups_rev(easting, northing, zone, northp)

Arguments

x

A two-column matrix or data frame of coordinates (longitude, latitude) in decimal degrees for forward conversion, or a list with longitude and latitude components. Can also be a length-2 numeric vector for a single point.

easting

Numeric vector of easting values (x coordinates) in meters for reverse conversion.

northing

Numeric vector of northing values (y coordinates) in meters for reverse conversion.

zone

Integer vector of UTM zone numbers (1-60) or 0 for UPS (polar regions).

northp

Logical vector indicating hemisphere: TRUE for northern hemisphere, FALSE for southern hemisphere.

Value

  • utmups_fwd(): Data frame with columns:

    • x: Easting in meters

    • y: Northing in meters

    • zone: UTM zone number (1-60) or 0 for UPS

    • northp: Logical, TRUE for northern hemisphere

    • convergence: Meridian convergence in degrees (angle between true north and grid north)

    • scale: Scale factor at the point (dimensionless, typically near 1.0)

    • lon: Longitude in decimal degrees (echoed from input)

    • lat: Latitude in decimal degrees (echoed from input)

    • crs: EPSG code string for the UTM/UPS projection

  • utmups_rev(): Data frame with columns:

    • lon: Longitude in decimal degrees

    • lat: Latitude in decimal degrees

    • x: Easting in meters (echoed from input)

    • y: Northing in meters (echoed from input)

    • zone: UTM zone number (echoed from input)

    • northp: Hemisphere indicator (echoed from input)

    • convergence: Meridian convergence in degrees

    • scale: Scale factor at the point

    • crs: EPSG code string for the UTM/UPS projection

Details

The Universal Transverse Mercator (UTM) system divides the Earth into 60 zones, each 6 degrees of longitude wide. For polar regions (latitude > 84°N or < 80°S), the Universal Polar Stereographic (UPS) system is used instead, indicated by zone = 0.

Both functions are fully vectorized. Missing values (NA) are not currently supported.

The convergence angle represents the angle between true north and grid north at a point. The scale factor represents the ratio of the scale along a line to the scale on the reference surface (typically very close to 1.0).

Examples

# Single point forward conversion
result <- utmups_fwd(c(147.325, -42.881))
result
#>          x       y zone northp convergence     scale     lon     lat        crs
#> 1 526541.3 5252349   55  FALSE  -0.2211566 0.9996087 147.325 -42.881 EPSG:32755

# Multiple points
pts <- cbind(lon = c(147, 148, -100, 0),
             lat = c(-42, -43, -42, 0))
utmups_fwd(pts)
#>          x       y zone northp convergence     scale  lon lat        crs
#> 1 500000.0 5350224   55  FALSE   0.0000000 0.9996000  147 -42 EPSG:32755
#> 2 581508.6 5238700   55  FALSE  -0.6820358 0.9996817  148 -43 EPSG:32755
#> 3 417181.9 5349740   14  FALSE   0.6691686 0.9996844 -100 -42 EPSG:32714
#> 4 166021.4       0   31   TRUE   0.0000000 1.0009811    0   0 EPSG:32631

# Reverse conversion
utmups_rev(result$x, result$y, result$zone, result$northp)
#>       lon     lat        x       y zone northp convergence     scale        crs
#> 1 147.325 -42.881 526541.3 5252349   55  FALSE  -0.2211566 0.9996087 EPSG:32755

# Round-trip conversion
fwd <- utmups_fwd(pts)
rev <- utmups_rev(fwd$x, fwd$y, fwd$zone, fwd$northp)
cbind(original = pts, converted = rev[, c("lon", "lat")])
#>   original.lon original.lat converted.lon converted.lat
#> 1          147          -42           147           -42
#> 2          148          -43           148           -43
#> 3         -100          -42          -100           -42
#> 4            0            0             0             0

# Polar regions use UPS (zone 0)
polar <- cbind(c(147, 148, -100), c(88, -88, -85))
utmups_fwd(polar)
#>         x       y zone northp convergence     scale  lon lat        crs
#> 1 2120948 2186243    0   TRUE         147 0.9943028  147  88 EPSG:32661
#> 2 2117679 1811675    0  FALSE        -148 0.9943028  148 -88 EPSG:32761
#> 3 1452981 1903546    0  FALSE         100 0.9958948 -100 -85 EPSG:32761