Learn R Programming

Imap (version 1.32)

world: GSHHS - A Global Self-consistent, Hierarchical, High-resolution Shoreline Database

Description

Both the high and full resolutions of GSHHS have been converted for use in R. The high resolution of GSHHS is provided with the Imap package, the full resolution is available on the internet by using the following commands:

> browseURL("http://imap-for-r.googlecode.com/files/world.f.for.R.GSHHS.Ver.2.Dec.2009.dmp")

> load(choose.files(getwd(), "Find and load the file world.f.for.R.GSHHS.Ver.2.Dec.2009.dmp"))

Or without choose.files(), where 'saved.path' is the path where the file was saved:

> load("/saved.path/world.f.for.R.GSHHS.Ver.2.Dec.2009.dmp")

The full resolution will not work well on low-end computers. Start with 'ilines(world.f.land)' if there is a problem. Occasionally starting over with graphics.off() or using gc() for garbage collection may also help.

Arguments

Format

A (n x 2) matrix with line breaks created with a row of NA's. Longitude is in the first column with lines in the Western Hemisphere being negative numbers. The latitude is in the second column with lines in the Southern Hemisphere being negative.

Source

http://www.soest.hawaii.edu/wessel/gshhs/gshhs.html

Details

All the GSHHS files are available: land, lake, island, pond.in.island, rivers, borders with either 'world.h' or 'world.f' prefix.

The 'npacific' dataset is a small matrix of the Northern Pacific coastline used in some examples involving lines (not polygons).

References

Wessel, P. and Smith, W.H.F., 1996. A global, self-consistent, hierarchical, high-resolution shoreline database. J. Geophys. Res., 101, 8741-8743.

Examples

Run this code
## Not run: 
# 
# imap(list(world.h.land, world.h.lake, world.h.island, world.h.pond.in.island, world.h.rivers))
# 
# # The works with full resolution; high-end computers only.
# imap(list(world.f.land, world.f.lake, world.f.island, world.f.pond.in.island, world.f.borders, world.f.rivers),
#             col=c("black", "blue", "forestgreen", "dodgerblue", "cyan", col.alpha('magenta', alpha = 0.5)), 
#             poly = c("grey50", "blue", "forestgreen", "dodgerblue", NA, NA))
# 
# 
# # The function below will plot selected polygons from 'world.h.land'.
# imap.world <- function (x = 1:20, poly = rainbow(n), ...) 
# {
#     
#     n <- length(x)
#     a <- 0
#     polys <- vector("list", n)
#     land.index <- (1:nrow(world.h.land))[is.na(world.h.land[,1])]
# 
#     for (i in 1:n) 
#         polys[[i + a]] <- world.h.land[land.index[x[i]]:land.index[x[i] + 1], ]
# 
#     
#     imap(polys, col = 'black', poly = poly, keep.attr = TRUE, ...)
#     
#     invisible(polys)
# }
# 
# imap.world()
# 
# imap.world(c(5,4,30,50))
# 
# ## End(Not run)

Run the code above in your browser using DataLab