PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ geography_from_binary()

Datum geography_from_binary ( PG_FUNCTION_ARGS  )

Definition at line 567 of file geography_inout.c.

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

Referenced by geography_from_text().

568 {
569  char *wkb_bytea = (char*)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
570  GSERIALIZED *gser = NULL;
571  size_t wkb_size = VARSIZE(wkb_bytea);
572  uint8_t *wkb = (uint8_t*)VARDATA(wkb_bytea);
573  LWGEOM *lwgeom = lwgeom_from_wkb(wkb, wkb_size, LW_PARSER_CHECK_NONE);
574 
575  if ( ! lwgeom )
576  lwpgerror("Unable to parse WKB");
577 
578  /* Error on any SRID != default */
579  srid_is_latlong(fcinfo, lwgeom->srid);
580 
581  gser = gserialized_geography_from_lwgeom(lwgeom, -1);
582  lwgeom_free(lwgeom);
583  PG_RETURN_POINTER(gser);
584 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
int32_t srid
Definition: liblwgeom.h:399
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2013
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:772
unsigned char uint8_t
Definition: uthash.h:79
Here is the call graph for this function:
Here is the caller graph for this function: