Skip to contents

Function to plot the edge of a map with different projections.

Usage

mapedge(
  x = 360,
  y = 180,
  xmin = -180,
  xmax = 180,
  ymin = -90,
  ymax = 90,
  out = "sf",
  crs = "EPSG:4326"
)

Arguments

x

(numeric) Number of segments in the x (longitude) dimension.

y

(numeric) Number of segments in the y (latitude) dimension.

xmin

(numeric) Minimum value of x (longitude).

xmax

(numeric) Minimum value of x (longitude).

ymin

(numeric) Maximum value of y (latitude).

ymax

(numeric) Maximum value of y (latitude).

out

(character) Output format, either "sf" or "sp". The default "sf" returns simple feature geometries, "sp" returns SpatialPolygons from the sp package.

crs

(character) Coordinate Reference System of the returned spatial object given as a character string, defaults to "EPSG:4326" (WGS 84). Can be used to project the map edge immedately after creating it. Takes effect only if sf=TRUE or sp=TRUE.

Value

An sfc-, or SpatialPolygons-class object.

Examples

# requires rgdal
edge <- mapedge()
molledge <- st_transform(edge, "ESRI:54009")
plot(molledge)