PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ ST_RemoveRepeatedPoints()

Datum ST_RemoveRepeatedPoints ( PG_FUNCTION_ARGS  )

Definition at line 2759 of file lwgeom_functions_basic.c.

References geometry_serialize(), gserialized_get_type(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_remove_repeated_points(), PG_FUNCTION_INFO_V1(), POINTTYPE, ST_FlipCoordinates(), and ovdump::type.

Referenced by ST_CollectionHomogenize().

2760 {
2761  GSERIALIZED *g_in = PG_GETARG_GSERIALIZED_P(0);
2762  int type = gserialized_get_type(g_in);
2763  GSERIALIZED *g_out;
2764  LWGEOM *lwgeom_in = NULL;
2765  LWGEOM *lwgeom_out = NULL;
2766  double tolerance = 0.0;
2767 
2768  /* Don't even start to think about points */
2769  if ( type == POINTTYPE )
2770  PG_RETURN_POINTER(g_in);
2771 
2772  if ( PG_NARGS() > 1 && ! PG_ARGISNULL(1) )
2773  tolerance = PG_GETARG_FLOAT8(1);
2774 
2775  lwgeom_in = lwgeom_from_gserialized(g_in);
2776  lwgeom_out = lwgeom_remove_repeated_points(lwgeom_in, tolerance);
2777  g_out = geometry_serialize(lwgeom_out);
2778 
2779  if ( lwgeom_out != lwgeom_in )
2780  {
2781  lwgeom_free(lwgeom_out);
2782  }
2783 
2784  lwgeom_free(lwgeom_in);
2785 
2786  PG_FREE_IF_COPY(g_in, 0);
2787  PG_RETURN_POINTER(g_out);
2788 }
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
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
type
Definition: ovdump.py:41
LWGEOM * lwgeom_remove_repeated_points(const LWGEOM *in, double tolerance)
Definition: lwgeom.c:1503
Here is the call graph for this function:
Here is the caller graph for this function: