PostGIS  2.5.0beta2dev-r@@SVN_REVISION@@

◆ geography_send()

Datum geography_send ( PG_FUNCTION_ARGS  )

Definition at line 700 of file geography_inout.c.

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

Referenced by geography_recv().

701 {
702  LWGEOM *lwgeom = NULL;
703  GSERIALIZED *g = NULL;
704  size_t size_result;
705  uint8_t *wkb;
706  bytea *result;
707 
708  g = PG_GETARG_GSERIALIZED_P(0);
709  lwgeom = lwgeom_from_gserialized(g);
710  wkb = lwgeom_to_wkb(lwgeom, WKB_EXTENDED, &size_result);
711  lwgeom_free(lwgeom);
712 
713  result = palloc(size_result + VARHDRSZ);
714  SET_VARSIZE(result, size_result + VARHDRSZ);
715  memcpy(VARDATA(result), wkb, size_result);
716  pfree(wkb);
717 
718  PG_RETURN_POINTER(result);
719 }
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:2067
unsigned char uint8_t
Definition: uthash.h:79
Here is the call graph for this function:
Here is the caller graph for this function: