PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ geography_from_binary()

Datum geography_from_binary ( PG_FUNCTION_ARGS  )

Definition at line 520 of file geography_inout.c.

521 {
522  char *wkb_bytea = (char*)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
523  GSERIALIZED *gser = NULL;
524  size_t wkb_size = VARSIZE(wkb_bytea);
525  uint8_t *wkb = (uint8_t*)VARDATA(wkb_bytea);
526  LWGEOM *lwgeom = lwgeom_from_wkb(wkb, wkb_size, LW_PARSER_CHECK_NONE);
527 
528  if ( ! lwgeom )
529  lwpgerror("Unable to parse WKB");
530 
531  /* Error on any SRID != default */
532  srid_check_latlong(fcinfo, lwgeom->srid);
533 
534  gser = gserialized_geography_from_lwgeom(lwgeom, -1);
535  lwgeom_free(lwgeom);
536  PG_RETURN_POINTER(gser);
537 }
GSERIALIZED * gserialized_geography_from_lwgeom(LWGEOM *lwgeom, int32 geog_typmod)
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2060
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:825
int32_t srid
Definition: liblwgeom.h:446

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

Here is the call graph for this function: