Get a coatline for any region on Earth.

coastline(extent = NULL, ..., dimension = c(1024, 1024), projection = NULL)

Arguments

extent

extent xmin, xmax, ymin, ymax

...

argumetns passed to [elevation()]

dimension

optional size of matrix to contour (a default is used)

projection

provide this for custom extents in a given projection

Value

matrix of coordinates in longlat (or whatever projection is specified)

Details

This uses the [elevation()] function to get a coastline by contouring elevation data at 0. (This might return nothing.)

For 'extent' not provided it will be derived from a plot extent if one exists. It's the user's job to ensure the projection is appropriate (we don't have a graphics mechanism to record a current projection string.)

If no device is open and no extent given, a coastline for longlat is given.

Examples

plot(coastline(extent = c(-180, 180, -90, 90)), type = "l")
#> [1] "/vsicurl/https://gebco2023.s3.valeria.science/gebco_2023_land_cog.tif"