PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ geography_recv()

Datum geography_recv ( PG_FUNCTION_ARGS  )

Definition at line 606 of file geography_inout.c.

607{
608 StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
609 int32 geog_typmod = -1;
610 LWGEOM *lwgeom = NULL;
611 GSERIALIZED *g_ser = NULL;
612
613 if ( (PG_NARGS()>2) && (!PG_ARGISNULL(2)) ) {
614 geog_typmod = PG_GETARG_INT32(2);
615 }
616
617 lwgeom = lwgeom_from_wkb((uint8_t*)buf->data, buf->len, LW_PARSER_CHECK_ALL);
618 if ( !lwgeom )
619 {
620 ereport(ERROR,(errmsg("recv error - invalid geometry")));
621 PG_RETURN_NULL();
622 }
623
624 /* Error on any SRID != default */
625 srid_check_latlong(fcinfo, lwgeom->srid);
626
627 g_ser = gserialized_geography_from_lwgeom(lwgeom, geog_typmod);
628
629 /* Clean up temporary object */
630 lwgeom_free(lwgeom);
631
632 /* Set cursor to the end of buffer (so the backend is happy) */
633 buf->cursor = buf->len;
634
635 PG_RETURN_POINTER(g_ser);
636}
GSERIALIZED * gserialized_geography_from_lwgeom(LWGEOM *lwgeom, int32 geog_typmod)
#define LW_PARSER_CHECK_ALL
Definition liblwgeom.h:2061
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1138
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:833
unsigned int int32
Definition shpopen.c:273
int32_t srid
Definition liblwgeom.h:446

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

Here is the call graph for this function: