PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ geography_send()

Datum geography_send ( PG_FUNCTION_ARGS  )

Definition at line 640 of file geography_inout.c.

641{
642 LWGEOM *lwgeom = NULL;
643 GSERIALIZED *g = NULL;
644 size_t size_result;
645 uint8_t *wkb;
646 bytea *result;
647
648 g = PG_GETARG_GSERIALIZED_P(0);
649 lwgeom = lwgeom_from_gserialized(g);
650 wkb = lwgeom_to_wkb(lwgeom, WKB_EXTENDED, &size_result);
651 lwgeom_free(lwgeom);
652
653 result = palloc(size_result + VARHDRSZ);
654 SET_VARSIZE(result, size_result + VARHDRSZ);
655 memcpy(VARDATA(result), wkb, size_result);
656 lwfree(wkb);
657
658 PG_RETURN_POINTER(result);
659}
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1138
void lwfree(void *mem)
Definition lwutil.c:242
#define WKB_EXTENDED
Definition liblwgeom.h:2123
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:790

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

Here is the call graph for this function: