Class EWKTUtils
java.lang.Object
org.h2.util.geometry.EWKTUtils
EWKT format support for GEOMETRY data type.
This class provides limited support of EWKT. EWKT is based on Well-known Text Representation (WKT) from OGC 06-103r4 and includes additional PostGIS extensions. SRID support from EWKT is implemented.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classHelper source object for EWKT reading.static final classConverter output target that writes a EWKT. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidaddCoordinate(EWKTUtils.EWKTSource source, GeometryUtils.Target target, int dimensionSystem, int index, int total) private static voidaddRing(ArrayList<double[]> ring, GeometryUtils.Target target) static Stringewkb2ewkt(byte[] ewkb) Converts EWKB to EWKT.static Stringewkb2ewkt(byte[] ewkb, int dimensionSystem) Converts EWKB to EWKT.static byte[]Converts EWKT to EWKB.static byte[]Converts EWKT to EWKB.static StringBuilderformatGeometryTypeAndDimensionSystem(StringBuilder builder, int type) Formats type and dimension system as a string.static intgetDimensionSystem(String ewkt) Reads the dimension system from EWKT.private static voidparseCollection(EWKTUtils.EWKTSource source, GeometryUtils.Target target, int type, int parentType, int dimensionSystem) static intParses a dimension system from the given string.static voidparseEWKT(String ewkt, GeometryUtils.Target target) Parses a EWKT.private static voidparseEWKT(EWKTUtils.EWKTSource source, GeometryUtils.Target target, int parentType, int dimensionSystem) Parses a EWKB.static intParses geometry type and dimension system from the given string.private static voidparseMultiPointAlternative(EWKTUtils.EWKTSource source, GeometryUtils.Target target, int dimensionSystem) private static double[]readCoordinate(EWKTUtils.EWKTSource source, int dimensionSystem) private static ArrayList<double[]> readRing(EWKTUtils.EWKTSource source, int dimensionSystem)
-
Field Details
-
TYPES
0-based type names of geometries, subtract 1 from type code to get index in this array. -
DIMENSION_SYSTEMS
Names of dimension systems.
-
-
Constructor Details
-
EWKTUtils
private EWKTUtils()
-
-
Method Details
-
ewkb2ewkt
Converts EWKB to EWKT.- Parameters:
ewkb- source EWKB- Returns:
- EWKT representation
-
ewkb2ewkt
Converts EWKB to EWKT.- Parameters:
ewkb- source EWKBdimensionSystem- dimension system- Returns:
- EWKT representation
-
ewkt2ewkb
Converts EWKT to EWKB.- Parameters:
ewkt- source EWKT- Returns:
- EWKB representation
-
ewkt2ewkb
Converts EWKT to EWKB.- Parameters:
ewkt- source EWKTdimensionSystem- dimension system- Returns:
- EWKB representation
-
parseEWKT
Parses a EWKT.- Parameters:
ewkt- source EWKTtarget- output target
-
parseGeometryType
Parses geometry type and dimension system from the given string.- Parameters:
s- string to parse- Returns:
- geometry type and dimension system in OGC geometry code format (type + dimensionSystem * 1000)
- Throws:
IllegalArgumentException- if input is not valid
-
parseDimensionSystem
Parses a dimension system from the given string.- Parameters:
s- string to parse- Returns:
- dimension system, one of XYZ, XYM, or XYZM
- Throws:
IllegalArgumentException- if input is not valid- See Also:
-
formatGeometryTypeAndDimensionSystem
Formats type and dimension system as a string.- Parameters:
builder- string buildertype- OGC geometry code format (type + dimensionSystem * 1000)- Returns:
- the specified string builder
- Throws:
IllegalArgumentException- if type is not valid
-
parseEWKT
private static void parseEWKT(EWKTUtils.EWKTSource source, GeometryUtils.Target target, int parentType, int dimensionSystem) Parses a EWKB.- Parameters:
source- EWKT sourcetarget- output targetparentType- type of parent geometry collection, or 0 for the root geometrydimensionSystem- dimension system of parent geometry
-
parseCollection
private static void parseCollection(EWKTUtils.EWKTSource source, GeometryUtils.Target target, int type, int parentType, int dimensionSystem) -
parseMultiPointAlternative
private static void parseMultiPointAlternative(EWKTUtils.EWKTSource source, GeometryUtils.Target target, int dimensionSystem) -
readRing
-
addRing
-
addCoordinate
private static void addCoordinate(EWKTUtils.EWKTSource source, GeometryUtils.Target target, int dimensionSystem, int index, int total) -
readCoordinate
-
getDimensionSystem
Reads the dimension system from EWKT.- Parameters:
ewkt- EWKT source- Returns:
- the dimension system
-