3283{
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
3310
3312
3313 result = geometry_serialize(g);
3315 PG_FREE_IF_COPY(input, 0);
3316 PG_RETURN_POINTER(
result);
3317}
char result[OUT_DOUBLE_BUFFER_SIZE]
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.
void lwgeom_free(LWGEOM *geom)