public class ReprojectFeatureReader extends Object implements DelegatingFeatureReader<SimpleFeatureType,SimpleFeature>
ReprojectFeatureReader is a wrapper used to reproject GeometryAttributes to a user supplied CoordinateReferenceSystem from the original CoordinateReferenceSystem supplied by the original FeatureReader.
Example Use:
ReprojectFeatureReader reader =
new ReprojectFeatureReader( originalReader, reprojectCS );
CoordinateReferenceSystem originalCS =
originalReader.getFeatureType().getDefaultGeometry().getCoordinateSystem();
CoordinateReferenceSystem newCS =
reader.getFeatureType().getDefaultGeometry().getCoordinateSystem();
assertEquals( reprojectCS, newCS );
TODO: handle the case where there is more than one geometry and the other geometries have a
different CS than the default geometry| Constructor and Description |
|---|
ReprojectFeatureReader(FeatureReader<SimpleFeatureType,SimpleFeature> reader,
CoordinateReferenceSystem cs)
Constructor that will generate schema and mathTransform for the results.
|
ReprojectFeatureReader(FeatureReader<SimpleFeatureType,SimpleFeature> reader,
SimpleFeatureType schema,
MathTransform transform)
Direct constructor reprojecting the provided reader into the schema indicated (using the
supplied math transformation).
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Implement close.
|
FeatureReader<SimpleFeatureType,SimpleFeature> |
getDelegate() |
SimpleFeatureType |
getFeatureType()
Implement getFeatureType.
|
boolean |
hasNext()
Implement hasNext.
|
SimpleFeature |
next()
Implement next.
|
public ReprojectFeatureReader(FeatureReader<SimpleFeatureType,SimpleFeature> reader, SimpleFeatureType schema, MathTransform transform)
Please note schema is that of the expected results, You may need to use FeatureTypes.transform( FeatureType, crs ) to create the schema provider.
reader - original reader with results in the original coordinate reference systemschema - This is the target schema describing the results in the expected coordinate
reference systemtransform - the math transform used to go from reader coordinate reference system to the
provided schema coordinate reference systempublic ReprojectFeatureReader(FeatureReader<SimpleFeatureType,SimpleFeature> reader, CoordinateReferenceSystem cs) throws SchemaException, OperationNotFoundException, NoSuchElementException, FactoryException
reader - original readercs - Target coordinate reference system; will be used to create the target FeatureType
and MathTransform used to transform the dataSchemaExceptionOperationNotFoundExceptionNoSuchElementExceptionFactoryExceptionpublic FeatureReader<SimpleFeatureType,SimpleFeature> getDelegate()
getDelegate in interface DelegatingFeatureReader<SimpleFeatureType,SimpleFeature>public SimpleFeatureType getFeatureType()
Description ...
getFeatureType in interface FeatureReader<SimpleFeatureType,SimpleFeature>IllegalStateException - DOCUMENT ME!FeatureReader.getFeatureType()public SimpleFeature next() throws IOException, IllegalAttributeException, NoSuchElementException
Description ...
next in interface FeatureReader<SimpleFeatureType,SimpleFeature>IOExceptionIllegalAttributeExceptionNoSuchElementExceptionIllegalStateException - DOCUMENT ME!DataSourceException - DOCUMENT ME!IllegalAttributeException - If the attributes read do not comply with the FeatureType.FeatureReader.next()public boolean hasNext()
throws IOException
Description ...
hasNext in interface FeatureReader<SimpleFeatureType,SimpleFeature>IOExceptionIllegalStateException - DOCUMENT ME!FeatureReader.hasNext()public void close()
throws IOException
Description ...
close in interface Closeableclose in interface AutoCloseableclose in interface FeatureReader<SimpleFeatureType,SimpleFeature>IOExceptionIllegalStateException - DOCUMENT ME!FeatureReader.close()Copyright © 1996–2019 Geotools. All rights reserved.