PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ ST_QuantizeCoordinates()

Datum ST_QuantizeCoordinates ( PG_FUNCTION_ARGS  )

Definition at line 3317 of file lwgeom_functions_basic.c.

3318 {
3319  GSERIALIZED *input;
3321  LWGEOM *g;
3322  int32_t prec_x;
3323  int32_t prec_y;
3324  int32_t prec_z;
3325  int32_t prec_m;
3326 
3327  if (PG_ARGISNULL(0))
3328  PG_RETURN_NULL();
3329  if (PG_ARGISNULL(1))
3330  {
3331  lwpgerror("Must specify precision");
3332  PG_RETURN_NULL();
3333  }
3334  else
3335  {
3336  prec_x = PG_GETARG_INT32(1);
3337  }
3338  prec_y = PG_ARGISNULL(2) ? prec_x : PG_GETARG_INT32(2);
3339  prec_z = PG_ARGISNULL(3) ? prec_x : PG_GETARG_INT32(3);
3340  prec_m = PG_ARGISNULL(4) ? prec_x : PG_GETARG_INT32(4);
3341 
3342  input = PG_GETARG_GSERIALIZED_P_COPY(0);
3343 
3344  g = lwgeom_from_gserialized(input);
3345 
3346  lwgeom_trim_bits_in_place(g, prec_x, prec_y, prec_z, prec_m);
3347 
3348  result = geometry_serialize(g);
3349  lwgeom_free(g);
3350  PG_FREE_IF_COPY(input, 0);
3351  PG_RETURN_POINTER(result);
3352 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:262
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
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:2539
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1155

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

Here is the call graph for this function: