Skip to contents

Specify a shape, which is a spatial object from one of these spatial object class packages: sf, stars, or terra.

Usage

tm_shape(
  shp,
  bbox = NULL,
  crs = NULL,
  is.main = NA,
  name = NULL,
  unit = NULL,
  filter = NULL,
  ...
)

Arguments

shp

Spatial object

bbox

Bounding box of the map (only used if shp is the main shape (see is.main)

crs

CRS to which shp is reprojected (only used if is.main = TRUE)

is.main

Is shp the main shape, which determines the crs and bounding box of the map? By default, TRUE if it is the first tm_shape call

name

Name of the shape

unit

Unit of the coordinates

filter

Filter features

...

passed on to bb (e.g. ext can be used to enlarge or shrink a bounding box)

Examples

tm_shape(World, crs = "+proj=ortho +lat_0=-10 +lon_0=-30") +
  tm_polygons()


tm_shape(World, crs = "+proj=robin", filter = World$continent=="Africa") +
  tm_polygons()