PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ ST_RemoveRepeatedPoints()

Datum ST_RemoveRepeatedPoints ( PG_FUNCTION_ARGS  )

Definition at line 2603 of file lwgeom_functions_basic.c.

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

Referenced by ST_CollectionHomogenize().

2604 {
2605  GSERIALIZED *g_in = PG_GETARG_GSERIALIZED_P_COPY(0);
2606  GSERIALIZED *g_out;
2607  LWGEOM *lwgeom_in = lwgeom_from_gserialized(g_in);
2608  LWGEOM *lwgeom_out = NULL;
2609  double tolerance = 0.0;
2610 
2611  if ( PG_NARGS() > 1 && ! PG_ARGISNULL(1) )
2612  tolerance = PG_GETARG_FLOAT8(1);
2613 
2614  lwgeom_out = lwgeom_remove_repeated_points(lwgeom_in, tolerance);
2615  g_out = geometry_serialize(lwgeom_out);
2616 
2617  if ( lwgeom_out != lwgeom_in )
2618  lwgeom_free(lwgeom_out);
2619  lwgeom_free(lwgeom_in);
2620 
2621  PG_FREE_IF_COPY(g_in, 0);
2622  PG_RETURN_POINTER(g_out);
2623 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1050
LWGEOM * lwgeom_remove_repeated_points(LWGEOM *in, double tolerance)
Remove repeated points!
Definition: lwgeom.c:1407
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
Here is the call graph for this function:
Here is the caller graph for this function: