PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ ST_RemoveRepeatedPoints()

Datum ST_RemoveRepeatedPoints ( PG_FUNCTION_ARGS  )

Definition at line 3022 of file lwgeom_functions_basic.c.

3023 {
3024  GSERIALIZED *g_in = PG_GETARG_GSERIALIZED_P_COPY(0);
3025  uint32_t type = gserialized_get_type(g_in);
3026  GSERIALIZED *g_out;
3027  LWGEOM *lwgeom_in = NULL;
3028  double tolerance = 0.0;
3029  int modified = LW_FALSE;
3030 
3031  /* Don't even start to think about points */
3032  if (type == POINTTYPE)
3033  PG_RETURN_POINTER(g_in);
3034 
3035  if (PG_NARGS() > 1 && !PG_ARGISNULL(1))
3036  tolerance = PG_GETARG_FLOAT8(1);
3037 
3038  lwgeom_in = lwgeom_from_gserialized(g_in);
3039  modified = lwgeom_remove_repeated_points_in_place(lwgeom_in, tolerance);
3040  if (!modified)
3041  {
3042  /* Since there were no changes, we can return the input to avoid the serialization */
3043  PG_RETURN_POINTER(g_in);
3044  }
3045 
3046  g_out = geometry_serialize(lwgeom_in);
3047 
3048  pfree(g_in);
3049  PG_RETURN_POINTER(g_out);
3050 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
uint32_t gserialized_get_type(const GSERIALIZED *g)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
Definition: gserialized.c:89
#define LW_FALSE
Definition: liblwgeom.h:94
int lwgeom_remove_repeated_points_in_place(LWGEOM *in, double tolerance)
Definition: lwgeom.c:1594
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:102
type
Definition: ovdump.py:42

References gserialized_get_type(), LW_FALSE, lwgeom_from_gserialized(), lwgeom_remove_repeated_points_in_place(), POINTTYPE, and ovdump::type.

Here is the call graph for this function: