PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ geography_send()

Datum geography_send ( PG_FUNCTION_ARGS  )

Definition at line 704 of file geography_inout.c.

705 {
706  LWGEOM *lwgeom = NULL;
707  GSERIALIZED *g = NULL;
708  size_t size_result;
709  uint8_t *wkb;
710  bytea *result;
711 
712  g = PG_GETARG_GSERIALIZED_P(0);
713  lwgeom = lwgeom_from_gserialized(g);
714  wkb = lwgeom_to_wkb(lwgeom, WKB_EXTENDED, &size_result);
715  lwgeom_free(lwgeom);
716 
717  result = palloc(size_result + VARHDRSZ);
718  SET_VARSIZE(result, size_result + VARHDRSZ);
719  memcpy(VARDATA(result), wkb, size_result);
720  pfree(wkb);
721 
722  PG_RETURN_POINTER(result);
723 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
uint8_t * lwgeom_to_wkb(const LWGEOM *geom, uint8_t variant, size_t *size_out)
Convert LWGEOM to a char* in WKB format.
Definition: lwout_wkb.c:764
#define WKB_EXTENDED
Definition: liblwgeom.h:2068
unsigned char uint8_t
Definition: uthash.h:79

References lwgeom_free(), lwgeom_from_gserialized(), lwgeom_to_wkb(), and WKB_EXTENDED.

Here is the call graph for this function: