PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ LWGEOM_asHEXEWKB()

Datum LWGEOM_asHEXEWKB ( PG_FUNCTION_ARGS  )

Definition at line 300 of file lwgeom_inout.c.

301 {
302  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
303  LWGEOM *lwgeom;
304  uint8_t variant = 0;
305 
306  /* If user specified endianness, respect it */
307  if ( (PG_NARGS()>1) && (!PG_ARGISNULL(1)) )
308  {
309  text *type = PG_GETARG_TEXT_P(1);
310 
311  if ( ! strncmp(VARDATA(type), "xdr", 3) ||
312  ! strncmp(VARDATA(type), "XDR", 3) )
313  {
314  variant = variant | WKB_XDR;
315  }
316  else
317  {
318  variant = variant | WKB_NDR;
319  }
320  }
321 
322  /* Create WKB hex string */
323  lwgeom = lwgeom_from_gserialized(geom);
324  PG_RETURN_TEXT_P(lwgeom_to_hexwkb_varlena(lwgeom, variant | WKB_EXTENDED));
325 }
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:268
#define WKB_EXTENDED
Definition: liblwgeom.h:2209
#define WKB_NDR
Definition: liblwgeom.h:2210
lwvarlena_t * lwgeom_to_hexwkb_varlena(const LWGEOM *geom, uint8_t variant)
Definition: lwout_wkb.c:875
#define WKB_XDR
Definition: liblwgeom.h:2211
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: