PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ LWGEOMFromTWKB()

Datum LWGEOMFromTWKB ( PG_FUNCTION_ARGS  )

Definition at line 400 of file lwgeom_inout.c.

401 {
402  bytea *bytea_twkb = (bytea*)PG_GETARG_BYTEA_P(0);
403  GSERIALIZED *geom;
404  LWGEOM *lwgeom;
405  uint8_t *twkb = (uint8_t*)VARDATA(bytea_twkb);
406 
407  lwgeom = lwgeom_from_twkb(twkb, VARSIZE(bytea_twkb)-VARHDRSZ, LW_PARSER_CHECK_ALL);
408 
409  if ( lwgeom_needs_bbox(lwgeom) )
410  lwgeom_add_bbox(lwgeom);
411 
412  geom = geometry_serialize(lwgeom);
413  lwgeom_free(lwgeom);
414  PG_FREE_IF_COPY(bytea_twkb, 0);
415  PG_RETURN_POINTER(geom);
416 }
#define LW_PARSER_CHECK_ALL
Definition: liblwgeom.h:2006
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
LWGEOM * lwgeom_from_twkb(const uint8_t *twkb, size_t twkb_size, char check)
WKB inputs must have a declared size, to prevent malformed WKB from reading off the end of the memory...
Definition: lwin_twkb.c:656
int lwgeom_needs_bbox(const LWGEOM *geom)
Check whether or not a lwgeom is big enough to warrant a bounding box.
Definition: lwgeom.c:1197
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:686
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
unsigned char uint8_t
Definition: uthash.h:79

References geometry_serialize(), LW_PARSER_CHECK_ALL, lwgeom_add_bbox(), lwgeom_free(), lwgeom_from_twkb(), and lwgeom_needs_bbox().

Here is the call graph for this function: