suggest_crs: Suggest coordinate systems for an input spatial dataset

View source: R/suggest_crs.R

suggest_crsR Documentation

Suggest coordinate systems for an input spatial dataset

Description

This function takes an input spatial dataset as input and makes "suggestions" for suitable coordinate reference systems that could be used for CRS transformations in spatial analysis projects. The function works by analyzing the extent of the spatial dataset and comparing it to the area extents in the EPSG's coordinate reference system database. The "suggested" coordinate reference systems are determined by minimizing the Hausdorff distances between the CRS area extents and the input dataset, subject to user preferences (such as a geographic coordinate system ID or measurement units).

Usage

suggest_crs(
  input,
  type = "projected",
  limit = 10,
  gcs = NULL,
  units = NULL,
  drop_na = TRUE
)

Arguments

input

A spatial dataset of class "sf", "Spatial*", "RasterLayer", "SpatVector", or "SpatRaster" for which you would like coordinate reference system suggestions.

type

The output CRS type; defaults to "projected".

limit

How many results to return; defaults to 10.

gcs

(optional) The EPSG code for the corresponding geographic coordinate system of the results (e.g. 4326 for WGS 1984).

units

(optional) The measurement units of the coordinate systems in the returned results. Can be one of "m", "ft", or "ft-us".

drop_na

Whether or not to drop EPSG codes that do not appear in the PROJ database (and thus can't be used for CRS transformation). Defauts to TRUE; set to FALSE if you want to search all codes.

Value

A data frame with information about coordinate reference systems that could be suitably used for CRS transformation.

Examples

## Not run: 

library(tigris)
library(crsuggest)

# Get a dataset of Census tracts for Nassau County, NY
nassau_tracts <- tracts("NY", "Nassau", cb = TRUE)

# tigris datasets default to the NAD1983 GCS (EPSG code 4269)
# What are some appropriate projected coordinate systems?
suggest_crs(nassau_tracts)

# Alternatively, we can require projections to have specific
# geographic coordinate systems and/or units
# For example, let's say we only want NAD83(HARN) (code 4152)
# and we want the measurement units to be US feet
suggest_crs(nassau_tracts, gcs = 4152, units = "us-ft")


## End(Not run)

crsuggest documentation built on July 6, 2022, 5:07 p.m.