projection_units

0th

Percentile

Get or translate units of a projection

Get the units from a projection (CRS) or a shape and determine the multiplier to transpose it in other units.

Usage
projection_units(x = NA, target = "m", orig = NA, to = NA, latitude = 0, show.warnings = TRUE)
Arguments
x
A projection (see get_proj4) or a shape (from class Spatial, Raster), or sf.
target
target unit, one of: "m", "km", "mi", and "ft".
orig
units by the x is defined. Only needed if this information is missing from x and x is projected. Options: "m", "km", "mi", and "ft".
to
multiplier used as follows: orig * to = target. Only needed when orig or target is unknown. For instance, if target is set to "hm" (hectameter), and orig is "m", then to should be 100, meaning 1 hectameter equals 100 meters.
latitude
latitude. Needed if the projection coordinates are in latitude longitude units. In that case the orig will be defined as longitude coordinates at latitude latitude.
show.warnings
should warnings be shown?
Value

list with the following items, orig, target, and to either according the specified argument, or determined determined. The value is NA for items that cannot be determined. The final item is projected, which is determined using is_projected

See Also

approx_distances for distances between two points and approx_areas for areas.

Aliases
  • projection_units
Examples
## Not run: 
# if (require(tmap)) {
#     data(World, land)
#     projection_units(World, target = "miles")
# 
#     projection_units(land)
#     projection_units(land, latitude = 45)
#     projection_units(land, latitude = 89)
# }
# ## End(Not run)
Documentation reproduced from package tmaptools, version 1.0, License: GPL-3

Community examples

Looks like there are no examples yet.