903 geom = PG_GETARG_GSERIALIZED_P(0);
907 if ( (PG_NARGS()>1) && (!PG_ARGISNULL(1)) )
909 text *wkb_endian = PG_GETARG_TEXT_P(1);
911 if ( ! strncmp(VARDATA(wkb_endian),
"xdr", 3) ||
912 ! strncmp(VARDATA(wkb_endian),
"XDR", 3) )
927 result = palloc(wkb_size + VARHDRSZ);
928 memcpy(VARDATA(result), wkb, wkb_size);
929 SET_VARSIZE(result, wkb_size + VARHDRSZ);
933 PG_FREE_IF_COPY(geom, 0);
934 PG_RETURN_BYTEA_P(result);
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
uint8_t * lwgeom_to_wkb(const LWGEOM *geom, uint8_t variant, size_t *size_out)
Convert LWGEOM to a char* in WKB format.