Skip to contents

Extracts the land area from a bathyRaster object produced by raster_bathymetry and returns it as an sf polygon layer suitable for use in the shapefiles argument of basemap. Warning: processing may take a long time if the bathymetry raster is large.

Usage

vector_land(bathy, drop.crumbs = NULL, remove.holes = NULL, smooth = FALSE)

Arguments

bathy

A bathyRaster object from raster_bathymetry. Land cells must be detectable either as NA (the default when depths = NULL or estimate.land = FALSE) or as the factor level "land" (when estimate.land = TRUE).

drop.crumbs

Single numeric value specifying a threshold (area in km2) for disconnected polygons which should be removed. Set to NULL to bypass the removal. Uses the drop_crumbs function.

remove.holes

Single numeric value specifying a threshold (area in km2) for holes which should be removed. Set to NULL to bypass the removal. Uses the fill_holes function. Currently VERY slow.

smooth

Logical indicating whether the pixelated contours should be smoothed. Uses the smooth_ksmooth function.

Value

An sf object containing the land polygons in the same projection as bathy$raster.

Details

The drop.crumbs and remove.holes arguments can be used to reduce the resulting file size. The smooth argument removes the pixelated contours but increases file size and biases the polygon with respect to the underlying raster.

Use vector_land() together with vector_bathymetry to build a matched land + bathymetry pair from a single source raster (e.g. GEBCO, ETOPO, IBCAO) — see the example.

Author

Mikko Vihtakari