Learn R Programming

gdalraster (version 1.12.0)

transform_xy: Transform geospatial x/y coordinates

Description

transform_xy() transforms geospatial x/y coordinates to a new projection.

Usage

transform_xy(pts, srs_from, srs_to)

Value

Numeric array of geospatial x/y coordinates in the projection specified by srs_to.

Arguments

pts

A two-column data frame or numeric matrix containing geospatial x/y coordinates.

srs_from

Character string specifying the spatial reference system for pts. May be in WKT format or any of the formats supported by srs_to_wkt().

srs_to

Character string specifying the output spatial reference system. May be in WKT format or any of the formats supported by srs_to_wkt().

See Also

epsg_to_wkt(), srs_to_wkt(), inv_project()

Examples

Run this code
pt_file <- system.file("extdata/storml_pts.csv", package="gdalraster")
pts <- read.csv(pt_file)
print(pts)
## id, x, y in NAD83 / UTM zone 12N
## transform to NAD83 / CONUS Albers
transform_xy(pts = pts[, -1], srs_from = "EPSG:26912", srs_to = "EPSG:5070")

Run the code above in your browser using DataLab