Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

coast

Distance to the nearest shoreline, from GSHHG shoreline polygons.

seastamp coast <INPUT> --data <GSHHG> [OPTIONS]

Appends one column, dist_to_coast (rename with --column), holding the distance from each point to the nearest coastline in kilometers (default) or meters (--unit m).

How it works

The GSHHG L1 (land / ocean) boundary segments are cropped to the region box plus a 5 degree margin, projected through the region’s Lambert Azimuthal Equal-Area (LAEA) projection into meters, and indexed in an R-tree. Each point is projected the same way and takes the planar distance to the nearest segment. Segments are dropped, never clipped, so cropping cannot invent artificial shoreline; a point whose true nearest coast lies beyond the region-plus-margin box gets an over-estimate, so widen the region for such cases.

Because the distance is planar, it is accurate near the projection center and degrades away from it. For points spread too widely for any one center, pass --partition and each area is measured in its own projection.

Options

Beyond the shared options and the region options:

OptionDefaultMeaning
--data <PATH>requiredGSHHG shapefile directory (resolution f recommended) or a GSHHS_*_L1.shp file
--unit <km|m>kmDistance unit for the output column
--column <NAME>dist_to_coastOutput column name

Example

seastamp coast cores.parquet \
  --data ./data/gshhg/gshhg-shp-2.3.7/GSHHS_shp/f \
  --unit km -o cores.coast.parquet

See Reference datasets for how to obtain GSHHG.