Learn R Programming

oce (version 0.8-10)

as.coastline: Coerce data into coastline dataset

Description

Coerces a sequence of latitudes and longitudes into a coastline dataset.

Usage

as.coastline(latitude, longitude, fillable)

Arguments

latitude
the latitude in decimal degrees, positive north of the equator, or a data frame with columns named latitude and longitude, in which case these values are extracted from the data frame and the second argument is
longitude
the longitude in decimal degrees, positive north of Greenwich.
fillable
boolean indicating whether the coastline can be drawn as a filled polygon.

Value

Details

This may be used when read.coastline cannot read a file, or when the data have been manipulated.

References

The NOAA site http://www.ngdc.noaa.gov/mgg/shorelines/shorelines.html is a good source for coastline data files.

See Also

The documentation for coastline-class explains the structure of coastline objects, and also outlines the other functions dealing with them.

Examples

Run this code
## Demonstrate coastline alteration, removing Georges Island from Halifax Harbour
    library(oce)
    data(coastlineHalifax)
    lat <- coastlineHalifax[["latitude"]]
    lon <- coastlineHalifax[["longitude"]]
    georges <- 44.63632 < lat & lat < 44.64784 & -63.56681 < lon & lon < -63.55452
    lat <- lat[!georges]
    lon <- lon[!georges]
    coastlineNew <- as.coastline(lat, lon, fillable=TRUE)
    par(mfrow=c(2,1))
    plot(coastlineHalifax)
    plot(coastlineNew)

Run the code above in your browser using DataLab