Skip to contents

Distances are computed on geographic coordinates with the sf/S2 spherical geometry engine. coast_dist() enables S2 only for the duration of the geometry calculation and restores the caller's existing sf::sf_use_s2() setting afterward. For line geometries the result is the shortest distance to the line; for polygon geometries points inside or on the boundary have zero distance.

Usage

coast_dist(x, coast)

Arguments

x

An <ocean_cube> object.

coast

Either an sf/sfc object or a path readable by sf::st_read().

Value

An <ocean_cube> with x$dc as a [lon, lat] matrix in nautical miles.