PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ LWGEOM_to_text()

Datum LWGEOM_to_text ( PG_FUNCTION_ARGS  )

Definition at line 315 of file lwgeom_inout.c.

References lwgeom_free(), lwgeom_from_gserialized(), lwgeom_to_hexwkb(), LWGEOMFromEWKB(), PG_FUNCTION_INFO_V1(), and WKB_EXTENDED.

Referenced by LWGEOM_asHEXEWKB().

316 {
317  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
318  LWGEOM *lwgeom;
319  char *hexwkb;
320  size_t hexwkb_size;
321  text *result;
322 
323  /* Generate WKB hex text */
324  lwgeom = lwgeom_from_gserialized(geom);
325  hexwkb = lwgeom_to_hexwkb(lwgeom, WKB_EXTENDED, &hexwkb_size);
326  lwgeom_free(lwgeom);
327 
328  /* Copy into text obect */
329  result = cstring2text(hexwkb);
330  pfree(hexwkb);
331 
332  /* Clean up and return */
333  PG_FREE_IF_COPY(geom, 0);
334  PG_RETURN_TEXT_P(result);
335 }
char * lwgeom_to_hexwkb(const LWGEOM *geom, uint8_t variant, size_t *size_out)
Definition: lwout_wkb.c:834
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1050
#define WKB_EXTENDED
Definition: liblwgeom.h:1932
Here is the call graph for this function:
Here is the caller graph for this function: