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

◆ WKBFromLWGEOM()

Datum WKBFromLWGEOM ( PG_FUNCTION_ARGS  )

Definition at line 405 of file lwgeom_inout.c.

406{
407 GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
408 LWGEOM *lwgeom;
409 uint8_t variant = 0;
410
411 /* If user specified endianness, respect it */
412 if ( (PG_NARGS()>1) && (!PG_ARGISNULL(1)) )
413 {
414 text *type = PG_GETARG_TEXT_P(1);
415
416 if ( ! strncmp(VARDATA(type), "xdr", 3) ||
417 ! strncmp(VARDATA(type), "XDR", 3) )
418 {
420 }
421 else
422 {
424 }
425 }
426
427 /* Create WKB hex string */
428 lwgeom = lwgeom_from_gserialized(geom);
429 PG_RETURN_BYTEA_P(lwgeom_to_wkb_varlena(lwgeom, variant | WKB_EXTENDED));
430}
static uint8_t variant
Definition cu_in_twkb.c:26
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
lwvarlena_t * lwgeom_to_wkb_varlena(const LWGEOM *geom, uint8_t variant)
Definition lwout_wkb.c:851
#define WKB_EXTENDED
Definition liblwgeom.h:2212
#define WKB_NDR
Definition liblwgeom.h:2213
#define WKB_XDR
Definition liblwgeom.h:2214

References lwgeom_from_gserialized(), lwgeom_to_wkb_varlena(), 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: