PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ WKBFromLWGEOM()

Datum WKBFromLWGEOM ( PG_FUNCTION_ARGS  )

Definition at line 403 of file lwgeom_inout.c.

404 {
405  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
406  LWGEOM *lwgeom;
407  uint8_t variant = 0;
408 
409  /* If user specified endianness, respect it */
410  if ( (PG_NARGS()>1) && (!PG_ARGISNULL(1)) )
411  {
412  text *type = PG_GETARG_TEXT_P(1);
413 
414  if ( ! strncmp(VARDATA(type), "xdr", 3) ||
415  ! strncmp(VARDATA(type), "XDR", 3) )
416  {
417  variant = variant | WKB_XDR;
418  }
419  else
420  {
421  variant = variant | WKB_NDR;
422  }
423  }
424 
425  /* Create WKB hex string */
426  lwgeom = lwgeom_from_gserialized(geom);
427  PG_RETURN_BYTEA_P(lwgeom_to_wkb_varlena(lwgeom, variant | WKB_EXTENDED));
428 }
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_wkb_varlena(const LWGEOM *geom, uint8_t variant)
Definition: lwout_wkb.c:851
#define WKB_XDR
Definition: liblwgeom.h:2179
type
Definition: ovdump.py:42

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

Referenced by LWGEOM_send(), and LWGEOM_to_bytea().

Here is the call graph for this function:
Here is the caller graph for this function: