PostGIS  2.5.0dev-r@@SVN_REVISION@@
Datum LWGEOM_asEWKT ( PG_FUNCTION_ARGS  )

Definition at line 2330 of file lwgeom_functions_basic.c.

References dumpnode::geom, lwgeom_free(), lwgeom_from_gserialized(), lwgeom_to_wkt(), and WKT_EXTENDED.

2331 {
2332  GSERIALIZED *geom;
2333  LWGEOM *lwgeom;
2334  char *wkt;
2335  size_t wkt_size;
2336  text *result;
2337 
2338  POSTGIS_DEBUG(2, "LWGEOM_asEWKT called.");
2339 
2340  geom = PG_GETARG_GSERIALIZED_P(0);
2341  lwgeom = lwgeom_from_gserialized(geom);
2342 
2343  /* Write to WKT and free the geometry */
2344  wkt = lwgeom_to_wkt(lwgeom, WKT_EXTENDED, DBL_DIG, &wkt_size);
2345  lwgeom_free(lwgeom);
2346 
2347  /* Write to text and free the WKT */
2348  result = cstring2text(wkt);
2349  pfree(wkt);
2350 
2351  /* Return the text */
2352  PG_FREE_IF_COPY(geom, 0);
2353  PG_RETURN_TEXT_P(result);
2354 }
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
Definition: lwout_wkt.c:675
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1137
LWGEOM * geom
#define WKT_EXTENDED
Definition: liblwgeom.h:2070

Here is the call graph for this function: