WKBReader class

Reads a {@link Geometry}from a byte stream in Well-Known Binary format. Supports use of an {@link InStream}, which allows easy use with arbitrary byte stream sources.

This class reads the format describe in {@link WKBWriter}. It also partially handles the Extended WKB format used by PostGIS, by parsing and storing SRID values. The reader repairs structurally-invalid input (specifically, LineStrings and LinearRings which contain too few points have vertices added, and non-closed rings are closed).

This class is designed to support reuse of a single instance to read multiple geometries. This class is not thread-safe; each thread should create its own instance.

As of version 1.15, the reader can read geometries following OGC 06-103r4 speification used by Spatialite/Geopackage.

The difference between PostGIS EWKB format and the new OGC specification is that Z and M coordinates are detected with a bit mask on the higher byte in the former case (0x80 for Z and 0x40 for M) while new OGC specification use specif int ranges for 2D gemetries, Z geometries (2D code+1000), M geometries (2D code+2000) and ZM geometries (2D code+3000).

Note that the {@link WKBWriter} is not changed and still write PostGIS WKB geometries @see WKBWriter for a formal format specification

Constructors

WKBReader()
WKBReader.withFactory(GeometryFactory geometryFactory)

Properties

csFactory CoordinateSequenceFactory
getter/setter pair
dis ByteOrderDataInStream
getter/setter pair
factory GeometryFactory
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hasSRID bool
getter/setter pair
inputDimension int
getter/setter pair
isStrict bool
true if structurally invalid input should be reported rather than repaired. At some point this could be made client-controllable.
getter/setter pair
ordValues List<double>?
getter/setter pair
precisionModel PrecisionModel
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
SRID int
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read(List<int> ins, {dynamic doSpatialite = false}) Geometry
Reads a {@link Geometry} in binary WKB format from an {@link InStream}.
readCoordinate() → void
Reads a coordinate value with the specified dimensionality. Makes the X and Y ordinates precise according to the precision model in use.
readCoordinateSequence(int size) CoordinateSequence
readCoordinateSequenceLineString(int size) CoordinateSequence
readCoordinateSequenceRing(int size) CoordinateSequence
readGeometry() Geometry
readGeometryCollection() GeometryCollection
readLinearRing() LinearRing
readLineString() LineString
readMultiLineString() MultiLineString
readMultiPoint() MultiPoint
readMultiPolygon() MultiPolygon
readPoint() Point
readPolygon() Polygon
readSpatialiteGeometry() Geometry
setSRID(Geometry g, int SRID) Geometry
Sets the SRID, if it was specified in the WKB
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

INVALID_GEOM_TYPE_MSG String
final

Static Methods

hexToBytes(String hex) List<int>
Converts a hexadecimal string to a byte array. The hexadecimal digit symbols are case-insensitive.