Set (or transform) the coordinate reference system of a spatial object.

setCRS(x, crs, ...)

# S4 method for ANY
setCRS(x)

# S4 method for geom
setCRS(x, crs = NULL)

# S4 method for Spatial
setCRS(x, crs = NULL)

# S4 method for sf
setCRS(x, crs = NULL)

# S4 method for Raster
setCRS(x, crs = NULL)

Arguments

x

the object for which to set the coordinate reference system.

crs

[character(1)]
the coordinate reference system to set for this object.

...

other arguments.

Value

The object x with an assigned or transformed coordinate reference system.

Details

In case an object does not yet have a coordinate reference system assigned, this function simply assigns it. In case the object has already a valid crs, a transformation to the new crs will be carried out. The transformation is computed for all classes with the standard defined in the rgdal package.

See also

Other setters: setFeatures(), setGroups(), setHistory(), setNames(), setWindow()