PostGIS  2.2.7dev-r@@SVN_REVISION@@
Datum geography_send ( PG_FUNCTION_ARGS  )

Definition at line 678 of file geography_inout.c.

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

679 {
680  LWGEOM *lwgeom = NULL;
681  GSERIALIZED *g = NULL;
682  size_t size_result;
683  uint8_t *wkb;
684  bytea *result;
685 
686  g = PG_GETARG_GSERIALIZED_P(0);
687  lwgeom = lwgeom_from_gserialized(g);
688  wkb = lwgeom_to_wkb(lwgeom, WKB_EXTENDED, &size_result);
689  lwgeom_free(lwgeom);
690 
691  result = palloc(size_result + VARHDRSZ);
692  SET_VARSIZE(result, size_result + VARHDRSZ);
693  memcpy(VARDATA(result), wkb, size_result);
694  pfree(wkb);
695 
696  PG_RETURN_POINTER(result);
697 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1050
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:750
#define WKB_EXTENDED
Definition: liblwgeom.h:1932

Here is the call graph for this function: