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

◆ LWGEOM_asBinary()

Datum LWGEOM_asBinary ( PG_FUNCTION_ARGS  )

Definition at line 971 of file lwgeom_ogc.c.

972{
973 GSERIALIZED *geom;
974 LWGEOM *lwgeom;
975 uint8_t variant = WKB_ISO;
976
977 if (PG_ARGISNULL(0))
978 PG_RETURN_NULL();
979
980 /* Get a 2D version of the geometry */
981 geom = PG_GETARG_GSERIALIZED_P(0);
982 lwgeom = lwgeom_from_gserialized(geom);
983
984
985 /* If user specified endianness, respect it */
986 if ( (PG_NARGS()>1) && (!PG_ARGISNULL(1)) )
987 {
988 text *wkb_endian = PG_GETARG_TEXT_P(1);
989
990 if ( ! strncmp(VARDATA(wkb_endian), "xdr", 3) ||
991 ! strncmp(VARDATA(wkb_endian), "XDR", 3) )
992 {
994 }
995 else
996 {
998 }
999 }
1000
1001 /* Write to WKB and free the geometry */
1002 PG_RETURN_BYTEA_P(lwgeom_to_wkb_varlena(lwgeom, variant));
1003}
static uint8_t variant
Definition cu_in_twkb.c:26
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
#define WKB_ISO
Definition liblwgeom.h:2210
lwvarlena_t * lwgeom_to_wkb_varlena(const LWGEOM *geom, uint8_t variant)
Definition lwout_wkb.c:851
#define WKB_NDR
Definition liblwgeom.h:2213
#define WKB_XDR
Definition liblwgeom.h:2214

References lwgeom_from_gserialized(), lwgeom_to_wkb_varlena(), variant, WKB_ISO, WKB_NDR, and WKB_XDR.

Here is the call graph for this function: