sp_transform | R Documentation |
sp_transform
is a simple wrapper for 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.
sp_transform(sp, to = NA, warn = TRUE)
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? |
sp_transform
will also work for raster layers.
Stuart K. Grange
spTransform
, sp_projection
,
projection_wgs84
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.