PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ LWGEOM_asEWKT()

Datum LWGEOM_asEWKT ( PG_FUNCTION_ARGS  )

Definition at line 2353 of file lwgeom_functions_basic.c.

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

Referenced by LWGEOM_setpoint_linestring().

2354 {
2355  GSERIALIZED *geom;
2356  LWGEOM *lwgeom;
2357  char *wkt;
2358  size_t wkt_size;
2359  text *result;
2360 
2361  POSTGIS_DEBUG(2, "LWGEOM_asEWKT called.");
2362 
2363  geom = PG_GETARG_GSERIALIZED_P(0);
2364  lwgeom = lwgeom_from_gserialized(geom);
2365 
2366  /* Write to WKT and free the geometry */
2367  wkt = lwgeom_to_wkt(lwgeom, WKT_EXTENDED, DBL_DIG, &wkt_size);
2368  lwgeom_free(lwgeom);
2369 
2370  /* Write to text and free the WKT */
2371  result = cstring2text(wkt);
2372  pfree(wkt);
2373 
2374  /* Return the text */
2375  PG_FREE_IF_COPY(geom, 0);
2376  PG_RETURN_TEXT_P(result);
2377 }
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
Definition: lwout_wkt.c:669
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1063
LWGEOM * geom
#define WKT_EXTENDED
Definition: liblwgeom.h:2057
Here is the call graph for this function:
Here is the caller graph for this function: