PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum geography_from_binary ( PG_FUNCTION_ARGS  )

Definition at line 550 of file geography_inout.c.

References gserialized_geography_from_lwgeom(), LW_PARSER_CHECK_NONE, lwerror(), lwgeom_free(), and lwgeom_from_wkb().

551 {
552  char *wkb_bytea = (char*)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
553  GSERIALIZED *gser = NULL;
554  size_t wkb_size = VARSIZE(wkb_bytea);
555  uint8_t *wkb = (uint8_t*)VARDATA(wkb_bytea);
556  LWGEOM *lwgeom = lwgeom_from_wkb(wkb, wkb_size, LW_PARSER_CHECK_NONE);
557 
558  if ( ! lwgeom )
559  lwerror("Unable to parse WKB");
560 
561  gser = gserialized_geography_from_lwgeom(lwgeom, -1);
562  lwgeom_free(lwgeom);
563  PG_RETURN_POINTER(gser);
564 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1006
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1706
GSERIALIZED * gserialized_geography_from_lwgeom(LWGEOM *lwgeom, int32 geog_typmod)
LWGEOM * lwgeom_from_wkb(const uint8_t *wkb, const size_t wkb_size, const char check)
WKB inputs must have a declared size, to prevent malformed WKB from reading off the end of the memory...
Definition: lwin_wkb.c:728

Here is the call graph for this function: