PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ geography_send()

Datum geography_send ( PG_FUNCTION_ARGS  )

Definition at line 685 of file geography_inout.c.

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

Referenced by geography_recv().

686 {
687  LWGEOM *lwgeom = NULL;
688  GSERIALIZED *g = NULL;
689  size_t size_result;
690  uint8_t *wkb;
691  bytea *result;
692 
693  g = PG_GETARG_GSERIALIZED_P(0);
694  lwgeom = lwgeom_from_gserialized(g);
695  wkb = lwgeom_to_wkb(lwgeom, WKB_EXTENDED, &size_result);
696  lwgeom_free(lwgeom);
697 
698  result = palloc(size_result + VARHDRSZ);
699  SET_VARSIZE(result, size_result + VARHDRSZ);
700  memcpy(VARDATA(result), wkb, size_result);
701  pfree(wkb);
702 
703  PG_RETURN_POINTER(result);
704 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
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:2076
unsigned char uint8_t
Definition: uthash.h:79
Here is the call graph for this function:
Here is the caller graph for this function: