PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ RASTER_getWidth()

Datum RASTER_getWidth ( PG_FUNCTION_ARGS  )

Definition at line 110 of file rtpg_raster_properties.c.

References PG_FUNCTION_INFO_V1(), rtrowdump::raster, RASTER_getHeight(), rt_raster_deserialize(), rt_raster_destroy(), rt_raster_get_width(), TRUE, and rt_raster_serialized_t::width.

Referenced by RASTER_getSRID().

111 {
112  rt_pgraster *pgraster;
114  uint16_t width;
115 
116  if (PG_ARGISNULL(0)) PG_RETURN_NULL();
117  pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
118 
119  raster = rt_raster_deserialize(pgraster, TRUE);
120  if ( ! raster ) {
121  PG_FREE_IF_COPY(pgraster, 0);
122  elog(ERROR, "RASTER_getWidth: Could not deserialize raster");
123  PG_RETURN_NULL();
124  }
125 
126  width = rt_raster_get_width(raster);
127 
128  rt_raster_destroy(raster);
129  PG_FREE_IF_COPY(pgraster, 0);
130 
131  PG_RETURN_INT32(width);
132 }
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:121
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_raster.c:82
uint16_t rt_raster_get_width(rt_raster raster)
Definition: rt_raster.c:121
Struct definitions.
Definition: librtcore.h:2201
#define TRUE
Definition: dbfopen.c:169
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
Definition: rt_serialize.c:717
Here is the call graph for this function:
Here is the caller graph for this function: