geodesic
geodesic(D; step=0, unit=:m, np=0, proj::String="", epsg::Integer=0, longest::Bool=false)
or
geodesic(lon1, lat1, lon2, lat2; step=0, unit=:m, np=0, proj::String="", epsg::Integer=0, longest::Bool=false)
Generate geodesic line(s) (shortest distace) on an ellipsoid. Input data can be two or more points. In later case each line segment is descretized at step increments,
Parameters
D: - the input points. This can either be a GMTdataset (or vector of it), a Mx2 matrix, the name of file that can be read as a GMTdataset bygmtread()or a GDAL AbstractDataset object.step: - Incremental distance at which the segment line is descretized in meters(the default), but seeunitunit: - Ifstepis not in meters use one ofunit=:km, orunit=:Nauticalorunit=:Milesnp: - Number of intermediate points between poly-line vertices (alternative tostep)proj- If line data is in Cartesians but with a known projection pass in a PROJ4 string.epsg- Same asprojbut using an EPSG code.longest- Compute the ‘long way around’ of the geodesic. That is, going from point A to B taking the longest path. But mind you that geodesics other than meridians and equator are not closed paths (see https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid). This line is obtained by computing the azimuth from A to B, at B, and start the line at B with that azimuth and go around the Earth till we reach, close to A, but not exactly A (except for the simple meridian cases).
Returns
A Mx2 matrix with the lon lat of the points along the geodesic when input is a matrix. A GMT dataset or a vector of it (when input is Vector{GMTdataset}).
Example
Compute an geodesic between points (0,0) and (30,50) discretized at 100 km steps.
mat = geodesic([0 0; 30 50], step=100, unit=:k);
Source Code
This function has multiple methods:
geodesic(fname::String; step, unit, np, proj, epsg, longest)- proj_utils.jl:424geodesic(line::Matrix{<:Real}; step, unit, np, proj, epsg, longest)- proj_utils.jl:451geodesic(D::GMTdataset; step, unit, np, proj, epsg, longest)- proj_utils.jl:446geodesic(D::Vector{<:GMTdataset}; step, unit, np, proj, epsg, longest)- proj_utils.jl:437geodesic(ds::GMT.Gdal.AbstractDataset; step, unit, np, proj, epsg, longest)- proj_utils.jl:434geodesic(lon1::Real, lat1::Real, lon2::Real, lat2::Real; step, unit, np, proj, epsg, longest)- proj_utils.jl:430geodesic(ll1::Union{AbstractVector{<:Real}, Matrix{<:Real}}, ll2::Union{AbstractVector{<:Real}, Matrix{<:Real}}; step, unit, np, proj, epsg, longest)- proj_utils.jl:427