Package org.h2.util.geometry
Class EWKBUtils
- java.lang.Object
-
- org.h2.util.geometry.EWKBUtils
-
public final class EWKBUtils extends java.lang.Object
EWKB format support for GEOMETRY data type.This class provides limited support of EWKB. EWKB is based on Well-known Binary Representation (WKB) from OGC 06-103r4 and includes additional PostGIS extensions. This class can read dimension system marks in both OGC WKB and EWKB formats, but always writes them in EWKB format. SRID support from EWKB is implemented. As an addition POINT EMPTY is stored with NaN values as specified in OGC 12-128r15.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
EWKBUtils.EWKBSource
Helper source object for EWKB reading.static class
EWKBUtils.EWKBTarget
Converter output target that writes a EWKB.
-
Constructor Summary
Constructors Modifier Constructor Description private
EWKBUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static void
addCoordinate(EWKBUtils.EWKBSource source, GeometryUtils.Target target, boolean useZ, boolean useM, int index, int total)
private static void
addRing(EWKBUtils.EWKBSource source, GeometryUtils.Target target, boolean useZ, boolean useM, int size)
static byte[]
envelope2wkb(double[] envelope)
Converts an envelope to a WKB.static byte[]
ewkb2ewkb(byte[] ewkb)
Converts any supported EWKB to EWKB representation that is used by this class.static byte[]
ewkb2ewkb(byte[] ewkb, int dimensionSystem)
Converts any supported EWKB to EWKB representation that is used by this class.static int
getDimensionSystem(byte[] ewkb)
Reads the dimension system from EWKB.static void
parseEWKB(byte[] ewkb, GeometryUtils.Target target)
Parses a EWKB.private static void
parseEWKB(EWKBUtils.EWKBSource source, GeometryUtils.Target target, int parentType)
Parses a EWKB.static int
type2dimensionSystem(int type)
Converts geometry type with flags to a dimension system.
-
-
-
Field Detail
-
EWKB_Z
public static final int EWKB_Z
Geometry type mask that indicates presence of dimension Z.- See Also:
- Constant Field Values
-
EWKB_M
public static final int EWKB_M
Geometry type mask that indicates presence of dimension M.- See Also:
- Constant Field Values
-
EWKB_SRID
public static final int EWKB_SRID
Geometry type mask that indicates presence of SRID.- See Also:
- Constant Field Values
-
-
Method Detail
-
ewkb2ewkb
public static byte[] ewkb2ewkb(byte[] ewkb)
Converts any supported EWKB to EWKB representation that is used by this class. Reduces dimension system to minimal possible and uses EWKB flags for dimension system indication. May also perform other changes.- Parameters:
ewkb
- source EWKB- Returns:
- canonical EWKB, may be the same as the source
-
ewkb2ewkb
public static byte[] ewkb2ewkb(byte[] ewkb, int dimensionSystem)
Converts any supported EWKB to EWKB representation that is used by this class. Reduces dimension system to minimal possible and uses EWKB flags for dimension system indication. May also perform other changes.- Parameters:
ewkb
- source EWKBdimensionSystem
- dimension system- Returns:
- canonical EWKB, may be the same as the source
-
parseEWKB
public static void parseEWKB(byte[] ewkb, GeometryUtils.Target target)
Parses a EWKB.- Parameters:
ewkb
- EWKB representationtarget
- output target
-
type2dimensionSystem
public static int type2dimensionSystem(int type)
Converts geometry type with flags to a dimension system.- Parameters:
type
- geometry type with flags- Returns:
- dimension system
-
parseEWKB
private static void parseEWKB(EWKBUtils.EWKBSource source, GeometryUtils.Target target, int parentType)
Parses a EWKB.- Parameters:
source
- EWKB sourcetarget
- output targetparentType
- type of parent geometry collection, or 0 for the root geometry
-
addRing
private static void addRing(EWKBUtils.EWKBSource source, GeometryUtils.Target target, boolean useZ, boolean useM, int size)
-
addCoordinate
private static void addCoordinate(EWKBUtils.EWKBSource source, GeometryUtils.Target target, boolean useZ, boolean useM, int index, int total)
-
getDimensionSystem
public static int getDimensionSystem(byte[] ewkb)
Reads the dimension system from EWKB.- Parameters:
ewkb
- EWKB- Returns:
- the dimension system
-
envelope2wkb
public static byte[] envelope2wkb(double[] envelope)
Converts an envelope to a WKB.- Parameters:
envelope
- envelope, or null- Returns:
- WKB, or null
-
-