PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ LWGEOM_line_desegmentize()

Datum LWGEOM_line_desegmentize ( PG_FUNCTION_ARGS  )

Definition at line 128 of file lwgeom_sqlmm.c.

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

Referenced by ST_CurveToLine().

129 {
130  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
131  GSERIALIZED *ret;
132  LWGEOM *igeom = NULL, *ogeom = NULL;
133 
134  POSTGIS_DEBUG(2, "LWGEOM_line_desegmentize.");
135 
136  igeom = lwgeom_from_gserialized(geom);
137  ogeom = lwgeom_unstroke(igeom);
138  lwgeom_free(igeom);
139 
140  if (ogeom == NULL)
141  {
142  PG_FREE_IF_COPY(geom, 0);
143  PG_RETURN_NULL();
144  }
145 
146  ret = geometry_serialize(ogeom);
147  lwgeom_free(ogeom);
148  PG_FREE_IF_COPY(geom, 0);
149  PG_RETURN_POINTER(ret);
150 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
LWGEOM * lwgeom_unstroke(const LWGEOM *geom)
Definition: lwstroke.c:1139
Here is the call graph for this function:
Here is the caller graph for this function: