|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.coverage.io.MetadataReader
public class MetadataReader
Helper class for creating OpenGIS's object from a set of metadata.
Metadata are already stored into a geographic metadata object, which provides a representation of these metadata as a tree, trying to respect the GML in JPEG 2000 standard.
It provides a set of getXXX()
methods for constructing various objects from
those information. For example, the getCoordinateReferenceSystem()
method
constructs a CoordinateReferenceSystem
object using available information.
Constructor Summary | |
---|---|
MetadataReader()
Constructs a new MetadataReader using default factories and geographic
metadata. |
|
MetadataReader(ReferencingFactoryContainer factories)
Constructs a new MetadataReader using the specified factories. |
Method Summary | |
---|---|
org.opengis.referencing.cs.CoordinateSystemAxis |
getAxis(int dimension)
Constructs an axis using the information from the metadata, or returns null if the axis
does not exist in the metadata tree. |
org.opengis.referencing.crs.CoordinateReferenceSystem |
getCoordinateReferenceSystem()
Returns the coordinate reference system. |
org.opengis.referencing.cs.CoordinateSystem |
getCoordinateSystem()
Returns the coordinate system. |
org.opengis.referencing.datum.Datum |
getDatum()
Returns the datum. |
org.opengis.referencing.datum.Ellipsoid |
getEllipsoid()
Returns the ellipsoid. |
org.opengis.geometry.Envelope |
getEnvelope()
Returns the envelope. |
org.opengis.metadata.extent.GeographicBoundingBox |
getGeographicBoundingBox()
Convenience method returning the envelope in geographic coordinate reference system. |
GeographicMetadata |
getGeographicMetadata()
Returns the current geographic metadata, or null if not already defined. |
org.opengis.coverage.grid.GridEnvelope |
getGridRange()
Returns the grid range. |
org.opengis.referencing.operation.Conversion |
getProjection()
Returns the projection. |
void |
setGeographicMetadata(GeographicMetadata metadata)
Sets the current geographic metadata. |
java.lang.String |
toString()
Returns a string representation of this metadata set. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MetadataReader()
MetadataReader
using default factories and geographic
metadata. Do not forget to call setGeographicMetadata(GeographicMetadata)
in order to fix the metadata value.
public MetadataReader(ReferencingFactoryContainer factories)
MetadataReader
using the specified factories. Do not
forget to call setGeographicMetadata(org.geotools.image.io.metadata.GeographicMetadata)
in order to
fix the metadata value.
factories
- The specified factories. Should not be null
.Method Detail |
---|
public org.opengis.referencing.cs.CoordinateSystemAxis getAxis(int dimension) throws MetadataException
null
if the axis
does not exist in the metadata tree.
dimension
- The dimension to consider. It should be lower than
ImageGeometry.getDimension()
null
if the axis
does not exist for the specified dimension.
MetadataException
- if the method CSFactory.createCoordinateSystemAxis(java.util.Map, java.lang.String, org.opengis.referencing.cs.AxisDirection, javax.measure.unit.Unit>)
has not succeed.public org.opengis.referencing.datum.Datum getDatum() throws MetadataException
WGS84
, and returns a
DefaultGeodeticDatum.WGS84
geodetic datum if it is the case.
MetadataException
- if the datum is not defined, or if the getEllipsoid()
method fails.getEllipsoid()
public org.opengis.referencing.datum.Ellipsoid getEllipsoid() throws MetadataException
ImageReferencing.semiMinorAxis
or ImageReferencing.inverseFlattening
has been defined, the default
implementation will construct an ellispoid using DatumFactory.createEllipsoid(java.util.Map, double, double, javax.measure.unit.Unit)
or DatumFactory.createFlattenedSphere(java.util.Map, double, double, javax.measure.unit.Unit)
respectively.
MetadataException
- if the operation failed to create the
ellipsoid.getUnit(String)
public org.opengis.referencing.operation.Conversion getProjection() throws MetadataException
MathTransformFactory
MetadataReader
, then it will be left to its (projection
dependent) default value. Parameters are projection dependent, but will typically
include
"semi_major"
,
"semi_minor"
(or "inverse_flattening"
),
"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
(TextMetadataParser.SEMI_MAJOR, ...)
MetadataException
- if the operation failed for some other reason
(for example if a parameter value can't be parsed as a double
).TextMetadataParser.SEMI_MAJOR
,
TextMetadataParser.SEMI_MINOR
,
TextMetadataParser.INVERSE_FLATTENING
,
TextMetadataParser.LATITUDE_OF_ORIGIN
,
TextMetadataParser.CENTRAL_MERIDIAN
,
TextMetadataParser.FALSE_EASTING
,
TextMetadataParser.FALSE_NORTHING
public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem() throws MetadataException
MetadataException
- if the creation of the coordinate reference system fails.getDatum()
,
getCoordinateSystem()
,
CoordinateReferenceSystem
public org.opengis.referencing.cs.CoordinateSystem getCoordinateSystem() throws MetadataException
MetadataException
- if there is less than 2 axes defined in the metadata, or if
the creation of the coordinate system failed.getAxis(int)
,
CoordinateSystem
public org.opengis.geometry.Envelope getEnvelope() throws MetadataException
ImageGeometry.lowerCorner
.ImageGeometry.upperCorner
.
MetadataException
- if the dimension specified for the envelope is illegalpublic org.opengis.metadata.extent.GeographicBoundingBox getGeographicBoundingBox() throws MetadataException
MetadataException
- if the operation failed. This exception
may contains a TransformException
as its cause.getEnvelope()
public GeographicMetadata getGeographicMetadata()
null
if not already defined.
public void setGeographicMetadata(GeographicMetadata metadata)
public org.opengis.coverage.grid.GridEnvelope getGridRange() throws MetadataException
ImageGeometry.low
and ImageGeometry.high
, and
transform the resulting strings into a grid range
object.
MissingMetadataException
- if a required value is missing.
MetadataException
- if the operation failed for some other reason.ImageGeometry.getGridRange(int)
public java.lang.String toString()
getGeographicBoundingBox()
. Then, it append the list of all metadata as
formatted by GeographicMetadata.getAsTree(java.lang.String)
.
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |