PostGIS  2.3.7dev-r@@SVN_REVISION@@
Datum ST_RemoveRepeatedPoints ( PG_FUNCTION_ARGS  )

Definition at line 2662 of file lwgeom_functions_basic.c.

References geometry_serialize(), lwgeom_free(), lwgeom_from_gserialized(), and lwgeom_remove_repeated_points().

2663 {
2664  GSERIALIZED *g_in = PG_GETARG_GSERIALIZED_P_COPY(0);
2665  GSERIALIZED *g_out;
2666  LWGEOM *lwgeom_in = lwgeom_from_gserialized(g_in);
2667  LWGEOM *lwgeom_out = NULL;
2668  double tolerance = 0.0;
2669 
2670  if ( PG_NARGS() > 1 && ! PG_ARGISNULL(1) )
2671  tolerance = PG_GETARG_FLOAT8(1);
2672 
2673  lwgeom_out = lwgeom_remove_repeated_points(lwgeom_in, tolerance);
2674  g_out = geometry_serialize(lwgeom_out);
2675 
2676  if ( lwgeom_out != lwgeom_in )
2677  {
2678  lwgeom_free(lwgeom_out);
2679  }
2680 
2681  lwgeom_free(lwgeom_in);
2682 
2683  PG_FREE_IF_COPY(g_in, 0);
2684  PG_RETURN_POINTER(g_out);
2685 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1063
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
LWGEOM * lwgeom_remove_repeated_points(const LWGEOM *in, double tolerance)
Remove repeated points!
Definition: lwgeom.c:1420

Here is the call graph for this function: