PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ LWGEOMFromTWKB()

Datum LWGEOMFromTWKB ( PG_FUNCTION_ARGS  )

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

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 }
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
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:686
#define LW_PARSER_CHECK_ALL
Definition: liblwgeom.h:2005
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:1197
Here is the call graph for this function:
Here is the caller graph for this function: