sp_transform: Convenience function to transform a spatial object's...

Description Usage Arguments Details Author(s) Examples

View source: R/sp_transform.R

Description

sp_transform is a simple wrapper for sp::spTransform() which has been written so spatial objects can be transformed quickly without the need to remember the WGS84 proj4 string. sp_transform will force projections when the spatial object contains no projection information.

Usage

1
sp_transform(sp, to = NA, warn = TRUE)

Arguments

sp

Spatial object which is to be transformed.

to

A proj4 string for the projection-transformation. Default is the WGS84 string.

warn

Should the functions raise a warning when the projection is forced?

Details

sp_transform will also work for raster layers.

Author(s)

Stuart K. Grange

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 

# Load a shape file of canal locks for the UK
sp_locks <- sp_read("uk-canals", "locks")

# Print projection string
sp_projection(sp_locks)

# Convert the shape file's projection (UK's Ordnance Survey National Grid)
to WGS84 latitude and longitude
sp_locks <- sp_transform(sp_locks)

# Print projection string
sp_projection(sp_locks)


## End(Not run)

MohoWu/ricardor documentation built on March 6, 2021, 4:17 p.m.