Title: | Extract Coordinate System Metadata |
Version: | 0.3.0 |
Description: | Obtain coordinate system metadata from various data formats. There are functions to extract a 'CRS' (coordinate reference system, https://en.wikipedia.org/wiki/Spatial_reference_system) in 'EPSG' (European Petroleum Survey Group, http://www.epsg.org/), 'PROJ4' https://proj.org/, or 'WKT2' (Well-Known Text 2, http://docs.opengeospatial.org/is/12-063r5/12-063r5.html) forms. This is purely for getting simple metadata from in-memory formats, please use other tools for out of memory data sources. |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.0 |
Depends: | R (≥ 3.5.0) |
Suggests: | testthat (≥ 2.1.0), spelling |
Imports: | methods |
URL: | https://github.com/hypertidy/crsmeta |
BugReports: | https://github.com/hypertidy/crsmeta/issues |
Language: | en-US |
NeedsCompilation: | no |
Packaged: | 2020-03-29 09:58:44 UTC; mdsumner |
Author: | Michael Sumner |
Maintainer: | Michael Sumner <mdsumner@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2020-03-29 10:10:02 UTC |
crsmeta: Extract Coordinate System Metadata
Description
Obtain coordinate system metadata from various data formats. There are functions to extract a 'CRS' (coordinate reference system, <https://en.wikipedia.org/wiki/Spatial_reference_system>) in 'EPSG' (European Petroleum Survey Group, <http://www.epsg.org/>), 'PROJ4' <https://proj.org/>, or 'WKT2' (Well-Known Text 2, <http://docs.opengeospatial.org/is/12-063r5/12-063r5.html>) forms. This is purely for getting simple metadata from in-memory formats, please use other tools for out of memory data sources.
Obtain coordinate system metadata from various in-memory R formats.
Details
Coordinate reference systems (CRS) are described at https://en.wikipedia.org/wiki/Spatial_reference_system. The European Petroleum Survey Group (EPSG) codes are maintained at http://www.epsg.org/. The old 'PROJ4' forms (along with newer systems) are described with the 'PROJ' library https://proj.org/. The Well-Known Text system 'WKT2' is documented at http://docs.opengeospatial.org/is/12-063r5/12-063r5.html.
There are a few functions to return a character string of length one of each main kind of projection string.
crs_epsg | short numeric EPSG lookup |
crs_proj | short PROJ4 style string |
crs_wkt2 | the full parameter set as WKT2 string |
Note, this help page has a weird name because for some reason 'crsmeta-package' prevents the page showing up in pkgdown docs.
Author(s)
Maintainer: Michael Sumner mdsumner@gmail.com (ORCID)
See Also
Useful links:
Extract 'EPSG' value
Description
Obtain the 'EPSG' string from an object, if it has one. Supported inputs include sf.
Usage
crs_epsg(x, ...)
Arguments
x |
object with 'EPSG' value |
... |
ignored |
Value
integer (or NA)
References
See Also
crs_wkt2()
crs_proj()
crs_input()
Examples
crs_epsg(sfx)
x <- sfx
attr(x$geom, "crs")$epsg <- NA ## oh no we lost it
crs_epsg(x)
crs_epsg(sfx_new) ## NA, doesn't exist now
Extract 'input' value
Description
Obtain the 'input' string from an object, if it has one. Supported inputs include sf (>= 0.8-1 - probably).
Usage
crs_input(x, ...)
Arguments
x |
object with 'input' value |
... |
ignored |
Value
character (or NA)
Warning
Note that the 'input' value could be almost anything, there is a
huge variety of inputs that can work such as 4326
, projstrings,
WKT2 strings, EPSG declarations 'EPSG:4326'
, or common strings like
'WGS84'
or 'NAD27'
.
Strings like '+init=epsg:4326'
have been deprecated but still
can work, so beware.
References
See Also
crs_wkt2()
crs_proj()
crs_epsg()
Examples
crs_input(sfx) ## doesn't have one
crs_input(sfx_new) ## a proj4string
Extract 'PROJ4' string
Description
Obtain the 'PROJ4' string from an object, if it has one. Supported inputs include raster, sf, sp, and silicate.
Usage
crs_proj(x, ...)
Arguments
x |
object with 'PROJ4' string |
... |
ignored |
Value
character string (or NA
)
References
See Also
crs_epsg()
crs_wkt2()
crs_input()
Examples
crs_proj(sfx)
crs_proj(sfx$geom)
crs_proj(sfx_new) ## NA
Extract 'WKT2' string
Description
Obtain the 'WKT2' string from an object, if it has one. Supported inputs include sp and sf.
Usage
crs_wkt2(x, ...)
crs_wkt(x, ...)
Arguments
x |
object with 'WKT2' string |
... |
ignored |
Details
The functions crs_wkt()
and crs_wkt2()
are aliased, they do the same
thing.
Value
character string (or NA
)
Warning
For WKT2 only, PROJ6 and beyond
References
See Also
crs_epsg()
crs_proj()
crs_wkt()
crs_input()
Examples
crs_wkt2(sfx) # NA
crs_wkt2(sfx$geom) # NA
crs_wkt2(sfx_new)
crs_wkt2(sfx_new$geom)
Simple features example data
Description
A copy of the 'minimal_mesh' data set from the silicate package, with coordinate reference system information added.
Details
sfx
is the old-style PROJ.4 and EPSG code CRS (prior to sf 0.8-1).
sfx_new
is the new-style WKT2, with user input.
Warning
do not use this data in real situations, or as exemplary of the 'sf' format. It was created purely to add examples to this package.
Examples
## three equivalent representations, of increasing richness
crs_epsg(sfx)
crs_proj(sfx)
crs_wkt2(sfx) ## did not exist in earlier sf
## new style
crs_epsg(sfx_new) ## NA!
crs_proj(sfx_new) ## NA!
crs_input(sfx_new)
crs_wkt(sfx_new)