PostGIS  3.2.2dev-r@@SVN_REVISION@@

◆ ST_QuantizeCoordinates()

Datum ST_QuantizeCoordinates ( PG_FUNCTION_ARGS  )

Definition at line 3198 of file lwgeom_functions_basic.c.

3199 {
3200  GSERIALIZED *input;
3202  LWGEOM *g;
3203  int32_t prec_x;
3204  int32_t prec_y;
3205  int32_t prec_z;
3206  int32_t prec_m;
3207 
3208  if (PG_ARGISNULL(0))
3209  PG_RETURN_NULL();
3210  if (PG_ARGISNULL(1))
3211  {
3212  lwpgerror("Must specify precision");
3213  PG_RETURN_NULL();
3214  }
3215  else
3216  {
3217  prec_x = PG_GETARG_INT32(1);
3218  }
3219  prec_y = PG_ARGISNULL(2) ? prec_x : PG_GETARG_INT32(2);
3220  prec_z = PG_ARGISNULL(3) ? prec_x : PG_GETARG_INT32(3);
3221  prec_m = PG_ARGISNULL(4) ? prec_x : PG_GETARG_INT32(4);
3222 
3223  input = PG_GETARG_GSERIALIZED_P_COPY(0);
3224 
3225  g = lwgeom_from_gserialized(input);
3226 
3227  lwgeom_trim_bits_in_place(g, prec_x, prec_y, prec_z, prec_m);
3228 
3229  result = geometry_serialize(g);
3230  lwgeom_free(g);
3231  PG_FREE_IF_COPY(input, 0);
3232  PG_RETURN_POINTER(result);
3233 }
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: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:2548
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138

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

Here is the call graph for this function: