PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ LWGEOM_to_text()

Datum LWGEOM_to_text ( PG_FUNCTION_ARGS  )

Definition at line 344 of file lwgeom_inout.c.

345 {
346  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
347  LWGEOM *lwgeom;
348  char *hexwkb;
349  size_t hexwkb_size;
350  text *result;
351 
352  /* Generate WKB hex text */
353  lwgeom = lwgeom_from_gserialized(geom);
354  hexwkb = lwgeom_to_hexwkb(lwgeom, WKB_EXTENDED, &hexwkb_size);
355  lwgeom_free(lwgeom);
356 
357  /* Copy into text obect */
358  result = cstring_to_text(hexwkb);
359  lwfree(hexwkb);
360 
361  /* Clean up and return */
362  PG_FREE_IF_COPY(geom, 0);
363  PG_RETURN_TEXT_P(result);
364 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138
void lwfree(void *mem)
Definition: lwutil.c:242
#define WKB_EXTENDED
Definition: liblwgeom.h:2123
char * lwgeom_to_hexwkb(const LWGEOM *geom, uint8_t variant, size_t *size_out)
Definition: lwout_wkb.c:874

References lwfree(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_to_hexwkb(), and WKB_EXTENDED.

Here is the call graph for this function: