PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ LWGEOM_asEWKT()

Datum LWGEOM_asEWKT ( PG_FUNCTION_ARGS  )

Definition at line 2333 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().

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