PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ geography_recv()

Datum geography_recv ( PG_FUNCTION_ARGS  )

Definition at line 670 of file geography_inout.c.

References geography_send(), gserialized_geography_from_lwgeom(), LW_PARSER_CHECK_ALL, lwgeom_free(), lwgeom_from_wkb(), PG_FUNCTION_INFO_V1(), and LWGEOM::srid.

Referenced by geometry_from_geography().

671 {
672  StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
673  int32 geog_typmod = -1;
674  LWGEOM *lwgeom = NULL;
675  GSERIALIZED *g_ser = NULL;
676 
677  if ( (PG_NARGS()>2) && (!PG_ARGISNULL(2)) ) {
678  geog_typmod = PG_GETARG_INT32(2);
679  }
680 
681  lwgeom = lwgeom_from_wkb((uint8_t*)buf->data, buf->len, LW_PARSER_CHECK_ALL);
682 
683  /* Error on any SRID != default */
684  srid_is_latlong(fcinfo, lwgeom->srid);
685 
686  g_ser = gserialized_geography_from_lwgeom(lwgeom, geog_typmod);
687 
688  /* Clean up temporary object */
689  lwgeom_free(lwgeom);
690 
691  /* Set cursor to the end of buffer (so the backend is happy) */
692  buf->cursor = buf->len;
693 
694  PG_RETURN_POINTER(g_ser);
695 }
unsigned int int32
Definition: shpopen.c:273
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1128
int32_t srid
Definition: liblwgeom.h:401
GSERIALIZED * gserialized_geography_from_lwgeom(LWGEOM *lwgeom, int32 geog_typmod)
#define LW_PARSER_CHECK_ALL
Definition: liblwgeom.h:1967
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:
Here is the caller graph for this function: