867 geom = PG_GETARG_GSERIALIZED_P(0);
872 if ( (PG_NARGS()>1) && (!PG_ARGISNULL(1)) )
874 text *wkb_endian = PG_GETARG_TEXT_P(1);
876 if ( ! strncmp(VARDATA(wkb_endian),
"xdr", 3) ||
877 ! strncmp(VARDATA(wkb_endian),
"XDR", 3) )
892 result = palloc(wkb_size + VARHDRSZ);
893 memcpy(VARDATA(result), wkb, wkb_size);
894 SET_VARSIZE(result, wkb_size + VARHDRSZ);
898 PG_FREE_IF_COPY(geom, 0);
899 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.