Class TWKBWriter

java.lang.Object
org.locationtech.jts.io.twkb.TWKBWriter

public class TWKBWriter extends Object
Writes Geometrys in TWKB (Tiny Well-known Binary) format.

The current TWKB specification is https://github.com/TWKB/Specification/blob/master/twkb.md.

  • Constructor Details

    • TWKBWriter

      public TWKBWriter()
  • Method Details

    • setXYPrecision

      public TWKBWriter setXYPrecision(int xyprecision)
      Number of base-10 decimal places stored for X and Y dimensions.

      A positive retaining information to the right of the decimal place, negative rounding up to the left of the decimal place).

      Defaults to 7

    • setEncodeZ

      public TWKBWriter setEncodeZ(boolean includeZDimension)
    • setEncodeM

      public TWKBWriter setEncodeM(boolean includeMDimension)
    • setZPrecision

      public TWKBWriter setZPrecision(int zprecision)
      Number of base-10 decimal places stored for Z dimension.

      A positive retaining information to the right of the decimal place, negative rounding up to the left of the decimal place).

      Defaults to 0

    • setMPrecision

      public TWKBWriter setMPrecision(int mprecision)
      Number of base-10 decimal places stored for M dimension.

      A positive retaining information to the right of the decimal place, negative rounding up to the left of the decimal place).

      Defaults to 0

    • setIncludeSize

      public TWKBWriter setIncludeSize(boolean includeSize)
      Whether the generated TWKB should include the size in bytes of the geometry.
    • setIncludeBbox

      public TWKBWriter setIncludeBbox(boolean includeBbox)
      Whether the generated TWKB should include a Bounding Box for the geometry.
    • write

      public byte[] write(Geometry geom)
    • write

      public void write(Geometry geom, OutputStream out) throws IOException
      Throws:
      IOException
    • write

      public void write(Geometry geom, DataOutput out) throws IOException
      Throws:
      IOException