|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.io.coverage.PropertyParser
org.geotools.coverage.io.PropertyParser
.
Helper class for creating OpenGIS's object from a set of properties. Properties are
key-value pairs, for example "Units=meters"
. There is a wide
variety of ways to contruct OpenGIS's objects from key-value pairs, and
supporting them is not always straightforward. The PropertyParser
class
try to make the work easier. It defines a set of format-neutral keys (i.e. keys not
related to any file format in particular). Before parsing a file, the mapping between
format-neutral keys and "real" keys used in a particuler file format must
be specified. This mapping is constructed with calls to addAlias(org.geotools.io.coverage.PropertyParser.Key, java.lang.String)
. For example,
one may want to parse the following informations:
Before to be used for parsing such informations, aXMinimum = 217904.31 YMaximum = 5663495.1 XResolution = 1000.0000 YResolution = 1000.0000 Units = meters Projection = Mercator_1SP Central meridian = -15.2167 Latitude of origin = 28.0667 False easting = 0.00000000 False northing = 0.00000000 Ellipsoid = Clarke 1866 Datum = Clarke 1866
PropertyParser
object
must be setup using the following code:
Once the mapping is etablished,addAlias(X_MINIMUM
, "XMinimum"); addAlias(Y_MAXIMUM
, "YMaximum"); addAlias(X_RESOLUTION
, "XResolution"); addAlias(Y_RESOLUTION
, "YResolution"); // etc...
PropertyParser
provides a set of
getXXX()
methods for constructing various objects from those informations.
For example, the getCoordinateSystem()
method constructs a
CoordinateSystem
object using available informations.
Nested Class Summary | |
static class |
PropertyParser.Key
Deprecated. A key for fetching property in a format independent way. |
Field Summary | |
static PropertyParser.Key |
CENTRAL_MERIDIAN
Deprecated. Key for the "central_meridian" projection parameter.
|
static PropertyParser.Key |
COORDINATE_SYSTEM_NAME
Deprecated. Optional Key for the coordinate system name. |
static PropertyParser.Key |
DATUM
Deprecated. Key for the coordinate system datum. |
static PropertyParser.Key |
DEPTH
Deprecated. Key for the image's "depth" in pixels. |
static PropertyParser.Key |
ELLIPSOID
Deprecated. Key for the coordinate system ellipsoid. |
static PropertyParser.Key |
FALSE_EASTING
Deprecated. Key for the "false_easting" projection parameter.
|
static PropertyParser.Key |
FALSE_NORTHING
Deprecated. Key for the "false_northing" projection parameter.
|
static PropertyParser.Key |
HEIGHT
Deprecated. Key for the image's height in pixels. |
static PropertyParser.Key |
LATITUDE_OF_ORIGIN
Deprecated. Key for the "latitude_of_origin" projection parameter.
|
static PropertyParser.Key |
PROJECTION
Deprecated. Key for the projection classification. |
static PropertyParser.Key |
PROJECTION_NAME
Deprecated. Optional key for the projection name. |
static PropertyParser.Key |
SEMI_MAJOR
Deprecated. Key for the "semi_major" projection parameter.
|
static PropertyParser.Key |
SEMI_MINOR
Deprecated. Key for the "semi_minor" projection parameter.
|
static PropertyParser.Key |
UNITS
Deprecated. Key for the coordinate system axis units. |
static PropertyParser.Key |
WIDTH
Deprecated. Key for the image's width in pixels. |
static PropertyParser.Key |
X_MAXIMUM
Deprecated. Key for the maximal x value (eastern limit). |
static PropertyParser.Key |
X_MINIMUM
Deprecated. Key for the minimal x value (western limit). |
static PropertyParser.Key |
X_RESOLUTION
Deprecated. Key for the resolution among the x axis. |
static PropertyParser.Key |
Y_MAXIMUM
Deprecated. Key for the maximal y value (northern limit). |
static PropertyParser.Key |
Y_MINIMUM
Deprecated. Key for the minimal y value (southern limit). |
static PropertyParser.Key |
Y_RESOLUTION
Deprecated. Key for the resolution among the y axis. |
static PropertyParser.Key |
Z_MAXIMUM
Deprecated. Key for the maximal z value. |
static PropertyParser.Key |
Z_MINIMUM
Deprecated. Key for the minimal z value. |
static PropertyParser.Key |
Z_RESOLUTION
Deprecated. Key for the resolution among the z axis. |
Constructor Summary | |
PropertyParser()
Deprecated. Construct a new PropertyParser using the default
CoordinateSystemFactory . |
|
PropertyParser(CoordinateSystemFactory factory)
Deprecated. Construct a new PropertyParser using the specified
CoordinateSystemFactory . |
Method Summary | |
void |
add(GridCoverage coverage)
Deprecated. Add all properties from the specified grid coverage. |
void |
add(javax.media.jai.PropertySource properties,
java.lang.String prefix)
Deprecated. Add properties from the specified property source. |
void |
add(java.awt.image.RenderedImage image)
Deprecated. Add all properties from the specified image. |
void |
add(java.lang.String alias,
java.lang.Object value)
Deprecated. Add a property for the specified key. |
void |
addAlias(PropertyParser.Key key,
java.lang.String alias)
Deprecated. Add an alias to a key. |
void |
clear()
Deprecated. Clear this property set. |
boolean |
contains(PropertyParser.Key key)
Deprecated. Check if this PropertyParser contains a value for the specified key.
|
java.lang.Object |
get(PropertyParser.Key key)
Deprecated. Returns the property for the specified key. |
java.lang.String[] |
getAlias(PropertyParser.Key key)
Deprecated. Returns the list of alias for the specified key, or null
if the key has no alias. |
java.util.Date |
getAsDate(PropertyParser.Key key)
Deprecated. Returns a property as a Date value. |
double |
getAsDouble(PropertyParser.Key key)
Deprecated. Returns a property as a double value. |
int |
getAsInt(PropertyParser.Key key)
Deprecated. Returns a property as a int value. |
CoordinateSystem |
getCoordinateSystem()
Deprecated. Returns the coordinate system. |
HorizontalDatum |
getDatum()
Deprecated. Returns the datum. |
Ellipsoid |
getEllipsoid()
Deprecated. Returns the ellipsoid. |
Envelope |
getEnvelope()
Deprecated. Returns the envelope. |
java.lang.String |
getFormatPattern(java.lang.Class type)
Deprecated. Returns the pattern used for parsing and formatting values of the specified type. |
Envelope |
getGeographicEnvelope()
Deprecated. Convenience method returning the envelope in geographic coordinate system using WGS 1984 datum. |
GridRange |
getGridRange()
Deprecated. Returns the grid range. |
java.util.Locale |
getLocale()
Deprecated. Returns the locale to use when parsing property values as numbers, angles or dates. |
Projection |
getProjection()
Deprecated. Returns the projection. |
SampleDimension[] |
getSampleDimensions()
Deprecated. Returns the sample dimensions for each band of the GridCoverage
to be read. |
java.lang.String |
getSeparator()
Deprecated. Returns the characters to use as separator between keys and values. |
java.lang.String |
getSource()
Deprecated. Returns the source file name or URL. |
Unit |
getUnits()
Deprecated. Returns the units. |
void |
listProperties(java.io.Writer out)
Deprecated. List all properties to the specified stream. |
protected void |
load(java.io.BufferedReader in)
Deprecated. Read all properties from a stream. |
void |
load(java.io.File header)
Deprecated. Read all properties from a text file. |
void |
load(java.net.URL header)
Deprecated. Read all properties from an URL. |
protected boolean |
parseLine(java.lang.String line)
Deprecated. Parse a line and add the key-value pair to this property set. |
void |
setFormatPattern(java.lang.Class type,
java.lang.String pattern)
Deprecated. Set the pattern to use for parsing and formatting values of the specified type. |
void |
setSeparator(java.lang.String separator)
Deprecated. Set the characters to use as separator between keys and values. |
java.lang.String |
toString()
Deprecated. Returns a string representation of this properties set. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final PropertyParser.Key UNITS
getUnits()
method looks for this property.
Its return value is used by getCoordinateSystem()
as below:
Unit.DEGREE
, then
getCoordinateSystem()
will usually returns a
GeographicCoordinateSystem
.Unit.METRE
, then
getCoordinateSystem()
will usually returns a
ProjectedCoordinateSystem
.
DATUM
,
ELLIPSOID
,
PROJECTION
public static final PropertyParser.Key DATUM
getDatum()
method looks for this property.
Its return value is used by getCoordinateSystem()
.
UNITS
,
ELLIPSOID
,
PROJECTION
public static final PropertyParser.Key ELLIPSOID
getEllipsoid()
method looks for this property.
Its return value is used by getProjection()
.
UNITS
,
DATUM
,
PROJECTION
public static final PropertyParser.Key PROJECTION
CoordinateSystemFactory.createProjection(...)
. The getProjection()
method
looks for this property. Its return value is used by getCoordinateSystem()
.
SEMI_MAJOR
,
SEMI_MINOR
,
LATITUDE_OF_ORIGIN
,
CENTRAL_MERIDIAN
,
FALSE_EASTING
,
FALSE_NORTHING
public static final PropertyParser.Key PROJECTION_NAME
getProjection()
method looks for
this property, if presents. The projection name is used for documentation purpose
only. If it is not defined, then the projection name will be the same than the
classification name.
PROJECTION
,
COORDINATE_SYSTEM_NAME
public static final PropertyParser.Key COORDINATE_SYSTEM_NAME
getCoordinateSystem()
method looks for this property.
PROJECTION_NAME
public static final PropertyParser.Key SEMI_MAJOR
"semi_major"
projection parameter.
There is no specific method for this key. However, this
key may be queried indirectly by getProjection()
.
SEMI_MINOR
,
LATITUDE_OF_ORIGIN
,
CENTRAL_MERIDIAN
,
FALSE_EASTING
,
FALSE_NORTHING
,
PROJECTION
public static final PropertyParser.Key SEMI_MINOR
"semi_minor"
projection parameter.
There is no specific method for this key. However, this
key may be queried indirectly by getProjection()
.
SEMI_MAJOR
,
LATITUDE_OF_ORIGIN
,
CENTRAL_MERIDIAN
,
FALSE_EASTING
,
FALSE_NORTHING
,
PROJECTION
public static final PropertyParser.Key LATITUDE_OF_ORIGIN
"latitude_of_origin"
projection parameter.
There is no specific method for this key. However, this
key may be queried indirectly by getProjection()
.
SEMI_MAJOR
,
SEMI_MINOR
,
CENTRAL_MERIDIAN
,
FALSE_EASTING
,
FALSE_NORTHING
,
PROJECTION
public static final PropertyParser.Key CENTRAL_MERIDIAN
"central_meridian"
projection parameter.
There is no specific method for this key. However, this
key may be queried indirectly by getProjection()
.
SEMI_MAJOR
,
SEMI_MINOR
,
LATITUDE_OF_ORIGIN
,
FALSE_EASTING
,
FALSE_NORTHING
,
PROJECTION
public static final PropertyParser.Key FALSE_EASTING
"false_easting"
projection parameter.
There is no specific method for this key. However, this
key may be queried indirectly by getProjection()
.
SEMI_MAJOR
,
SEMI_MINOR
,
LATITUDE_OF_ORIGIN
,
CENTRAL_MERIDIAN
,
FALSE_NORTHING
,
PROJECTION
public static final PropertyParser.Key FALSE_NORTHING
"false_northing"
projection parameter.
There is no specific method for this key. However, this
key may be queried indirectly by getProjection()
.
SEMI_MAJOR
,
SEMI_MINOR
,
LATITUDE_OF_ORIGIN
,
CENTRAL_MERIDIAN
,
FALSE_EASTING
,
PROJECTION
public static final PropertyParser.Key X_MINIMUM
getEnvelope()
method looks for this property in order to set the
minimal coordinate for dimension
0.
X_MAXIMUM
,
Y_MINIMUM
,
Y_MAXIMUM
,
X_RESOLUTION
,
Y_RESOLUTION
public static final PropertyParser.Key Y_MINIMUM
getEnvelope()
method looks for this property. in order to set the
minimal coordinate for dimension
1.
X_MINIMUM
,
X_MAXIMUM
,
Y_MAXIMUM
,
X_RESOLUTION
,
Y_RESOLUTION
public static final PropertyParser.Key Z_MINIMUM
getEnvelope()
method looks for this property in order to set the
minimal coordinate for dimension
2.
Z_MAXIMUM
,
Z_RESOLUTION
,
DEPTH
public static final PropertyParser.Key X_MAXIMUM
getEnvelope()
method looks for this property in order to set the
maximal coordinate for dimension
0.
X_MINIMUM
,
Y_MINIMUM
,
Y_MAXIMUM
,
X_RESOLUTION
,
Y_RESOLUTION
public static final PropertyParser.Key Y_MAXIMUM
getEnvelope()
method looks for this property in order to set the
maximal coordinate for dimension
1.
X_MINIMUM
,
X_MAXIMUM
,
Y_MINIMUM
,
X_RESOLUTION
,
Y_RESOLUTION
public static final PropertyParser.Key Z_MAXIMUM
getEnvelope()
method looks for this property in order to set the
maximal coordinate for dimension
2.
Z_MINIMUM
,
Z_RESOLUTION
,
DEPTH
public static final PropertyParser.Key X_RESOLUTION
getEnvelope()
method looks for this property in
order to infer the coordinates for dimension 0.
X_MINIMUM
,
X_MAXIMUM
,
Y_MINIMUM
,
Y_MAXIMUM
,
Y_RESOLUTION
public static final PropertyParser.Key Y_RESOLUTION
getEnvelope()
method looks for this property in
order to infer the coordinates for dimension 1.
X_MINIMUM
,
X_MAXIMUM
,
Y_MINIMUM
,
Y_MAXIMUM
,
X_RESOLUTION
,
WIDTH
,
HEIGHT
public static final PropertyParser.Key Z_RESOLUTION
getEnvelope()
method looks for this property in
order to infer the coordinates for dimension 2.
Z_MINIMUM
,
Z_MAXIMUM
,
DEPTH
public static final PropertyParser.Key WIDTH
getGridRange()
method looks for this property in order to infer the
grid size along the dimension
0.
HEIGHT
,
X_RESOLUTION
,
Y_RESOLUTION
public static final PropertyParser.Key HEIGHT
getGridRange()
method looks for this property in order to infer the
grid size along the dimension
1.
WIDTH
,
X_RESOLUTION
,
Y_RESOLUTION
public static final PropertyParser.Key DEPTH
getGridRange()
method looks for this property in order to infer the
grid size along the dimension
2.
Z_MINIMUM
,
Z_MAXIMUM
,
Z_RESOLUTION
Constructor Detail |
public PropertyParser()
PropertyParser
using the default
CoordinateSystemFactory
.
public PropertyParser(CoordinateSystemFactory factory)
PropertyParser
using the specified
CoordinateSystemFactory
.
Method Detail |
public java.lang.String getSeparator()
listProperties(java.io.Writer)
, but will be ignored
when parsing with parseLine(java.lang.String)
. The default value is " = "
.
public void setSeparator(java.lang.String separator)
public java.lang.String getFormatPattern(java.lang.Class type)
Number.class
or Date.class
.
if type
is assignable to Number.class
, then this method
returns the number pattern as specified by DecimalFormat
.
Otherwise, if type
is assignable to Date.class
, then this
method returns the date pattern as specified by SimpleDateFormat
.
In any case, this method returns null
if this object should use the default
pattern for the data locale.
type
- The data type (Number.class
or Date.class
).
null
for
the default locale-dependent pattern.
IllegalArgumentException
- if type
is not valid.public void setFormatPattern(java.lang.Class type, java.lang.String pattern)
Number.class
or Date.class
.
type
is assignable to Number.class
,
then pattern
should be a DecimalFormat
pattern (example:
"#0.###"
).type
is assignable to Date.class
,
then pattern
should be a SimpleDateFormat
pattern
(example: "yyyy/MM/dd HH:mm"
).
type
- The data type (Number.class
or Date.class
).pattern
- The format pattern for the specified data type, or null
for the default locale-dependent pattern.
IllegalArgumentException
- if type
is not valid.public void clear()
PropertyParser
object is used for parsing many files, then clear()
should be invoked prior any load(...)
method. Note
that clear()
do not remove any alias, so this PropertyParser
can been immediately reused for parsing new files of the same kind.
public void load(java.io.File header) throws java.io.IOException
load(BufferedReader)
. Note that this method do not invokes clear()
prior the loading. Consequently, the loaded properties will be added to the set of
existing properties.
header
- The file to read until EOF.
IOException
- if an error occurs during loading.clear()
,
load(URL)
,
parseLine(java.lang.String)
,
getSource()
public void load(java.net.URL header) throws java.io.IOException
load(BufferedReader)
. Note that this method do not invokes clear()
prior the loading. Consequently, the loaded properties will be added to the set of
existing properties.
header
- The URL to read until EOF.
IOException
- if an error occurs during loading.clear()
,
load(File)
,
parseLine(java.lang.String)
,
getSource()
protected void load(java.io.BufferedReader in) throws java.io.IOException
parseLine(java.lang.String)
for each non-empty line found in the stream. Notes:
source
property.clear()
prior the loading.
in
- The stream to read until EOF. The stream will not be closed.
IOException
- if an error occurs during loading.clear()
,
load(File)
,
load(URL)
,
parseLine(java.lang.String)
protected boolean parseLine(java.lang.String line) throws javax.imageio.IIOException
line
has the following value:
Then, the default implementation will translate this line in the following call:Ellipsoid = WGS 1984
This method returnsadd
("Ellipsoid", "WGS 1984");
true
if it has consumed the line, or
false
otherwise. A line is "consumed" if parseLine
has either added the key-value pair (using add(org.geotools.gc.GridCoverage)
), or determined
that the line must be ignored (for example because parseLine
detected a character announcing a comment line). A "consumed" line will
not receive any further treatment. The line is not consumed (i.e. this
method returns false
) if parseLine
don't know
what to do with it. Non-consumed line will typically go up in a chain of
parseLine
methods (if PropertyParser
has been
subclassed) until someone consume it.
line
- The line to parse.
true
if this method has consumed the line.
IIOException
- if the line is badly formatted.
AmbiguousPropertyException
- if a different value was
already defined for the same property name.load(File)
,
load(URL)
,
add(String,Object)
public void add(GridCoverage coverage) throws AmbiguousPropertyException
listProperties(java.io.Writer)
as a way to format the properties for an arbitrary
grid coverage. The default implementation performs the following step:
key
declared with
addAlias(key, alias)
, fetchs
a value with key.{linkplain Key#getValue getValue}(coverage)
.key
.
coverage
- The grid coverage with properties to add to this PropertyParser
.
AmbiguousPropertyException
- if a property is defined twice.add(RenderedImage)
,
add(PropertySource,String)
,
add(String,Object)
,
listProperties(java.io.Writer)
public void add(java.awt.image.RenderedImage image) throws AmbiguousPropertyException
image
- The image with properties to add to this PropertyParser
.
AmbiguousPropertyException
- if a property is defined twice.add(GridCoverage)
,
add(PropertySource,String)
,
add(String,Object)
public void add(javax.media.jai.PropertySource properties, java.lang.String prefix) throws AmbiguousPropertyException
properties
- The properties source.prefix
- The prefix for properties to add, of null
to add
all properties. If non-null, only properties begining with this prefix
will be added.
AmbiguousPropertyException
- if a property is defined twice.add(GridCoverage)
,
add(RenderedImage)
,
add(String,Object)
public void add(java.lang.String alias, java.lang.Object value) throws AmbiguousPropertyException
'_'
character.
alias
- The key for the property to add. This is usually the name found in the
file to be parsed (this is different from PropertyParser.Key
objects, which are keys
in a format neutral way). This key is usually, but not always, one of the alias
defined with addAlias(org.geotools.io.coverage.PropertyParser.Key, java.lang.String)
.value
- The value for the property to add. If null
or
Image.UndefinedProperty
, then this method do nothing.
AmbiguousPropertyException
- if a different value already exists for the specified
alias, or for an other alias bound to the same PropertyParser.Key
.add(GridCoverage)
,
add(RenderedImage)
,
add(PropertySource,String)
,
parseLine(java.lang.String)
public void addAlias(PropertyParser.Key key, java.lang.String alias) throws AmbiguousPropertyException
get
(key)
will really looks for property
named alias
. Alias are mandatory in order to get various
getXXX()
methods to work for a particular file format.
For example if the file to be parsed uses the names "ULX"
and "ULY"
for the coordinate of the upper left corner,
then the getEnvelope()
method will not work unless the following
alias are set:
An arbitrary number of alias can be set for the same key. For example,addAlias(X_MINIMUM
, "ULX"); addAlias(Y_MAXIMUM
, "ULY");
addAlias(Y_MAXIMUM, ...)
could be invoked twice with
"ULY"
and "Limit North"
alias. The getXXX()
methods will try alias in the order they were added and use the first
value found.
addAlias(X_RESOLUTION
, "Resolution"); addAlias(Y_RESOLUTION
, "Resolution");
key
- The key to add an alias. This key is format neutral.alias
- The alias to add. This is the name actually used in the file to be parsed.
Alias are case insensitive and ignore multiple whitespace, like keys. If
this alias is already bound to the specified key, then this method do nothing.
AmbiguousPropertyException
- if the addition of the supplied alias
would introduce an ambiguity in the current set of properties.
This occurs if the key has already an alias mapping to a different value.getAlias(org.geotools.io.coverage.PropertyParser.Key)
,
contains(org.geotools.io.coverage.PropertyParser.Key)
,
get(org.geotools.io.coverage.PropertyParser.Key)
public boolean contains(PropertyParser.Key key)
PropertyParser
contains a value for the specified key.
Invoking get(org.geotools.io.coverage.PropertyParser.Key)
will thrown a MissingPropertyException
if and only
if contains(org.geotools.io.coverage.PropertyParser.Key)
returns false
for the same key.
key
- The key to test for inclusion in this PropertyParser
.
true
if the given key was found.get(org.geotools.io.coverage.PropertyParser.Key)
,
addAlias(org.geotools.io.coverage.PropertyParser.Key, java.lang.String)
public java.lang.Object get(PropertyParser.Key key) throws MissingPropertyException
PropertyParser.Key
argument. In order to maps the key to the actual name used in
the underlying metadata file, the method addAlias(org.geotools.io.coverage.PropertyParser.Key, java.lang.String)
must have
been invoked prior to any get
method.
key
- The key of the desired property. Keys are case insensitive and format neutral.
null
).
MissingPropertyException
- if no value exists for the specified key.getAsDouble(org.geotools.io.coverage.PropertyParser.Key)
,
getAsInt(org.geotools.io.coverage.PropertyParser.Key)
,
contains(org.geotools.io.coverage.PropertyParser.Key)
,
addAlias(org.geotools.io.coverage.PropertyParser.Key, java.lang.String)
public double getAsDouble(PropertyParser.Key key) throws PropertyException
double
value. The default implementation
invokes get
(key)
and parse the resulting value with
NumberFormat.parse(String)
for the current locale.
key
- The key of the desired property. Keys are case-insensitive.
double
.
MissingPropertyException
- if no value exists for the specified key.
PropertyException
- if the value can't be parsed as a double
.getAsInt(org.geotools.io.coverage.PropertyParser.Key)
,
get(org.geotools.io.coverage.PropertyParser.Key)
,
contains(org.geotools.io.coverage.PropertyParser.Key)
,
addAlias(org.geotools.io.coverage.PropertyParser.Key, java.lang.String)
public int getAsInt(PropertyParser.Key key) throws PropertyException
int
value. The default implementation
invokes getAsDouble
(key)
and make sure
that the resulting value is an integer.
key
- The key of the desired property. Keys are case-insensitive.
int
.
MissingPropertyException
- if no value exists for the specified key.
PropertyException
- if the value can't be parsed as an int
.getAsDouble(org.geotools.io.coverage.PropertyParser.Key)
,
get(org.geotools.io.coverage.PropertyParser.Key)
,
contains(org.geotools.io.coverage.PropertyParser.Key)
,
addAlias(org.geotools.io.coverage.PropertyParser.Key, java.lang.String)
public java.util.Date getAsDate(PropertyParser.Key key) throws PropertyException
Date
value. The default implementation
invokes get
(key)
and parse the resulting value with
DateFormat.parse(String)
for the current locale.
key
- The key of the desired property. Keys are case-insensitive.
Date
.
MissingPropertyException
- if no value exists for the specified key.
PropertyException
- if the value can't be parsed as a date.public java.lang.String[] getAlias(PropertyParser.Key key)
null
if the key has no alias. Alias are the names used in the underlying
metadata file, and are format dependent.
key
- The format neutral key.
null
if none.addAlias(org.geotools.io.coverage.PropertyParser.Key, java.lang.String)
public java.lang.String getSource() throws PropertyException
load(...)
method.
PropertyException
- if this information can't be fetched.public java.util.Locale getLocale() throws PropertyException
Locale.US
, since it is the format used
in most data file.
PropertyException
- if this information can't be fetched.getAsDouble(org.geotools.io.coverage.PropertyParser.Key)
,
getAsInt(org.geotools.io.coverage.PropertyParser.Key)
,
getAsDate(org.geotools.io.coverage.PropertyParser.Key)
public Unit getUnits() throws PropertyException
get(UNITS)
and transform the resulting string into an Unit
object.
MissingPropertyException
- if no value exists for the UNITS
key.
PropertyException
- if the operation failed for some other reason.getCoordinateSystem()
public HorizontalDatum getDatum() throws PropertyException
get(DATUM)
and transform the resulting string into a HorizontalDatum
object.
MissingPropertyException
- if no value exists for the DATUM
key.
PropertyException
- if the operation failed for some other reason.getCoordinateSystem()
,
getEllipsoid()
public Ellipsoid getEllipsoid() throws PropertyException
get(ELLIPSOID)
and transform the resulting string into an Ellipsoid
object.
MissingPropertyException
- if no value exists for the ELLIPSOID
key.
PropertyException
- if the operation failed for some other reason.getCoordinateSystem()
,
getDatum()
public Projection getProjection() throws PropertyException
get(PROJECTION)
.createProjectionParameterList(classification)
.ParameterList
.
If a parameter is not defined in this PropertyParser
, then it will
be left to its (projection dependent) default value. Parameters are projection
dependent, but will typically include
"semi_major"
,
"semi_minor"
,
"central_meridian"
,
"latitude_of_origin"
,
"false_easting"
and
"false_northing"
.
The names actually used in the metadata file to be parsed must be declared as usual,
e.g. addAlias(SEMI_MAJOR, ...)
"semi-major"
and/or "semi-minor"
parameters, then invokes getEllipsoid()
and uses its semi-axis length.PROJECTION_NAME
, then takes it as
the projection name. The projection name is for documentation purpose only and do
not affect any computation. If there is no value for PROJECTION_NAME
, then
the projection name will be the same than the classification name (the first step
above).
null
if the underlying coordinate
system is not a ProjectedCoordinateSystem
.
MissingPropertyException
- if no value exists for the PROJECTION
key.
PropertyException
- if the operation failed for some other reason
(for example if a parameter value can't be parsed as a double
).getCoordinateSystem()
,
SEMI_MAJOR
,
SEMI_MINOR
,
LATITUDE_OF_ORIGIN
,
CENTRAL_MERIDIAN
,
FALSE_EASTING
,
FALSE_NORTHING
public CoordinateSystem getCoordinateSystem() throws PropertyException
getUnits()
, getDatum()
and
getProjection()
. The coordinate system name (optional) will be fetch from
property COORDINATE_SYSTEM_NAME
, if presents.
MissingPropertyException
- if a required value is missing
(e.g. PROJECTION
, DATUM
, UNITS
, etc.).
PropertyException
- if the operation failed for some other reason.getUnits()
,
getDatum()
,
getProjection()
public Envelope getGeographicEnvelope() throws PropertyException
PropertyException
- if the operation failed. This exception
may contains a TransformException
as its cause.getEnvelope()
,
getGridRange()
public Envelope getEnvelope() throws PropertyException
Envelope
object using the values from the following keys:
X_MINIMUM
and/or X_MAXIMUM
. If one of those
keys is missing, then X_RESOLUTION
is required.Y_MINIMUM
and/or Y_MAXIMUM
. If one of those
keys is missing, then Y_RESOLUTION
is required.
MissingPropertyException
- if a required value is missing.
PropertyException
- if the operation failed for some other reason.getGridRange()
,
getGeographicEnvelope()
public GridRange getGridRange() throws PropertyException
WIDTH
and HEIGHT
, and transform the resulting
strings into a GridRange
object.
MissingPropertyException
- if a required value is missing.
PropertyException
- if the operation failed for some other reason.getEnvelope()
,
getGeographicEnvelope()
public SampleDimension[] getSampleDimensions() throws PropertyException
GridCoverage
to be read. If sample dimensions are not know, then this method returns
null
. The default implementation always returns null
.
PropertyException
- if the operation failed.public void listProperties(java.io.Writer out) throws java.io.IOException
'='
is inserted between keys and values.
A question mark ('?'
) is put in front of any unknow name (i.e. any name
not specified with addAlias(org.geotools.io.coverage.PropertyParser.Key, java.lang.String)
).
out
- Stream to write properties to.
IOException
- if an error occured while listing properties.add(GridCoverage)
,
toString()
public java.lang.String toString()
getGeographicEnvelope()
. Then, it append the list of all properties as formatted
by listProperties(java.io.Writer)
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |