Convert geographic coordinates to/from Transverse Mercator projection with user-specified central meridian and scale factor.

Two versions are provided:

  • tm_fwd()/tm_rev(): Series approximation, fast, accurate to ~5 nanometers

  • tm_exact_fwd()/tm_exact_rev(): Exact formulation, slower but accurate everywhere

tm_fwd(x, lon0, k0 = 0.9996)

tm_rev(x, y, lon0, k0 = 0.9996)

tm_exact_fwd(x, lon0, k0 = 0.9996)

tm_exact_rev(x, y, lon0, k0 = 0.9996)

Arguments

x

For forward conversion: a two-column matrix or data frame of coordinates (longitude, latitude) in decimal degrees. For reverse conversion: numeric vector of x (easting) coordinates in meters.

lon0

Central meridian in decimal degrees. Can be a vector to specify different central meridians for each point.

k0

Scale factor on the central meridian. Default is 0.9996 (UTM). Common values: 0.9996 (UTM), 1.0 (many national grids), 0.9999 (some state planes).

y

Numeric vector of y (northing) coordinates in meters (reverse only).

Value

Data frame with columns:

  • For forward conversion:

    • x: Easting in meters

    • y: Northing in meters

    • convergence: Grid convergence in degrees

    • scale: Scale factor at the point

    • lon, lat: Input coordinates (echoed)

    • lon0: Central meridian (echoed)

  • For reverse conversion:

    • lon: Longitude in decimal degrees

    • lat: Latitude in decimal degrees

    • convergence: Grid convergence in degrees

    • scale: Scale factor at the point

    • x, y: Input coordinates (echoed)

    • lon0: Central meridian (echoed)

Details

The Transverse Mercator projection is a conformal cylindrical projection commonly used for:

  • UTM (Universal Transverse Mercator) zones

  • Many national and state coordinate systems

  • Large-scale topographic mapping

Unlike utmups_fwd() which automatically selects UTM zones, these functions allow you to specify any central meridian and scale factor.

The series approximation (tm_fwd/tm_rev) is accurate to ~5 nanometers within 3900 km of the central meridian. The exact version (tm_exact_fwd/tm_exact_rev) is slower but works accurately everywhere.

The lon0 parameter is vectorized, allowing different central meridians for each point (useful for processing data across multiple zones).

See also

utmups_fwd() for automatic UTM zone selection.

Examples

# Basic Transverse Mercator (like UTM zone 55)
pts <- cbind(lon = c(147, 148, 149), lat = c(-42, -43, -44))
tm_fwd(pts, lon0 = 147, k0 = 0.9996)
#>           x        y convergence     scale lon lat lon0
#> 1      0.00 -4647916   0.0000000 0.9992002 147 -42  147
#> 2  81476.04 -4759395  -0.6820358 0.9992819 148 -43  147
#> 3 160285.27 -4871868  -1.3896118 0.9995163 149 -44  147

# Compare with UTM
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 660349.4 5126183   55  FALSE  -1.3896118 0.9999162 149 -44 EPSG:32755

# Custom scale factor (k0 = 1.0)
tm_fwd(pts, lon0 = 147, k0 = 1.0)
#>           x        y convergence     scale lon lat lon0
#> 1      0.00 -4649776   0.0000000 0.9996000 147 -42  147
#> 2  81508.65 -4761300  -0.6820358 0.9996817 148 -43  147
#> 3 160349.41 -4873817  -1.3896118 0.9999162 149 -44  147

# Different central meridian for each point
tm_fwd(pts, lon0 = c(147, 148, 149), k0 = 0.9996)
#>   x        y convergence     scale lon lat lon0
#> 1 0 -4647916           0 0.9992002 147 -42  147
#> 2 0 -4758910           0 0.9992002 148 -43  148
#> 3 0 -4869924           0 0.9992002 149 -44  149

# Round-trip conversion
fwd <- tm_fwd(pts, lon0 = 147, k0 = 0.9996)
tm_rev(fwd$x, fwd$y, lon0 = 147, k0 = 0.9996)
#>   lon lat convergence     scale         x        y lon0
#> 1 147 -42   0.0000000 0.9992002      0.00 -4647916  147
#> 2 148 -43  -0.6820358 0.9992819  81476.04 -4759395  147
#> 3 149 -44  -1.3896118 0.9995163 160285.27 -4871868  147

# Exact version for high precision or extreme locations
tm_exact_fwd(pts, lon0 = 147, k0 = 0.9996)
#>           x        y convergence     scale lon lat lon0
#> 1      0.00 -4647916   0.0000000 0.9992002 147 -42  147
#> 2  81476.04 -4759395  -0.6820358 0.9992819 148 -43  147
#> 3 160285.27 -4871868  -1.3896118 0.9995163 149 -44  147