PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ LWGEOM_asEWKT()

Datum LWGEOM_asEWKT ( PG_FUNCTION_ARGS  )

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

2323 {
2324  GSERIALIZED *geom;
2325  LWGEOM *lwgeom;
2326  char *wkt;
2327  size_t wkt_size;
2328  text *result;
2329 
2330  POSTGIS_DEBUG(2, "LWGEOM_asEWKT called.");
2331 
2332  geom = PG_GETARG_GSERIALIZED_P(0);
2333  lwgeom = lwgeom_from_gserialized(geom);
2334 
2335  /* Write to WKT and free the geometry */
2336  wkt = lwgeom_to_wkt(lwgeom, WKT_EXTENDED, DBL_DIG, &wkt_size);
2337  lwgeom_free(lwgeom);
2338 
2339  /* Write to text and free the WKT */
2340  result = cstring2text(wkt);
2341  pfree(wkt);
2342 
2343  /* Return the text */
2344  PG_FREE_IF_COPY(geom, 0);
2345  PG_RETURN_TEXT_P(result);
2346 }
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:1099
LWGEOM * geom
#define WKT_EXTENDED
Definition: liblwgeom.h:2085
Here is the call graph for this function:
Here is the caller graph for this function: