PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum RASTER_out ( PG_FUNCTION_ARGS  )

Definition at line 1139 of file rt_pg.c.

References FALSE, POSTGIS_RT_DEBUG, rtrowdump::raster, rt_raster_deserialize(), rt_raster_destroy(), and rt_raster_to_hexwkb().

1140 {
1141  rt_pgraster *pgraster = NULL;
1142  rt_raster raster = NULL;
1143  uint32_t hexwkbsize = 0;
1144  char *hexwkb = NULL;
1145 
1146  POSTGIS_RT_DEBUG(3, "Starting");
1147 
1148  if (PG_ARGISNULL(0)) PG_RETURN_NULL();
1149  pgraster = (rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
1150 
1151  raster = rt_raster_deserialize(pgraster, FALSE);
1152  if (!raster) {
1153  PG_FREE_IF_COPY(pgraster, 0);
1154  elog(ERROR, "RASTER_out: Could not deserialize raster");
1155  PG_RETURN_NULL();
1156  }
1157 
1158  hexwkb = rt_raster_to_hexwkb(raster, FALSE, &hexwkbsize);
1159  if (!hexwkb) {
1160  rt_raster_destroy(raster);
1161  PG_FREE_IF_COPY(pgraster, 0);
1162  elog(ERROR, "RASTER_out: Could not HEX-WKBize raster");
1163  PG_RETURN_NULL();
1164  }
1165 
1166  /* Free the raster objects used */
1167  rt_raster_destroy(raster);
1168  PG_FREE_IF_COPY(pgraster, 0);
1169 
1170  PG_RETURN_CSTRING(hexwkb);
1171 }
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_api.c:5387
tuple raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:123
#define POSTGIS_RT_DEBUG(level, msg)
Definition: rt_pg.h:58
char * rt_raster_to_hexwkb(rt_raster raster, int outasin, uint32_t *hexwkbsize)
Return this raster in HEXWKB form (null-terminated hex)
Definition: rt_api.c:8062
#define FALSE
Definition: dbfopen.c:169
Struct definitions.
Definition: rt_api.h:2175
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
Definition: rt_api.c:8350

Here is the call graph for this function: