131 int preserve_endpoints=1;
135 PG_RETURN_POINTER(geom);
137 if ( (PG_NARGS()>1) && (!PG_ARGISNULL(1)) )
138 n_iterations = PG_GETARG_INT32(1);
140 if (n_iterations< 1 || n_iterations>5)
141 elog(ERROR,
"Number of iterations must be between 1 and 5 : %s", __func__);
143 if ( (PG_NARGS()>2) && (!PG_ARGISNULL(2)) )
145 if(PG_GETARG_BOOL(2))
146 preserve_endpoints = 1;
148 preserve_endpoints = 0;
154 if ( ! out ) PG_RETURN_NULL();
159 result = geometry_serialize(out);
161 PG_FREE_IF_COPY(geom, 0);
162 PG_RETURN_POINTER(
result);
char result[OUT_DOUBLE_BUFFER_SIZE]
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
uint32_t gserialized_get_type(const GSERIALIZED *g)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
void lwgeom_free(LWGEOM *geom)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
LWGEOM * lwgeom_chaikin(const LWGEOM *igeom, int n_iterations, int preserve_endpoint)
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.