57 if (PG_ARGISNULL(0)) PG_RETURN_NULL();
58 pgraster = (
rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
63 PG_FREE_IF_COPY(pgraster, 0);
64 elog(ERROR,
"RASTER_asWKB: Cannot deserialize raster");
69 outasin = PG_GETARG_BOOL(1);
75 PG_FREE_IF_COPY(pgraster, 0);
76 elog(ERROR,
"RASTER_asWKB: Cannot allocate and generate WKB data");
81 result_size = wkb_size + VARHDRSZ;
82 result = (
char *)palloc(result_size);
83 SET_VARSIZE(result, result_size);
84 memcpy(VARDATA(result), wkb, VARSIZE(result) - VARHDRSZ);
89 PG_FREE_IF_COPY(pgraster, 0);
91 PG_RETURN_POINTER(result);
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
uint8_t * rt_raster_to_wkb(rt_raster raster, int outasin, uint32_t *wkbsize)
Return this raster in WKB form.
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): ...