PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ LWGEOMFromTWKB()

Datum LWGEOMFromTWKB ( PG_FUNCTION_ARGS  )

Definition at line 407 of file lwgeom_inout.c.

408 {
409  bytea *bytea_twkb = PG_GETARG_BYTEA_P(0);
410  GSERIALIZED *geom;
411  LWGEOM *lwgeom;
412  uint8_t *twkb = (uint8_t*)VARDATA(bytea_twkb);
413 
414  lwgeom = lwgeom_from_twkb(twkb, VARSIZE_ANY_EXHDR(bytea_twkb), LW_PARSER_CHECK_ALL);
415 
416  if (lwgeom_needs_bbox(lwgeom))
417  lwgeom_add_bbox(lwgeom);
418 
419  geom = geometry_serialize(lwgeom);
420  lwgeom_free(lwgeom);
421  PG_FREE_IF_COPY(bytea_twkb, 0);
422  PG_RETURN_POINTER(geom);
423 }
#define LW_PARSER_CHECK_ALL
Definition: liblwgeom.h:2061
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138
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:654
int lwgeom_needs_bbox(const LWGEOM *geom)
Check whether or not a lwgeom is big enough to warrant a bounding box.
Definition: lwgeom.c:1191
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:677
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)

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: