@Override public void setValue(PreparedStatement st, int startIndex, T value) throws SQLException { WkbEncoder encoder = Wkb.newEncoder(Wkb.Dialect.POSTGIS_EWKB_1); ByteBuffer buffer = encoder.encode(value, byteOrder); st.setBytes(startIndex, buffer.toByteArray()); }
/** * Encode the specified {@code Geometry} into a WKB * * @param geometry The value to encode * @return A byte-array representing the geometry in WKB. */ public static byte[] to(Geometry geometry) { final WkbEncoder encoder = Wkb.newEncoder(Wkb.Dialect.POSTGIS_EWKB_1); final ByteBuffer buffer = encoder.encode(geometry, ByteOrder.NDR); return (buffer == null ? null : buffer.toByteArray()); }