DESCRIPTION

v.in.gshhs imports GSHHS shorelines as available on http://www.soest.hawaii.edu/wessel/gshhs/

GSHHS shorelines are in latlon but can be imported to any location with any projection apart from unreferenced XY projection. Reprojection is done on the fly during import.

Shorelines are imported as lines, not boundaries.

The categories in layer 1 refer to the type of shoreline: 1 = land, 2 = lake, 3 = island in lake, 4 = pond in island in lake. The field type is set to these descriptions. All lines of the same type have the same category. The categories in layer 2 refer to the GSHHS ID of each imported line. Each line has as category value the GSHHS ID in layer 2, that may be useful for further processing. An attribute table for layer 2 is not created.

The -r flag restricts the import to the current region, otherwise the full dataset is imported. With the -r flag, any line that falls into or overlaps with the current region is imported. Lines are not cropped.

As of July 2012 GSHHS has been renamed GSHHG, as they provide more than just shorelines.

NOTES

The GSHHS shorelines are in files named gshhs_[f|h|i|l|c].b where the letter in brackets indicates the resolution.

The 5 available resolutions are:

Recommended are the full and high resolution data.

The generated table for layer 1 allows a fast query of the shoreline type. If needed, a table for layer 2 can be added with v.db.addtable. The new table can be populated with category values from layer 2 (GSHHS line ID) with v.to.db. Shoreline type can be uploaded from layer 1 to layer 2 with v.to.db.

Lines can be converted to boundaries with v.type. Boundaries can be converted to areas with v.centroids.

To create a land mask, extract all lines with category = 1 in layer 1, convert them to boundaries, add missing centroids, convert area vector to raster. Accordingly for lakes, islands in lakes, and ponds in islands in lakes.

Import of world borders and world rivers also included in the zip archive is currently not supported but works, just ignore the attribute table. These world borders and rivers may be not very accurate.

EXAMPLE

Convert shorelines to land areas. In the imported shoreline map, mainland is category 1, islands in lakes is category 3. Categories 2 and 4 are lakes and ponds on islands in lakes, so we'll exclude them as holes.
# Import the raw data
v.in.gshhs in=gshhs_f.b out=gshhs_shoreline

# Speed up future topology processing by splitting up massive boundaries
#  into multiple connected polylines (the "Florida Coastline" problem)
v.split in=gshhs_shoreline out=gshhs_shoreline_split1k vertices=1000

# Separate out land features from water features
v.extract in=gshhs_shoreline_split1k out=gshhs_landlines list=1
v.extract in=gshhs_shoreline_split1k out=gshhs_lakelines list=2
v.extract in=gshhs_shoreline_split1k out=gshhs_islandlines list=3
v.extract in=gshhs_shoreline_split1k out=gshhs_pondlines list=4

# Database of land and sea types no longer needed
v.db.droptable -f gshhs_landlines
v.db.droptable -f gshhs_lakelines
v.db.droptable -f gshhs_islandlines
v.db.droptable -f gshhs_pondlines

# Convert lines to boundaries
v.type in=gshhs_landlines out=gshhs_shoreboundary type=line,boundary
v.type in=gshhs_lakelines out=gshhs_lakeboundary type=line,boundary
v.type in=gshhs_islandlines out=gshhs_islandboundary type=line,boundary
v.type in=gshhs_pondlines out=gshhs_pondboundary type=line,boundary

# Convert boundaries to areas by adding centroids
v.centroids in=gshhs_shoreboundary out=gshhs_land option=add
v.centroids in=gshhs_lakeboundary out=gshhs_lakes option=add
v.centroids in=gshhs_islandboundary out=gshhs_islands option=add
v.centroids in=gshhs_pondboundary out=gshhs_ponds option=add

# Combine the land and water coverages into a single map, may take a long time
v.overlay ain=gshhs_land bin=gshhs_lakes atype=area btype=area \
   out=gshhs_land_with_lakes operator=not

v.overlay ain=gshhs_islands bin=gshhs_ponds atype=area btype=area \
   out=gshhs_islands_with_ponds operator=not

# Final step: add islands in lakes to mainlands
v.patch in=gshhs_land_with_lakes,gshhs_islands_with_ponds out=gshhs_all_land

# Cleanup temporary maps
g.remove vect=gshhs_shoreline_split1k,gshhs_landlines,gshhs_lakelines,\
gshhs_islandlines,gshhs_pondlines,gshhs_shoreboundary,gshhs_lakeboundary,\
gshhs_islandboundary,gshhs_pondboundary,gshhs_land,gshhs_lakes,\
gshhs_islands,gshhs_ponds,gshhs_land_with_lakes,gshhs_islands_with_ponds,\
gshhs_shoreline


# convert to raster, with each contiguous land mass as its own category
g.region n=29N s=7N w=87W e=58W res=0:02
v.to.rast in=gshhs_all_land out=gshhs.land type=area use=cat
r.colors gshhs.land color=random
At this point areas are categorized in order of shoreline length. Area cats 1 and 2 are Eurasia (2 is the part in the Western Hemisphere), area cat 3 is Africa, 4 is North America, 5 is South America, 6 is Australia, 7 is Greenland, and so on.

SEE ALSO

v.db.addtable, v.to.db, v.type,

REFERENCES

The processing and assembly of the GSHHS data is described in

Wessel, P., and W. H. F. Smith, 1996. A Global Self-consistent, Hierarchical, High-resolution Shoreline Database. J. Geophys. Res., 101(B4), 8741-8743.

AUTHORS

The gshhstograss tool was written by Simon Cox and Paul Wessel.
The original version of v.in.gshhs was written by Bob Covill based on gshhstograss.
Modifications and updates by Markus Neteler, Markus Metz, and Hamish Bowman.

Last changed: $Date$