The method employs geodesic calculations of the distances along geodesic
curves, i.e. akin to great-circle curves that go along the surface of the
ellipsoidal earth; see
geodDist. The results are minimally
sensitive to the ellipsoidal geometry assumed, but this is not a matter in
serious question today. Note that the results are quite unlike the values
returned from a map projection; in the latter case, the results vary greatly
across a range of popular projections. Use the present function for things
like gridding data or calculating drifter speeds.
geodXy(longitude, latitude, longitudeRef = 0, latitudeRef = 0, rotate = 0)
vector of longitudes
vector of latitudes
numeric, reference longitude
numeric, reference latitude
numeric, counterclockwise angle, in degrees, by which to
rotate the (
i-th point in the
vectors. The value of
x[i] is inferred from the distance along a
geodesic curve from from (
latitude[i]), i.e. the distance along a line
of constant latitude. Similarly,
y[i] is inferred the geodesic
distance from (
latitudeRef). Once the distances are inferred,
signs are calculated from determining the sign of
x[i] and similarly
Data frame of
y, geodesic distance components,
measured in metres. See “Details” for the definitions.
Until 2015-11-02, the names of the arguments
lat.ref; these were
changed to be more in keeping with names in the rest of oce.
The calculation is devised by the author and is without known precedent in the literature, so users might have to explain it in their publications–hence the detailed discussion below.
This is possibly useful, possibly not. The method changed in Oct, 2015.
Other functions relating to geodesy:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
library(oce) data(section) lon <- section[["longitude", "byStation"]] lat<- section[["latitude", "byStation"]] lon <- lon lat <- lat lonR <- lon latR <- lat ## 1. ellipse km <- 1e3 # nicer for graphs xy <- geodXy(lon, lat, lonR, latR) / km ## 2. sphere, with scale tailored to mean local latitude kmperdeg <- geodDist(0, mean(lat)-0.5, 0, mean(lat)+0.5) # mid-latitude estimate X <- (lon - lonR) * kmperdeg * cos(lat * pi / 180) Y <- (lat - latR) * kmperdeg XY <- list(x=X, y=Y) ## plot, with labels for sphere-ellipse deviations par(mfrow=c(2,1), mar=c(3, 3, 1, 1), mgp=c(2, 0.7, 0)) plot(lon, lat, asp=1/cos(median(lat*pi/180))) plot(xy$x, xy$y, asp=1, xlab="x [km]", ylab="y [km]") rms<- function(x) sqrt(mean(x^2)) mtext(sprintf("RMS dev.: x %.2f km, y %.2f km", rms(xy$x-XY$x), rms(xy$y-XY$y)), side=3, line=-1) mtext(sprintf("RMS dev / span: x %.2g, y %.2g", rms(xy$x-XY$x)/diff(range(xy$x)), rms(xy$y-XY$y)/diff(range(xy$y))), side=3, line=-2)
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.