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.

final class GeometryGetter<G,V extends G> extends ValueGetter<V>
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:

Multi-threading

GeometryGetter instances shall be thread-safe.
Since:
1.1
Version:
1.2
See Also:
  • Field Details

    • geometryFactory

      private final Geometries<G> geometryFactory
      The factory to use for creating geometries from WKB definitions.
    • defaultCRS

      private final org.opengis.referencing.crs.CoordinateReferenceSystem defaultCRS
      The Coordinate Reference System if InfoStatements cannot map the SRID. This is null if there is no default.
    • encoding

      private final BinaryEncoding 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 this ValueGetter.
      defaultCRS - the CRS to use if none can be mapped from the SRID, or null if none.
      encoding - the way binary data are encoded in the geometry column.
  • Method Details

    • getValue

      public V getValue(InfoStatements stmts, ResultSet source, int columnIndex) throws Exception
      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 class ValueGetter<V extends G>
      Parameters:
      stmts - prepared statements for fetching CRS from SRID, or null 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.