Skip to contents

This function creates a base map using spatial data layers, allowing for custom bounding boxes, aspect ratios, and scale bar adjustments.

Usage

atl_create_bm(
  data = NULL,
  x = "x",
  y = "y",
  buffer = 100,
  asp = "16:9",
  option = "osm",
  land_data = tools4watlas::land,
  mudflats_data = tools4watlas::mudflats,
  lakes_data = tools4watlas::lakes,
  raster_data,
  sc_dist,
  sc_location = "br",
  sc_cex = 0.7,
  sc_height = unit(0.25, "cm"),
  sc_pad_x = unit(0.25, "cm"),
  sc_pad_y = unit(0.5, "cm"),
  projection = sf::st_crs(32631)
)

Arguments

data

A data.table or an object convertible to data.table containing spatial points. Defaults to a single point around Griend if NULL.

x

A character string specifying the column with x-coordinates. Defaults to "x".

y

A character string specifying the column with y-coordinates. Defaults to "y".

buffer

A numeric value specifying the buffer distance for the bounding box. Default is 1000.

asp

A character string specifying the aspect ratio in "width:height" format. Default is "16:9".

option

Either "osm" for OpenStreetMap polygons or "bathymetry" for bathymetry data. Note that for the later it is necessary to provide the bathymetry data in UTM31.

land_data

An sf object for land polygons. Defaults to land.

mudflats_data

An sf object for mudflat polygons. Defaults to mudflats.

lakes_data

An sf object for lake polygons. Defaults to lakes.

raster_data

An SpatRaster (tif opened with terra::rast() of bathymetry data.

sc_dist

Scale bar distance. Optional; calculated automatically if omitted.

sc_location

A character string specifying the location of the scale bar. Default is "br" (bottom right).

sc_cex

Numeric value for the scale bar text size. Default is 0.7.

sc_height

A unit object specifying the height of the scale bar. Default is unit(0.25, "cm").

sc_pad_x

A unit object specifying horizontal padding for the scale bar. Default is unit(0.25, "cm").

sc_pad_y

A unit object specifying vertical padding for the scale bar. Default is unit(0.5, "cm").

projection

The coordinate reference system (CRS) for the spatial data. Defaults to EPSG:32631 (WGS 84 / UTM zone 31N). Output is always UTM 31N

Value

A ggplot2 object representing the base map with the specified settings.

Author

Johannes Krietsch

Examples

# Example with default settings (map around Griend)
bm <- atl_create_bm(buffer = 5000)
print(bm)