ST_compress

更新时间:
复制 MD 格式

Compresses a pcpatch object using the specified compression method.

Syntax

pcpatch ST_compress(pcpatch pc, text global_compression_schema default '', text compression_config default '');

Parameters

ParameterDescription
pcThe pcpatch object to compress.
global_compression_schemaThe compression method to apply. Defaults to an empty string. For valid values, see Compression schemas.
compression_configThe per-dimension compression algorithm. Applies only when global_compression_schema is set to dimension. Defaults to an empty string.

Compression schemas

The global_compression_schema parameter accepts the following values:

  • auto — determines the compression method based on the pcid.

  • dimension — applies per-dimension compression. When using this schema, set compression_config to one of the following algorithms:

    • auto — selects the algorithm automatically based on value statistics.

    • zlib — deflate compression.

    • sigbits — significant bits removal.

    • rle — run-length encoding.

  • laz — no compression config supported.

  • ght — is discarded.

Examples

The following example compresses a patch created from three points and returns the result as text.

SELECT ST_asText(ST_Compress(ST_MakePatch(1, ARRAY[-126.99,45.01,1,0, -126.98,45.02,2,0, -126.97,45.03,3,0])));

Output:

{"pcid":1,"pts":[
 [-126.99,45.01,1,0],[-126.98,45.02,2,0],[-126.97,45.03,3,0]
]}