PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ LWGEOM_asEWKT()

Datum LWGEOM_asEWKT ( PG_FUNCTION_ARGS  )

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

2295 {
2296  GSERIALIZED *geom;
2297  LWGEOM *lwgeom;
2298  char *wkt;
2299  size_t wkt_size;
2300  text *result;
2301 
2302  POSTGIS_DEBUG(2, "LWGEOM_asEWKT called.");
2303 
2304  geom = PG_GETARG_GSERIALIZED_P(0);
2305  lwgeom = lwgeom_from_gserialized(geom);
2306 
2307  /* Write to WKT and free the geometry */
2308  wkt = lwgeom_to_wkt(lwgeom, WKT_EXTENDED, DBL_DIG, &wkt_size);
2309  lwgeom_free(lwgeom);
2310 
2311  /* Write to text and free the WKT */
2312  result = cstring2text(wkt);
2313  pfree(wkt);
2314 
2315  /* Return the text */
2316  PG_FREE_IF_COPY(geom, 0);
2317  PG_RETURN_TEXT_P(result);
2318 }
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
Definition: lwout_wkt.c:655
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1050
LWGEOM * geom
#define WKT_EXTENDED
Definition: liblwgeom.h:1941
Here is the call graph for this function:
Here is the caller graph for this function: