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

◆ ST_RemoveRepeatedPoints()

Datum ST_RemoveRepeatedPoints ( PG_FUNCTION_ARGS  )

Definition at line 3014 of file lwgeom_functions_basic.c.

3015{
3016 GSERIALIZED *g_in = PG_GETARG_GSERIALIZED_P_COPY(0);
3017 uint32_t type = gserialized_get_type(g_in);
3018 GSERIALIZED *g_out;
3019 LWGEOM *lwgeom_in = NULL;
3020 double tolerance = 0.0;
3021 int modified = LW_FALSE;
3022
3023 /* Don't even start to think about points */
3024 if (type == POINTTYPE)
3025 PG_RETURN_POINTER(g_in);
3026
3027 if (PG_NARGS() > 1 && !PG_ARGISNULL(1))
3028 tolerance = PG_GETARG_FLOAT8(1);
3029
3030 lwgeom_in = lwgeom_from_gserialized(g_in);
3031 modified = lwgeom_remove_repeated_points_in_place(lwgeom_in, tolerance);
3032 if (!modified)
3033 {
3034 /* Since there were no changes, we can return the input to avoid the serialization */
3035 PG_RETURN_POINTER(g_in);
3036 }
3037
3038 g_out = geometry_serialize(lwgeom_in);
3039
3040 pfree(g_in);
3041 PG_RETURN_POINTER(g_out);
3042}
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,...
#define LW_FALSE
Definition liblwgeom.h:94
int lwgeom_remove_repeated_points_in_place(LWGEOM *in, double tolerance)
Definition lwgeom.c:1695
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:102

References gserialized_get_type(), LW_FALSE, lwgeom_from_gserialized(), lwgeom_remove_repeated_points_in_place(), and POINTTYPE.

Here is the call graph for this function: