PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ RASTER_out()

Datum RASTER_out ( PG_FUNCTION_ARGS  )

Definition at line 88 of file rtpg_inout.c.

89 {
90  rt_pgraster *pgraster = NULL;
91  rt_raster raster = NULL;
92  uint32_t hexwkbsize = 0;
93  char *hexwkb = NULL;
94 
95  POSTGIS_RT_DEBUG(3, "Starting");
96 
97  if (PG_ARGISNULL(0)) PG_RETURN_NULL();
98  pgraster = (rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
99 
100  raster = rt_raster_deserialize(pgraster, FALSE);
101  if (!raster) {
102  PG_FREE_IF_COPY(pgraster, 0);
103  elog(ERROR, "RASTER_out: Cannot deserialize raster");
104  PG_RETURN_NULL();
105  }
106 
107  hexwkb = rt_raster_to_hexwkb(raster, FALSE, &hexwkbsize);
108  if (!hexwkb) {
110  PG_FREE_IF_COPY(pgraster, 0);
111  elog(ERROR, "RASTER_out: Cannot HEX-WKBize raster");
112  PG_RETURN_NULL();
113  }
114 
115  /* Free the raster objects used */
117  PG_FREE_IF_COPY(pgraster, 0);
118 
119  PG_RETURN_CSTRING(hexwkb);
120 }
#define FALSE
Definition: dbfopen.c:168
char * rt_raster_to_hexwkb(rt_raster raster, int outasin, uint32_t *hexwkbsize)
Return this raster in HEXWKB form (null-terminated hex)
Definition: rt_wkb.c:679
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_raster.c:82
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
Definition: rt_serialize.c:725
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:121
#define POSTGIS_RT_DEBUG(level, msg)
Definition: rtpostgis.h:61
Struct definitions.
Definition: librtcore.h:2250
unsigned int uint32_t
Definition: uthash.h:78

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

Here is the call graph for this function: