Class GSHHSReader
- All Implemented Interfaces:
Iterable<Feature>
,FeatureSource
The GSHHS reader class reads Global Self-consistent Hierarchical High-resolution Shorelines (GSHHS) binary data files. GSHHS is distributed as a set of data files and routines that provide worldwide vector coastline data in a closed polygon format. GSHHS is descibed in:
Wessel, P., and W. H. F. Smith, 1996, A global self-consistent, hierarchical, high-resolution shoreline database, J. Geophys. Res., 101, 8741-8743.
and is available from:
http://www.ngdc.noaa.gov/mgg/shorelines/gshhs.html
The GSHHS reader can read GSHHS data files either from a set of
predefined resource data files or from a user supplied data file.
The predefined resources have been passed through a precomputation
routine that creates an index of the files based on a 1x1 degree
global grid. If the GSHHS reader is created from one of the
predefined resource files, the precomputed index file allows for
quick selection of polygons via the select()
routine. If
the GSHHS reader is created from a user file, the entire set of
GSHHS polygons is read into memory and the selection method
performs no operation.
- Since:
- 3.1.0
- Author:
- Peter Hollemans
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Deprecated.The GSHHS polygon header class acts as a container for the GSHHS reader class polygon header values. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Deprecated.Crude resolution (25 km) database.static final int
Deprecated.The default polygon cache size in bytes.static final String
Deprecated.High resolution (0.2 km) database.static final String
Deprecated.Intermediate resolution (1.0 km) database.static final String
Deprecated.Low resolution (5.0 km) database.Fields inherited from class noaa.coastwatch.render.feature.AbstractFeatureSource
area, featureList
-
Constructor Summary
ConstructorDescriptionGSHHSReader
(double resolution) Deprecated.Creates a new GSHHS reader instance from the resolution.GSHHSReader
(File file) Deprecated.Creates a new GSHHS reader from the data file.GSHHSReader
(InputStream stream) Deprecated.Creates a new GSHHS reader from the input stream.GSHHSReader
(String name) Deprecated.Creates a new GSHHS reader instance from the database name. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Gets the database name currently being used for selection.static String
getDatabase
(double resolution) Deprecated.Gets the predefined database name with resolution closest to the specified resolution.readHeader
(DataInput in) Deprecated.Reads a polygon header from the specified input.readPolygon
(GSHHSReader.PolygonHeader header, DataInput in) Deprecated.Reads a polygon from the specified input.protected void
select()
Deprecated.Selects a set of features from the data source based on the current area.static void
setCacheSize
(int cacheSize) Deprecated.Sets the polygon cache size.void
setMinArea
(double minArea) Deprecated.Sets the minimum area used in polygon selection.Methods inherited from class noaa.coastwatch.render.feature.LineFeatureSource
render
Methods inherited from class noaa.coastwatch.render.feature.AbstractFeatureSource
getArea, getAttributeCount, getAttributeNameMap, getAttributes, getFilter, iterator, select, setAttributes, setFilter
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
HIGH
Deprecated.High resolution (0.2 km) database.- See Also:
-
INTER
Deprecated.Intermediate resolution (1.0 km) database.- See Also:
-
LOW
Deprecated.Low resolution (5.0 km) database.- See Also:
-
CRUDE
Deprecated.Crude resolution (25 km) database.- See Also:
-
DEFAULT_CACHE_SIZE
public static final int DEFAULT_CACHE_SIZEDeprecated.The default polygon cache size in bytes.- See Also:
-
-
Constructor Details
-
GSHHSReader
Deprecated.Creates a new GSHHS reader instance from the database name. By default, there is no minimum area for polygon selection and no polygons are selected.- Parameters:
name
- the database name. Several predefined database names are available using the constantsHIGH
,INTER
,LOW
, andCRUDE
. See the constants for descriptions of the database resolutions.
-
GSHHSReader
public GSHHSReader(double resolution) Deprecated.Creates a new GSHHS reader instance from the resolution. By default, there is no minimum area for polygon selection and no polygons are selected.- Parameters:
resolution
- the pixel resolution in kilometers. The resolution determines the tolerance level used to decimate polygons from the full resolution database. Resolution values should reflect the desired accuracy of coastline rendering. For example, if the coastlines are to be rendered on an image where each pixel measures 5 km across, the polygons need not include features any smaller than 5 km. The resolution is used to determine the appropriate predefined database.
-
GSHHSReader
Deprecated.Creates a new GSHHS reader from the data file. With this constructor, all polygons are selected and the selection method performs no operation.- Parameters:
file
- the data file to read.- Throws:
IOException
- if the file had input errors.
-
GSHHSReader
Deprecated.Creates a new GSHHS reader from the input stream. With this constructor, all polygons are selected and the selection method performs no operation.- Parameters:
stream
- the input stream to read.- Throws:
IOException
- if the stream had input errors.
-
-
Method Details
-
setCacheSize
public static void setCacheSize(int cacheSize) Deprecated.Sets the polygon cache size. The cache size is measured in terms of the number of polygon earth location points.- Parameters:
cacheSize
- the cache size in bytes.
-
setMinArea
public void setMinArea(double minArea) Deprecated.Sets the minimum area used in polygon selection. Polygons less than the minimum area are not included.- Parameters:
minArea
- the minimum area in km^2.
-
select
Deprecated.Description copied from class:AbstractFeatureSource
Selects a set of features from the data source based on the current area.- Specified by:
select
in classAbstractFeatureSource
- Throws:
IOException
- if an error occurred accessing the data source.
-
readHeader
Deprecated.Reads a polygon header from the specified input.- Parameters:
in
- the data input. The header is constructed by reading at the current input position.- Returns:
- the GSHHS polygon header read.
- Throws:
IOException
- if an error occurred reading the data file.
-
readPolygon
Deprecated.Reads a polygon from the specified input.- Parameters:
header
- the polygon header from the last call toreadHeader(java.io.DataInput)
.in
- the data input. The polygon is constructed by reading at the current input position.- Returns:
- a new polygon as a vector of earth locations.
- Throws:
IOException
- if an error occurred reading the data file.
-
getDatabase
Deprecated.Gets the database name currently being used for selection. -
getDatabase
Deprecated.Gets the predefined database name with resolution closest to the specified resolution. If the resolution is invalid, the crude resolution database is returned.- Parameters:
resolution
- the image resolution in km/pixel.- Returns:
- the GSHHS database name.
-
BinnedGSHHSReader
which provides better overall performance. This class uses the full GSHHS binary data files as input, with a supplementary index file to speed up polygon access. The new binned class uses true binned GSHHS polygon data in HDF format with access routines and polygon assembly methods. The new class uses a reduced data file size and is faster at handling small sections of polygons with a large number of points outside the area of interest.