Convert LWGEOM to a char* in TWKB format.
Caller is responsible for freeing the returned array.
Definition at line 589 of file lwout_twkb.c.
592{
593 LWDEBUGF(2,
"Entered %s", __func__);
595
599
600 uint8_t *twkb;
601
604
609
611 {
612 lwerror(
"Only collections can support ID lists");
613 return NULL;
614 }
615
616 if ( ! geom )
617 {
618 LWDEBUG(4,
"Cannot convert NULL into TWKB.");
619 lwerror(
"Cannot convert NULL into TWKB");
620 return NULL;
621 }
622
628
631 return twkb;
632}
uint8_t * bytebuffer_get_buffer_copy(const bytebuffer_t *s, size_t *buffer_length)
Returns a copy of the internal buffer.
void bytebuffer_destroy_buffer(bytebuffer_t *s)
Free the bytebuffer_t and all memory managed within it.
void bytebuffer_init_with_size(bytebuffer_t *s, size_t size)
Allocate just the internal buffer of an existing bytebuffer_t struct.
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
static int lwgeom_write_to_buffer(const LWGEOM *geom, TWKB_GLOBALS *globals, TWKB_STATE *parent_state)
bytebuffer_t * header_buf
References bytebuffer_destroy_buffer(), bytebuffer_get_buffer_copy(), bytebuffer_init_with_size(), TWKB_STATE::geom_buf, TWKB_STATE::header_buf, TWKB_STATE::idlist, LWDEBUG, LWDEBUGF, lwerror(), lwgeom_is_collection(), lwgeom_write_to_buffer(), TWKB_GLOBALS::prec_m, TWKB_GLOBALS::prec_xy, TWKB_GLOBALS::prec_z, variant, and TWKB_GLOBALS::variant.
Referenced by cu_twkb_idlist(), lwgeom_to_twkb(), and TWKBFromLWGEOMArray().