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.@Deprecated public class GSHHSReader extends LineFeatureSource
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.
Modifier and Type | Class and Description |
---|---|
class |
GSHHSReader.PolygonHeader
Deprecated.
The GSHHS polygon header class acts as a container for the GSHHS
reader class polygon header values.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CRUDE
Deprecated.
Crude resolution (25 km) database.
|
static int |
DEFAULT_CACHE_SIZE
Deprecated.
The default polygon cache size in bytes.
|
static java.lang.String |
HIGH
Deprecated.
High resolution (0.2 km) database.
|
static java.lang.String |
INTER
Deprecated.
Intermediate resolution (1.0 km) database.
|
static java.lang.String |
LOW
Deprecated.
Low resolution (5.0 km) database.
|
area, featureList
Constructor and Description |
---|
GSHHSReader(double resolution)
Deprecated.
Creates a new GSHHS reader instance from the resolution.
|
GSHHSReader(java.io.File file)
Deprecated.
Creates a new GSHHS reader from the data file.
|
GSHHSReader(java.io.InputStream stream)
Deprecated.
Creates a new GSHHS reader from the input stream.
|
GSHHSReader(java.lang.String name)
Deprecated.
Creates a new GSHHS reader instance from the database name.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDatabase()
Deprecated.
Gets the database name currently being used for selection.
|
static java.lang.String |
getDatabase(double resolution)
Deprecated.
Gets the predefined database name with resolution closest to
the specified resolution.
|
GSHHSReader.PolygonHeader |
readHeader(java.io.DataInput in)
Deprecated.
Reads a polygon header from the specified input.
|
LineFeature |
readPolygon(GSHHSReader.PolygonHeader header,
java.io.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.
|
render
getArea, getAttributeCount, getAttributeNameMap, getAttributes, getFilter, iterator, select, setAttributes, setFilter
public static final java.lang.String HIGH
public static final java.lang.String INTER
public static final java.lang.String LOW
public static final java.lang.String CRUDE
public static final int DEFAULT_CACHE_SIZE
public GSHHSReader(java.lang.String name)
name
- the database name. Several predefined database
names are available using the constants HIGH
,
INTER
, LOW
, and CRUDE
.
See the constants for descriptions of the database resolutions.public GSHHSReader(double resolution)
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.public GSHHSReader(java.io.File file) throws java.io.IOException
file
- the data file to read.java.io.IOException
- if the file had input errors.public GSHHSReader(java.io.InputStream stream) throws java.io.IOException
stream
- the input stream to read.java.io.IOException
- if the stream had input errors.public static void setCacheSize(int cacheSize)
cacheSize
- the cache size in bytes.public void setMinArea(double minArea)
minArea
- the minimum area in km^2.protected void select() throws java.io.IOException
AbstractFeatureSource
select
in class AbstractFeatureSource
java.io.IOException
- if an error occurred accessing the data source.public GSHHSReader.PolygonHeader readHeader(java.io.DataInput in) throws java.io.IOException
in
- the data input. The header is constructed by reading
at the current input position.java.io.IOException
- if an error occurred reading the data file.public LineFeature readPolygon(GSHHSReader.PolygonHeader header, java.io.DataInput in) throws java.io.IOException
header
- the polygon header from the last call to readHeader(java.io.DataInput)
.in
- the data input. The polygon is constructed by reading
at the current input position.java.io.IOException
- if an error occurred reading the data file.public java.lang.String getDatabase()
public static java.lang.String getDatabase(double resolution)
resolution
- the image resolution in km/pixel.