suggest_crs: Suggestions for map projections depending on the extent

View source: R/suggest_crs.R

suggest_crsR Documentation

Suggestions for map projections depending on the extent

Description

This function provides suggestions for map projections depending on the extent of the map. For SDMs, an equal area projection is generally favoured, but it is also possible to get suggestions for conformal, equidistant or compromise projections. The algorithm is a reimplementation in R of Projection Wizard (Bojan et al., 2016), version 2.1. (https://projectionwizard.org/)

Usage

suggest_crs(
  x,
  distortion = c("equal_area", "conformal", "equidistant", "compromise"),
  round_cm = FALSE,
  return_best = TRUE,
  datum = c("WGS84", "ETRS89", "NAD83"),
  unit = c("m", "ft"),
  lat_check = TRUE,
  world_equidist = NULL,
  quiet = FALSE
)

Arguments

x

A vector of four numeric values representing the extent of the map (xmin, xmax, ymin, ymax), or a SpatExtent object, or a SpatRaster object.

distortion

The type of distortion to be minimized. Options are "equal_area", "conformal", "equidistant" and "compromise". Default is "equal_area".

round_cm

Logical. If TRUE, the central meridian is rounded to the nearest degree. Default is FALSE.

return_best

Logical. If TRUE, only the best projection is returned, otherwise, if there are multiple options, a list will be returned

datum

The datum to use. Options are "WGS84", "ETRS89" and "NAD83". Default is "WGS84".

unit

The unit to use. Options are "m" and "ft". Default is "m".

lat_check

Logical. If TRUE, the function will check if lat values are within range (-90,90). Default is TRUE.

world_equidist

if distortion="equidistant" for a whole world projection, then this parameter should be a list with one of the following sets of elements:

  • "Polar azimuthal equidistant": prj = "polar", pole, ⁠lng_central``, where ⁠pole⁠is either -90 or 90 for the South and North Pole, respectively, from or through which distances are correct, and⁠lng_central⁠is the central meridian. E.g.⁠list(prj = "polar", pole = 90, lng_central = -180)'

  • "Oblique azimuthal equidistant": prj = "oblique", lat_centre, lng_centre, where lat_centre and lng_centre are the latitude and longitude of the centre from or through which distances are correct. E.g. list(prj = "oblique", lat_centre = 39, lng_centre = 145)

  • "Two-point azimuthal": prj = "two_points", lat1, lng1, lat2, lng2, where lat1, lng1, lat2, lng2 are the latitude and longitude of two points on the map from which distances are correct. E.g. list(prj = "two_points", lat1 = 34, lng1 = -117, lat2 = 46, lng2 = 16)

quiet

Logical. If TRUE, suppresses messages. Default is FALSE.

Value

Either a list of two strings (proj4 and WKT) for a single projection (if either only one projection is available or return_best is TRUE), or a list of lists, each containing two strings (proj4 and WKT) for a single projection (if multiple projections are available and return_best is FALSE).

References

Bojan, S, Bernhard, J, & Helen, J (2016) Projection Wizard - An Online Map Projection Selection Tool. The Cartographic Journal 53(2):177-185 DOI: 10.1080/00087041.2015.1131938

Examples

# Whole map
suggest_crs(c(-180, 180, -90, 90))
# Northen Hemisphere
suggest_crs(c(-180, 180, 21, 70))
# Hemisphere showing the tropics
suggest_crs(c(-180, 180, -7, 21))
# Regional map for EW extent
suggest_crs(c(-60, 20, 40, 70))

crstools documentation built on March 19, 2026, 5:08 p.m.