Skip to contents

srs_find_epsg() accepts a spatial reference system definition in various text formats and tries to find a matching EPSG code. See srs_to_wkt() for a description of the possible input formats. This function is an interface to OSRFindMatches() in the GDAL Spatial Reference System API.

Usage

srs_find_epsg(srs, all_matches = FALSE)

Arguments

srs

Character string containing an SRS definition in various formats (e.g., WKT, PROJ.4 string, well known name such as NAD27, NAD83, WGS84, etc).

all_matches

Logical scalar. TRUE to return all identified matches in a data frame, including a confidence value (0-100) for each match. The default is FALSE which returns a character string in the form "EPSG:<code>" for the first match (highest confidence).

Value

Character string or data frame, or NULL if matching failed.

Details

Matching may be partial, or may fail. Returned entries will be sorted by decreasing match confidence (first entry has the highest match confidence).

Examples

srs_find_epsg("WGS84")
#> [1] "EPSG:4326"

srs_find_epsg("WGS84", all_matches = TRUE)
#>   authority_name authority_code confidence
#> 1           EPSG           4326        100