PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ LWGEOM_to_text()

Datum LWGEOM_to_text ( PG_FUNCTION_ARGS  )

Definition at line 346 of file lwgeom_inout.c.

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

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

Here is the call graph for this function: