PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ LWGEOMFromTWKB()

Datum LWGEOMFromTWKB ( PG_FUNCTION_ARGS  )

Definition at line 375 of file lwgeom_inout.c.

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

Referenced by LWGEOMFromEWKB().

376 {
377  bytea *bytea_twkb = (bytea*)PG_GETARG_BYTEA_P(0);
378  GSERIALIZED *geom;
379  LWGEOM *lwgeom;
380  uint8_t *twkb = (uint8_t*)VARDATA(bytea_twkb);
381 
382  lwgeom = lwgeom_from_twkb(twkb, VARSIZE(bytea_twkb)-VARHDRSZ, LW_PARSER_CHECK_ALL);
383 
384  if ( lwgeom_needs_bbox(lwgeom) )
385  lwgeom_add_bbox(lwgeom);
386 
387  geom = geometry_serialize(lwgeom);
388  lwgeom_free(lwgeom);
389  PG_FREE_IF_COPY(bytea_twkb, 0);
390  PG_RETURN_POINTER(geom);
391 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1050
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
LWGEOM * lwgeom_from_twkb(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:642
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:599
#define LW_PARSER_CHECK_ALL
Definition: liblwgeom.h:1870
int lwgeom_needs_bbox(const LWGEOM *geom)
Check whether or not a lwgeom is big enough to warrant a bounding box.
Definition: lwgeom.c:1103
Here is the call graph for this function:
Here is the caller graph for this function: