Construct an rt_raster from a text HEXWKB representation.
414 {
416 uint8_t* wkb = NULL;
417 uint32_t wkbsize = 0;
418 uint32_t i = 0;
419
420 assert(NULL != hexwkb);
421
424
425 if (hexwkbsize % 2) {
426 rterror(
"rt_raster_from_hexwkb: Raster HEXWKB input must have an even number of characters");
427 return NULL;
428 }
429 wkbsize = hexwkbsize / 2;
430
432 if (!wkb) {
433 rterror(
"rt_raster_from_hexwkb: Out of memory allocating memory for decoding HEXWKB");
434 return NULL;
435 }
436
437
438 for (i = 0; i < wkbsize; ++i) {
439 wkb[i] =
parse_hex((
char*) & (hexwkb[i * 2]));
440 }
441
444
445 return ret;
446}
uint8_t parse_hex(char *str)
Convert a single hex digit into the corresponding char.
void rterror(const char *fmt,...) __attribute__((format(printf
Wrappers used for reporting errors and info.
void * rtalloc(size_t size)
Wrappers used for managing memory.
#define RASTER_DEBUGF(level, msg,...)
void rtdealloc(void *mem)
rt_raster rt_raster_from_wkb(const uint8_t *wkb, uint32_t wkbsize)
Construct an rt_raster from a binary WKB representation.