Class GeometryGetter<G,V extends G>
java.lang.Object
org.apache.sis.internal.sql.feature.ValueGetter<V>
org.apache.sis.internal.sql.feature.GeometryGetter<G,V>
- Type Parameters:
G
- the type of geometry objects created by the factory.V
- the type of geometry objects returned by this getter.
Reader of geometries encoded in Well Known Binary (WKB) format.
This class expects the WKB format as defined by OGC specification,
but the extended EWKB format (specific to PostGIS) is also accepted
if the
GeometryLibrary
can handle it.
The WKB format is what we get from a spatial database (at least PostGIS)
when querying a geometry field without using any ST_X
method.
References:
- OGC Simple feature access - Part 1: Common architecture
- Well-known binary on Wikipedia
- PostGIS extended format
Multi-threading
GeometryGetter
instances shall be thread-safe.- Since:
- 1.1
- Version:
- 1.2
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.internal.sql.feature.ValueGetter
ValueGetter.AsArray, ValueGetter.AsBigDecimal, ValueGetter.AsBoolean, ValueGetter.AsByte, ValueGetter.AsBytes, ValueGetter.AsDate, ValueGetter.AsDouble, ValueGetter.AsFloat, ValueGetter.AsInstant, ValueGetter.AsInteger, ValueGetter.AsLocalTime, ValueGetter.AsLong, ValueGetter.AsObject, ValueGetter.AsOffsetDateTime, ValueGetter.AsOffsetTime, ValueGetter.AsShort, ValueGetter.AsString
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.opengis.referencing.crs.CoordinateReferenceSystem
The Coordinate Reference System ifInfoStatements
cannot map the SRID.private final BinaryEncoding
The way binary data are encoded in the geometry column.private final Geometries<G>
The factory to use for creating geometries from WKB definitions.Fields inherited from class org.apache.sis.internal.sql.feature.ValueGetter
valueType
-
Constructor Summary
ConstructorsConstructorDescriptionGeometryGetter
(Geometries<G> geometryFactory, Class<V> geometryClass, org.opengis.referencing.crs.CoordinateReferenceSystem defaultCRS, BinaryEncoding encoding) Creates a new reader. -
Method Summary
Modifier and TypeMethodDescriptiongetValue
(InfoStatements stmts, ResultSet source, int columnIndex) Gets the value in the column at specified index.Methods inherited from class org.apache.sis.internal.sql.feature.ValueGetter
toCollection
-
Field Details
-
geometryFactory
The factory to use for creating geometries from WKB definitions. -
defaultCRS
private final org.opengis.referencing.crs.CoordinateReferenceSystem defaultCRSThe Coordinate Reference System ifInfoStatements
cannot map the SRID. This isnull
if there is no default. -
encoding
The way binary data are encoded in the geometry column.
-
-
Constructor Details
-
GeometryGetter
GeometryGetter(Geometries<G> geometryFactory, Class<V> geometryClass, org.opengis.referencing.crs.CoordinateReferenceSystem defaultCRS, BinaryEncoding encoding) Creates a new reader. The same instance can be reused for parsing an arbitrary amount of geometries sharing the same default CRS.- Parameters:
geometryFactory
- the factory to use for creating geometries from WKB definitions.geometryClass
- the type of geometry to be returned by thisValueGetter
.defaultCRS
- the CRS to use if none can be mapped from the SRID, ornull
if none.encoding
- the way binary data are encoded in the geometry column.
-
-
Method Details
-
getValue
Gets the value in the column at specified index. The given result set must have its cursor position on the line to read. This method does not modify the cursor position.- Specified by:
getValue
in classValueGetter<V extends G>
- Parameters:
stmts
- prepared statements for fetching CRS from SRID, ornull
if none.source
- the result set from which to get the value.columnIndex
- index of the column in which to get the value.- Returns:
- geometry value in the given column. May be
null
. - Throws:
Exception
- if an error occurred. May be an SQL error, a WKB parsing error, etc.
-