PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ ST_QuantizeCoordinates()

Datum ST_QuantizeCoordinates ( PG_FUNCTION_ARGS  )

Definition at line 3309 of file lwgeom_functions_basic.c.

3310 {
3311  GSERIALIZED *input;
3313  LWGEOM *g;
3314  int32_t prec_x;
3315  int32_t prec_y;
3316  int32_t prec_z;
3317  int32_t prec_m;
3318 
3319  if (PG_ARGISNULL(0))
3320  PG_RETURN_NULL();
3321  if (PG_ARGISNULL(1))
3322  {
3323  lwpgerror("Must specify precision");
3324  PG_RETURN_NULL();
3325  }
3326  else
3327  {
3328  prec_x = PG_GETARG_INT32(1);
3329  }
3330  prec_y = PG_ARGISNULL(2) ? prec_x : PG_GETARG_INT32(2);
3331  prec_z = PG_ARGISNULL(3) ? prec_x : PG_GETARG_INT32(3);
3332  prec_m = PG_ARGISNULL(4) ? prec_x : PG_GETARG_INT32(4);
3333 
3334  input = PG_GETARG_GSERIALIZED_P_COPY(0);
3335 
3336  g = lwgeom_from_gserialized(input);
3337 
3338  lwgeom_trim_bits_in_place(g, prec_x, prec_y, prec_z, prec_m);
3339 
3340  result = geometry_serialize(g);
3341  lwgeom_free(g);
3342  PG_FREE_IF_COPY(input, 0);
3343  PG_RETURN_POINTER(result);
3344 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:267
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:268
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:2693
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1246

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

Here is the call graph for this function: