PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ LWGEOM_asHEXEWKB()

Datum LWGEOM_asHEXEWKB ( PG_FUNCTION_ARGS  )

Definition at line 298 of file lwgeom_inout.c.

299 {
300  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
301  LWGEOM *lwgeom;
302  uint8_t variant = 0;
303 
304  /* If user specified endianness, respect it */
305  if ( (PG_NARGS()>1) && (!PG_ARGISNULL(1)) )
306  {
307  text *type = PG_GETARG_TEXT_P(1);
308 
309  if ( ! strncmp(VARDATA(type), "xdr", 3) ||
310  ! strncmp(VARDATA(type), "XDR", 3) )
311  {
312  variant = variant | WKB_XDR;
313  }
314  else
315  {
316  variant = variant | WKB_NDR;
317  }
318  }
319 
320  /* Create WKB hex string */
321  lwgeom = lwgeom_from_gserialized(geom);
322  PG_RETURN_TEXT_P(lwgeom_to_hexwkb_varlena(lwgeom, variant | WKB_EXTENDED));
323 }
static uint8_t variant
Definition: cu_in_twkb.c:26
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
#define WKB_EXTENDED
Definition: liblwgeom.h:2177
#define WKB_NDR
Definition: liblwgeom.h:2178
lwvarlena_t * lwgeom_to_hexwkb_varlena(const LWGEOM *geom, uint8_t variant)
Definition: lwout_wkb.c:875
#define WKB_XDR
Definition: liblwgeom.h:2179
type
Definition: ovdump.py:42

References lwgeom_from_gserialized(), lwgeom_to_hexwkb_varlena(), ovdump::type, variant, WKB_EXTENDED, WKB_NDR, and WKB_XDR.

Here is the call graph for this function: