Description Usage Arguments Details Value References

View source: R/set_projection.R

The function `set_projection`

sets the projection of a shape file. It is
a convenient wrapper of `spTransform`

and
`projectRaster`

with shortcuts for commonly
used projections. The projection can also be set directly in the plot call
with `tm_shape`

. This function is also used to set the current
projection information if this is missing. The function `get_projection`

is used to get the projection information.

1 2 3 4 | ```
set_projection(shp, projection = NA, current.projection = NA,
overwrite.current.projection = FALSE)
get_projection(shp, as.CRS = FALSE, guess.longlat = FALSE)
``` |

`shp` |
shape object of class |

`projection` |
new projection. See |

`current.projection` |
the current projection of |

`overwrite.current.projection` |
logical that determines whether the current projection is overwritten if it already has a projection that is different. |

`as.CRS` |
should a CRS object be returned instead of a PROJ.4 character string? Default is |

`guess.longlat` |
if |

For raster objects, the projection method is based on the type of data. For numeric layers, the bilinear method is used, and for categorical layers the nearest neighbor. See `projectRaster`

for details.

`set_projection`

returns a (transformed) shape object with updated projection information. `get_projection`

returns the `PROJ.4`

character string of `shp`

.

Tennekes, M., 2018, tmap: Thematic Maps in R, Journal of Statistical Software, 84(6), 1-39, DOI

tmaptools documentation built on April 10, 2018, 9:07 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.