PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ LWGEOM_line_desegmentize()

Datum LWGEOM_line_desegmentize ( PG_FUNCTION_ARGS  )

Definition at line 127 of file lwgeom_sqlmm.c.

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

Referenced by ST_CurveToLine().

128 {
129  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
130  GSERIALIZED *ret;
131  LWGEOM *igeom = NULL, *ogeom = NULL;
132 
133  POSTGIS_DEBUG(2, "LWGEOM_line_desegmentize.");
134 
135  igeom = lwgeom_from_gserialized(geom);
136  ogeom = lwgeom_unstroke(igeom);
137  lwgeom_free(igeom);
138 
139  if (ogeom == NULL)
140  {
141  PG_FREE_IF_COPY(geom, 0);
142  PG_RETURN_NULL();
143  }
144 
145  ret = geometry_serialize(ogeom);
146  lwgeom_free(ogeom);
147  PG_FREE_IF_COPY(geom, 0);
148  PG_RETURN_POINTER(ret);
149 }
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)
LWGEOM * lwgeom_unstroke(const LWGEOM *geom)
Definition: lwstroke.c:1160
Here is the call graph for this function:
Here is the caller graph for this function: