PostGIS 3.6.2dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ ST_QuantizeCoordinates()

Datum ST_QuantizeCoordinates ( PG_FUNCTION_ARGS  )

Definition at line 3282 of file lwgeom_functions_basic.c.

3283{
3284 GSERIALIZED *input;
3286 LWGEOM *g;
3287 int32_t prec_x;
3288 int32_t prec_y;
3289 int32_t prec_z;
3290 int32_t prec_m;
3291
3292 if (PG_ARGISNULL(0))
3293 PG_RETURN_NULL();
3294 if (PG_ARGISNULL(1))
3295 {
3296 lwpgerror("Must specify precision");
3297 PG_RETURN_NULL();
3298 }
3299 else
3300 {
3301 prec_x = PG_GETARG_INT32(1);
3302 }
3303 prec_y = PG_ARGISNULL(2) ? prec_x : PG_GETARG_INT32(2);
3304 prec_z = PG_ARGISNULL(3) ? prec_x : PG_GETARG_INT32(3);
3305 prec_m = PG_ARGISNULL(4) ? prec_x : PG_GETARG_INT32(4);
3306
3307 input = PG_GETARG_GSERIALIZED_P_COPY(0);
3308
3309 g = lwgeom_from_gserialized(input);
3310
3311 lwgeom_trim_bits_in_place(g, prec_x, prec_y, prec_z, prec_m);
3312
3313 result = geometry_serialize(g);
3314 lwgeom_free(g);
3315 PG_FREE_IF_COPY(input, 0);
3316 PG_RETURN_POINTER(result);
3317}
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.
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:2665
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1218

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

Here is the call graph for this function: