167 if (PG_ARGISNULL(0)) PG_RETURN_NULL();
168 pgraster = (
rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
173 PG_FREE_IF_COPY(pgraster, 0);
174 elog(ERROR,
"RASTER_to_binary: Could not deserialize raster");
178 if (!PG_ARGISNULL(1))
179 outasin = PG_GETARG_BOOL(1);
185 PG_FREE_IF_COPY(pgraster, 0);
186 elog(ERROR,
"RASTER_to_binary: Could not allocate and generate WKB data");
191 result_size = wkb_size + VARHDRSZ;
192 result = (
char *)palloc(result_size);
193 SET_VARSIZE(result, result_size);
194 memcpy(VARDATA(result), wkb, VARSIZE(result) - VARHDRSZ);
199 PG_FREE_IF_COPY(pgraster, 0);
201 PG_RETURN_POINTER(result);
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
uint8_t * rt_raster_to_wkb(rt_raster raster, int outasin, uint32_t *wkbsize)
Return this raster in WKB form.
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.