Class GeometryCodec

java.lang.Object
ch.so.agi.filegdb.geometry.GeometryCodec

public final class GeometryCodec extends Object
Decodes Esri shape buffers as stored in file geodatabase geometry fields.

Ported from GDAL OpenFileGDB (filegdbtable.cpp, FileGDBOGRGeometryConverterImpl::GetAsGeometry). The shape type constants match ogrpgeogeometry.h, which is the header the GDAL driver compiles against. This codec intentionally has no JTS or Hop dependency.

Curved segments are decoded without linearization. The fgdb table geometry type of a shape buffer is encoded in the upper bits of the leading varint.

  • Method Details

    • decode

      public static FileGdbGeometry decode(byte[] buffer, GeometryFieldDefinition definition)
    • encode

      public static byte[] encode(FileGdbGeometry geometry, GeometryFieldDefinition definition)
      Encodes a geometry as an Esri shape buffer.

      The Z and M flags of the geometry field definition decide the shape type and the presence of the Z and M arrays, mirroring GDAL's EncodeGeometry().