PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ ST_RemoveRepeatedPoints()

Datum ST_RemoveRepeatedPoints ( PG_FUNCTION_ARGS  )

Definition at line 2770 of file lwgeom_functions_basic.c.

2771 {
2772  GSERIALIZED *g_in = PG_GETARG_GSERIALIZED_P(0);
2773  int type = gserialized_get_type(g_in);
2774  GSERIALIZED *g_out;
2775  LWGEOM *lwgeom_in = NULL;
2776  LWGEOM *lwgeom_out = NULL;
2777  double tolerance = 0.0;
2778 
2779  /* Don't even start to think about points */
2780  if ( type == POINTTYPE )
2781  PG_RETURN_POINTER(g_in);
2782 
2783  if ( PG_NARGS() > 1 && ! PG_ARGISNULL(1) )
2784  tolerance = PG_GETARG_FLOAT8(1);
2785 
2786  lwgeom_in = lwgeom_from_gserialized(g_in);
2787  lwgeom_out = lwgeom_remove_repeated_points(lwgeom_in, tolerance);
2788 
2789  /* COMPUTE_BBOX TAINTING */
2790  if (lwgeom_in->bbox)
2791  lwgeom_refresh_bbox(lwgeom_out);
2792 
2793  g_out = geometry_serialize(lwgeom_out);
2794 
2795  if ( lwgeom_out != lwgeom_in )
2796  {
2797  lwgeom_free(lwgeom_out);
2798  }
2799 
2800  lwgeom_free(lwgeom_in);
2801 
2802  PG_FREE_IF_COPY(g_in, 0);
2803  PG_RETURN_POINTER(g_out);
2804 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
uint32_t gserialized_get_type(const GSERIALIZED *s)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
Definition: g_serialized.c:86
void lwgeom_refresh_bbox(LWGEOM *lwgeom)
Drop current bbox and calculate a fresh one.
Definition: lwgeom.c:698
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
LWGEOM * lwgeom_remove_repeated_points(const LWGEOM *in, double tolerance)
Definition: lwgeom.c:1503
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
type
Definition: ovdump.py:41
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
GBOX * bbox
Definition: liblwgeom.h:401

References LWGEOM::bbox, geometry_serialize(), gserialized_get_type(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_refresh_bbox(), lwgeom_remove_repeated_points(), POINTTYPE, and ovdump::type.

Here is the call graph for this function: