g_transform {gdalraster}R Documentation

Apply a coordinate transformation to a WKT geometry

Description

g_transform() will transform the coordinates of a geometry from their current spatial reference system to a new target spatial reference system. Normally this means reprojecting the vectors, but it could include datum shifts, and changes of units.

Usage

g_transform(wkt, srs_from, srs_to)

Arguments

wkt

Character. OGC WKT string for a simple feature 2D geometry.

srs_from

Character string in OGC WKT format specifying the spatial reference system for the geometry given by wkt.

srs_to

Character string in OGC WKT format specifying the target spatial reference system.

Value

Character string for a transformed OGC WKT geometry.

Note

This function only does reprojection on a point-by-point basis. It does not include advanced logic to deal with discontinuities at poles or antimeridian.

See Also

bbox_from_wkt(), bbox_to_wkt()

Examples

elev_file <- system.file("extdata/storml_elev.tif", package="gdalraster")
ds <- new(GDALRaster, elev_file)
bbox_to_wkt(ds$bbox()) |>
  g_transform(ds$getProjectionRef(), epsg_to_wkt(4326)) |>
  bbox_from_wkt()
ds$close()

[Package gdalraster version 1.10.0 Index]