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

Definition at line 583 of file geography_inout.c.

References gserialized_geography_from_lwgeom(), LW_PARSER_CHECK_NONE, lwgeom_free(), lwgeom_from_wkb(), and LWGEOM::srid.

584 {
585  char *wkb_bytea = (char*)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
586  GSERIALIZED *gser = NULL;
587  size_t wkb_size = VARSIZE(wkb_bytea);
588  uint8_t *wkb = (uint8_t*)VARDATA(wkb_bytea);
589  LWGEOM *lwgeom = lwgeom_from_wkb(wkb, wkb_size, LW_PARSER_CHECK_NONE);
590 
591  if ( ! lwgeom )
592  lwpgerror("Unable to parse WKB");
593 
594  /* Error on any SRID != default */
595  srid_is_latlong(fcinfo, lwgeom->srid);
596 
597  gser = gserialized_geography_from_lwgeom(lwgeom, -1);
598  lwgeom_free(lwgeom);
599  PG_RETURN_POINTER(gser);
600 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1137
int32_t srid
Definition: liblwgeom.h:398
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1998
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:770
unsigned char uint8_t
Definition: uthash.h:79

Here is the call graph for this function: