Solve rhumb line problems on the WGS84 ellipsoid. A rhumb line (or loxodrome) is a path of constant bearing, which appears as a straight line on a Mercator projection. Unlike geodesics, rhumb lines are not the shortest path between two points, but they are easier to navigate as they maintain a constant compass heading.

rhumb_direct(x, azi, s)

rhumb_inverse(x, y)

rhumb_path(x, y, n = 100L)

rhumb_line(x, azi, distances)

rhumb_distance(x, y)

rhumb_distance_matrix(x, y = NULL)

Arguments

x

A two-column matrix or data frame of starting coordinates (longitude, latitude) in decimal degrees.

azi

Numeric vector of azimuths (bearings) in degrees, measured clockwise from north.

s

Numeric vector of distances in meters.

y

A two-column matrix or data frame of ending coordinates (longitude, latitude) in decimal degrees.

n

Integer number of points to generate along the path (including start and end points).

distances

Numeric vector of distances from the starting point in meters.

Value

  • rhumb_direct(): Data frame with columns:

    • lon1, lat1: Starting coordinates

    • azi12: Azimuth (constant along rhumb line, degrees)

    • s12: Distance (meters)

    • lon2, lat2: Destination coordinates

    • S12: Area under rhumb line (square meters)

  • rhumb_inverse(): Data frame with columns:

    • lon1, lat1: Starting coordinates

    • lon2, lat2: Ending coordinates

    • s12: Distance (meters)

    • azi12: Azimuth (degrees)

    • S12: Area under rhumb line (square meters)

  • rhumb_path(): Data frame with columns:

    • lon, lat: Coordinates along the path

    • s: Distance from start (meters)

    • azi12: Constant azimuth (degrees)

  • rhumb_line(): Data frame with columns:

    • lon, lat: Coordinates at specified distances

    • azi: Azimuth (degrees)

    • s: Distance from start (meters)

  • rhumb_distance(): Numeric vector of distances in meters (pairwise).

  • rhumb_distance_matrix(): Matrix of distances in meters.

Details

Rhumb lines are paths of constant azimuth (bearing). They are longer than geodesics (up to 50% longer for long distances) but are useful for navigation because they can be followed with a constant compass heading.

The azimuth is measured in degrees from north, with positive values clockwise (east) and negative values counter-clockwise (west). The range is -180 to 180 degrees.

The area S12 represents the area under the rhumb line quadrilateral with corners at (lat1, lon1), (0, lon1), (0, lon2), and (lat2, lon2).

See also

geodesic_direct() for shortest-path geodesic calculations.

Examples

# Direct problem: Where do you end up starting from London,
# heading east on a rhumb line for 1000 km?
rhumb_direct(c(-0.1, 51.5), azi = 90, s = 1000000)
#>   lon1 lat1 azi12   s12     lon2 lat2          S12
#> 1 -0.1 51.5    90 1e+06 14.30081 51.5 7.970201e+12

# Inverse problem: Rhumb distance from London to New York
rhumb_inverse(c(-0.1, 51.5), c(-74, 40.7))
#>   lon1 lat1 lon2 lat2     s12     azi12           S12
#> 1 -0.1 51.5  -74 40.7 5812568 -101.9189 -3.769914e+13

# Compare to geodesic (rhumb is longer!)
geodesic_inverse(c(-0.1, 51.5), c(-74, 40.7))$s12
#> [1] 5587820
rhumb_inverse(c(-0.1, 51.5), c(-74, 40.7))$s12
#> [1] 5812568

# Generate a rhumb line path
path <- rhumb_path(c(-0.1, 51.5), c(-74, 40.7), n = 10)
path
#> Warning: corrupt data frame: columns will be truncated or padded with NAs
#>           lon      lat         s     azi12
#> 1   -0.100000 51.50000       0.0 -101.9189
#> 2   -9.083431 50.30101  645840.9      <NA>
#> 3  -17.843773 49.10176 1291681.9      <NA>
#> 4  -26.395482 47.90227 1937522.8      <NA>
#> 5  -34.751834 46.70252 2583363.7      <NA>
#> 6  -42.925049 45.50252 3229204.7      <NA>
#> 7  -50.926405 44.30227 3875045.6      <NA>
#> 8  -58.766341 43.10177 4520886.5      <NA>
#> 9  -66.454539 41.90101 5166727.5      <NA>
#> 10 -74.000000 40.70000 5812568.4      <NA>