Class PostgisGeometry

java.lang.Object
io.debezium.connector.postgresql.PostgisGeometry

public class PostgisGeometry extends Object
A parser API for Postgres Geometry types
Author:
Robert Coup
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final String
    Static Hex EKWB for a GEOMETRYCOLLECTION EMPTY.
    private final Integer
    Coordinate reference system identifier.
    private final byte[]
    PostGIS Extended-Well-Known-Binary (EWKB) geometry representation.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    PostgisGeometry(byte[] ewkb, Integer srid)
    Create a PostgisGeometry using the supplied EWKB and SRID.
  • Method Summary

    Modifier and Type
    Method
    Description
    Create a GEOMETRYCOLLECTION EMPTY PostgisGeometry
    fromEwkb(byte[] ewkb)
    Create a PostgisGeometry using the supplied PostGIS EWKB.
    Create a PostgisGeometry using the supplied PostGIS Hex EWKB string.
    Returns the coordinate reference system identifier (SRID)
    byte[]
    Returns the standard well-known binary representation
    private static Integer
    parseSrid(byte[] ewkb)
    Parses an EWKB Geometry and extracts the SRID (if any) https://trac.osgeo.org/postgis/browser/trunk/doc/ZMSgeoms.txt

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • HEXEWKB_EMPTY_GEOMETRYCOLLECTION

      private static final String HEXEWKB_EMPTY_GEOMETRYCOLLECTION
      Static Hex EKWB for a GEOMETRYCOLLECTION EMPTY.
      See Also:
    • wkb

      private final byte[] wkb
      PostGIS Extended-Well-Known-Binary (EWKB) geometry representation. An extension of the Open Geospatial Consortium Well-Known-Binary format. Since EWKB is a superset of WKB, we use EWKB here. https://postgis.net/docs/using_postgis_dbmanagement.html#EWKB_EWKT http://www.opengeospatial.org/standards/sfa
    • srid

      private final Integer srid
      Coordinate reference system identifier. While it's technically user-defined, the standard/common values in use are the EPSG code list http://www.epsg.org/ null if unset/unspecified
  • Constructor Details

    • PostgisGeometry

      private PostgisGeometry(byte[] ewkb, Integer srid)
      Create a PostgisGeometry using the supplied EWKB and SRID.
      Parameters:
      ewkb - the Extended Well-Known binary representation of the coordinate in the standard format
      srid - the coordinate system identifier (SRID); null if unset/unknown
  • Method Details

    • fromHexEwkb

      public static PostgisGeometry fromHexEwkb(String hexEwkb)
      Create a PostgisGeometry using the supplied PostGIS Hex EWKB string. SRID is extracted from the EWKB
    • fromEwkb

      public static PostgisGeometry fromEwkb(byte[] ewkb)
      Create a PostgisGeometry using the supplied PostGIS EWKB. SRID is extracted from the EWKB
    • createEmpty

      public static PostgisGeometry createEmpty()
      Create a GEOMETRYCOLLECTION EMPTY PostgisGeometry
      Returns:
      a PostgisGeometry which represents a PostgisGeometry API
    • getWkb

      public byte[] getWkb()
      Returns the standard well-known binary representation
      Returns:
      invalid reference
      byte[]
      which represents the standard well-known binary
    • getSrid

      public Integer getSrid()
      Returns the coordinate reference system identifier (SRID)
      Returns:
      srid
    • parseSrid

      private static Integer parseSrid(byte[] ewkb)
      Parses an EWKB Geometry and extracts the SRID (if any) https://trac.osgeo.org/postgis/browser/trunk/doc/ZMSgeoms.txt
      Parameters:
      ewkb - PostGIS EWKB geometry
      Returns:
      Geometry SRID or null if there is no SRID.