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

◆ ST_QuantizeCoordinates()

Datum ST_QuantizeCoordinates ( PG_FUNCTION_ARGS  )

Definition at line 3074 of file lwgeom_functions_basic.c.

3075{
3076 GSERIALIZED *input;
3077 GSERIALIZED *result;
3078 LWGEOM *g;
3079 int32_t prec_x;
3080 int32_t prec_y;
3081 int32_t prec_z;
3082 int32_t prec_m;
3083
3084 if (PG_ARGISNULL(0))
3085 PG_RETURN_NULL();
3086 if (PG_ARGISNULL(1))
3087 {
3088 lwpgerror("Must specify precision");
3089 PG_RETURN_NULL();
3090 }
3091 else
3092 {
3093 prec_x = PG_GETARG_INT32(1);
3094 }
3095 prec_y = PG_ARGISNULL(2) ? prec_x : PG_GETARG_INT32(2);
3096 prec_z = PG_ARGISNULL(3) ? prec_x : PG_GETARG_INT32(3);
3097 prec_m = PG_ARGISNULL(4) ? prec_x : PG_GETARG_INT32(4);
3098
3099 input = PG_GETARG_GSERIALIZED_P_COPY(0);
3100
3101 g = lwgeom_from_gserialized(input);
3102
3103 lwgeom_trim_bits_in_place(g, prec_x, prec_y, prec_z, prec_m);
3104
3105 result = geometry_serialize(g);
3106 lwgeom_free(g);
3107 PG_FREE_IF_COPY(input, 0);
3108 PG_RETURN_POINTER(result);
3109}
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:2508
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1138
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: