50 char *hexwkb = PG_GETARG_CSTRING(0);
65 PG_RETURN_POINTER(result);
77 uint32_t hexwkbsize = 0;
82 if (PG_ARGISNULL(0)) PG_RETURN_NULL();
83 pgraster = (
rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
87 PG_FREE_IF_COPY(pgraster, 0);
88 elog(ERROR,
"RASTER_out: Cannot deserialize raster");
95 PG_FREE_IF_COPY(pgraster, 0);
96 elog(ERROR,
"RASTER_out: Cannot HEX-WKBize raster");
102 PG_FREE_IF_COPY(pgraster, 0);
104 PG_RETURN_CSTRING(hexwkb);
117 uint32_t wkb_size = 0;
118 bytea *result = NULL;
121 if (PG_ARGISNULL(0)) PG_RETURN_NULL();
122 pgraster = (
rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
127 PG_FREE_IF_COPY(pgraster, 0);
128 elog(ERROR,
"RASTER_to_bytea: Cannot deserialize raster");
136 PG_FREE_IF_COPY(pgraster, 0);
137 elog(ERROR,
"RASTER_to_bytea: Cannot allocate and generate WKB data");
142 result_size = wkb_size + VARHDRSZ;
143 result = (bytea *)palloc(result_size);
144 SET_VARSIZE(result, result_size);
145 memcpy(VARDATA(result), wkb, VARSIZE_ANY_EXHDR(result));
150 PG_FREE_IF_COPY(pgraster, 0);
152 PG_RETURN_POINTER(result);
163 pgraster = (
rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
166 PG_FREE_IF_COPY(pgraster, 0);
167 elog(ERROR,
"RASTER_noop: Cannot deserialize raster");
175 SET_VARSIZE(result,
raster->size);
176 PG_RETURN_POINTER(result);
char * rt_raster_to_hexwkb(rt_raster raster, int outasin, uint32_t *hexwkbsize)
Return this raster in HEXWKB form (null-terminated hex)
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
void * rt_raster_serialize(rt_raster raster)
Return this raster in serialized form.
uint8_t * rt_raster_to_wkb(rt_raster raster, int outasin, uint32_t *wkbsize)
Return this raster in WKB form.
rt_raster rt_raster_from_hexwkb(const char *hexwkb, uint32_t hexwkbsize)
Construct an rt_raster from a text HEXWKB representation.
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Datum RASTER_to_bytea(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(RASTER_in)
Input is Hex WKB Used as the input function of the raster type.
Datum RASTER_out(PG_FUNCTION_ARGS)
Datum RASTER_in(PG_FUNCTION_ARGS)
Datum RASTER_noop(PG_FUNCTION_ARGS)
#define POSTGIS_RT_DEBUG(level, msg)