PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ LWGEOMFromTWKB()

Datum LWGEOMFromTWKB ( PG_FUNCTION_ARGS  )

Definition at line 399 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().

400 {
401  bytea *bytea_twkb = (bytea*)PG_GETARG_BYTEA_P(0);
402  GSERIALIZED *geom;
403  LWGEOM *lwgeom;
404  uint8_t *twkb = (uint8_t*)VARDATA(bytea_twkb);
405 
406  lwgeom = lwgeom_from_twkb(twkb, VARSIZE(bytea_twkb)-VARHDRSZ, LW_PARSER_CHECK_ALL);
407 
408  if ( lwgeom_needs_bbox(lwgeom) )
409  lwgeom_add_bbox(lwgeom);
410 
411  geom = geometry_serialize(lwgeom);
412  lwgeom_free(lwgeom);
413  PG_FREE_IF_COPY(bytea_twkb, 0);
414  PG_RETURN_POINTER(geom);
415 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
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:656
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:648
#define LW_PARSER_CHECK_ALL
Definition: liblwgeom.h:2014
unsigned char uint8_t
Definition: uthash.h:79
int lwgeom_needs_bbox(const LWGEOM *geom)
Check whether or not a lwgeom is big enough to warrant a bounding box.
Definition: lwgeom.c:1152
Here is the call graph for this function:
Here is the caller graph for this function: