PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ ST_QuantizeCoordinates()

Datum ST_QuantizeCoordinates ( PG_FUNCTION_ARGS  )

Definition at line 3053 of file lwgeom_functions_basic.c.

3054 {
3055  GSERIALIZED* input;
3056  GSERIALIZED* result;
3057  LWGEOM* g;
3058  int32_t prec_x;
3059  int32_t prec_y;
3060  int32_t prec_z;
3061  int32_t prec_m;
3062 
3063  if (PG_ARGISNULL(0))
3064  PG_RETURN_NULL();
3065  if (PG_ARGISNULL(1))
3066  {
3067  lwpgerror("Must specify precision");
3068  PG_RETURN_NULL();
3069  }
3070  else
3071  {
3072  prec_x = PG_GETARG_INT32(1);
3073  }
3074  prec_y = PG_ARGISNULL(2) ? prec_x : PG_GETARG_INT32(2);
3075  prec_z = PG_ARGISNULL(3) ? prec_x : PG_GETARG_INT32(3);
3076  prec_m = PG_ARGISNULL(4) ? prec_x : PG_GETARG_INT32(4);
3077 
3078  input = PG_GETARG_GSERIALIZED_P_COPY(0);
3079 
3080  g = lwgeom_from_gserialized(input);
3081 
3082  lwgeom_trim_bits_in_place(g, prec_x, prec_y, prec_z, prec_m);
3083 
3084  result = geometry_serialize(g);
3085  lwgeom_free(g);
3086  PG_FREE_IF_COPY(input, 0);
3087  PG_RETURN_POINTER(result);
3088 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_trim_bits_in_place(LWGEOM *geom, int32_t prec_x, int32_t prec_y, int32_t prec_z, int32_t prec_m)
Trim the bits of an LWGEOM in place, to optimize it for compression.
Definition: lwgeom.c:2518
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)

References geometry_serialize(), lwgeom_free(), lwgeom_from_gserialized(), and lwgeom_trim_bits_in_place().

Here is the call graph for this function: