899 geom = PG_GETARG_GSERIALIZED_P(0);
903 if ( (PG_NARGS()>1) && (!PG_ARGISNULL(1)) )
905 text *wkb_endian = PG_GETARG_TEXT_P(1);
907 if ( ! strncmp(VARDATA(wkb_endian),
"xdr", 3) ||
908 ! strncmp(VARDATA(wkb_endian),
"XDR", 3) )
923 result = palloc(wkb_size + VARHDRSZ);
924 memcpy(VARDATA(result), wkb, wkb_size);
925 SET_VARSIZE(result, wkb_size + VARHDRSZ);
929 PG_FREE_IF_COPY(geom, 0);
930 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.