Learn R Programming

tmap (version 1.0)

set_projection: Set and get the map projection

Description

The function set_projection sets the projection of a shape file. It is a convenient wrapper of spTransform 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.

Usage

set_projection(shp, projection = NULL, current.projection = NULL,
  overwrite.current.projection = FALSE)

get_projection(shp)

Arguments

shp
shape object of class Spatial
projection
character that determines the new projection. Either a PROJ.4 character string or one of the following shortcuts: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
current.projection
the current projection of shp. Only use this if the current projection is missing or wrong.
overwrite.current.projection
logical that determines whether the current projection is overwritten if it already has a projection that is different.

Value

  • set_projection returns a (transformed) shape object with updated projection information. get_projection returns the PROJ.4 character string of shp.