deg2km | R Documentation |
Convert geographical coordinates to kilometers and vice versa.
deg2km(x, y, long.ref, lat.ref, method = "utm")
km2deg(x, y, long.ref, lat.ref, method = "utm")
x , y |
A numeric vector of longitude and latitude coordinates. Coordinates are assumed to be in decimal degree format. |
long.ref , lat.ref |
Reference coordinate from which the coordinate distances will be calculated. Assumed to be in decimal degree format. |
method |
Character string specifying the method to be used for calculating the distances between coordinate points. The options are ‘utm’ which first converts the coordinates into UTM NAD83 coordinates, and ‘ellipsoid’ which models the Earth as an ellipsoid with major and minor radii of 6378.16 and 6356.775 kilomters, respectively. The default is ‘utm’. |
A data frame containing the converted coordinates.
deg2km()
: Convert coordinates from decimal lat-lon to kilometers (UTM).
km2deg()
: Convert coordinates from kilometers to decimal lat-lon.
loran2deg
, deg2dms
, deg2dmm
, deg2str
# Convert a decimal degree coordinate to kilometers format:
deg2km(-63.123, 47.56)
# Convert a vector of decimal degree coordinates to kilometer format:
deg2km(seq(-65, -63, len = 21), seq(46, 48, len = 21))
#Convert a coordinate in kilometer format to decimal degree format:
km2deg(-227.3639, 111.1331)
# Return the value of the reference coordinate:
km2deg(0, 0)
# Convert a vector of kilometer-format coordinates to decimal degree format:
km2deg(seq(0, -200, len = 21), seq(0, 100, len = 21))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.