PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ RASTER_clip()

Datum RASTER_clip ( PG_FUNCTION_ARGS  )

Definition at line 2964 of file rtpg_mapalgebra.c.

References ovdump::band, rtpg_clip_arg_t::band, clamp_srid(), ES_NONE, ET_FIRST, ET_INTERSECTION, rtpg_clip_arg_t::extenttype, FALSE, gserialized_get_srid(), window::gt, rtpg_clip_band_t::hasnodata, lwgeom_force_2d(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_intersection(), lwgeom_is_empty(), lwgeom_ndims(), lwgeom_to_wkb(), rtpg_clip_arg_t::mask, rt_iterator_t::nband, rtpg_clip_band_t::nband, rt_iterator_t::nbnodata, rtpg_clip_band_t::nodataval, rtpg_clip_arg_t::numbands, PG_FUNCTION_INFO_V1(), POSTGIS_RT_DEBUG, POSTGIS_RT_DEBUGF, rt_iterator_t::raster, rtpg_clip_arg_t::raster, RASTER_reclass(), rt_band_get_hasnodata_flag(), rt_band_get_isnodata_flag(), rt_band_get_min_value(), rt_band_get_nodata(), rt_band_get_pixtype(), rt_raster_add_band(), rt_raster_deserialize(), rt_raster_destroy(), rt_raster_from_two_rasters(), rt_raster_gdal_rasterize(), rt_raster_generate_new_band(), rt_raster_get_band(), rt_raster_get_convex_hull(), rt_raster_get_geotransform_matrix(), rt_raster_get_num_bands(), rt_raster_get_srid(), rt_raster_has_band(), rt_raster_is_empty(), rt_raster_iterator(), rt_raster_new(), rt_raster_serialize(), rt_raster_set_srid(), rtpg_clip_arg_destroy(), rtpg_clip_arg_init(), rtpg_clip_callback(), rt_raster_serialized_t::size, rt_raster_serialized_t::srid, SRID_UNKNOWN, and WKB_SFSQL.

Referenced by rtpg_clip_callback().

2965 {
2966  rt_pgraster *pgraster = NULL;
2967  LWGEOM *rastgeom = NULL;
2968  double gt[6] = {0};
2969  int srid = SRID_UNKNOWN;
2970 
2971  rt_pgraster *pgrtn = NULL;
2972  rt_raster rtn = NULL;
2973 
2974  GSERIALIZED *gser = NULL;
2975  LWGEOM *geom = NULL;
2976  unsigned char *wkb = NULL;
2977  size_t wkb_len;
2978 
2979  ArrayType *array;
2980  Oid etype;
2981  Datum *e;
2982  bool *nulls;
2983 
2984  int16 typlen;
2985  bool typbyval;
2986  char typalign;
2987 
2988  int i = 0;
2989  int j = 0;
2990  int k = 0;
2991  rtpg_clip_arg arg = NULL;
2992  LWGEOM *tmpgeom = NULL;
2993  rt_iterator itrset;
2994 
2995  rt_raster _raster = NULL;
2996  rt_band band = NULL;
2997  rt_pixtype pixtype;
2998  int hasnodata;
2999  double nodataval;
3000  int noerr = 0;
3001 
3002  POSTGIS_RT_DEBUG(3, "Starting...");
3003 
3004  /* raster or geometry is NULL, return NULL */
3005  if (PG_ARGISNULL(0) || PG_ARGISNULL(2))
3006  PG_RETURN_NULL();
3007 
3008  /* init arg */
3009  arg = rtpg_clip_arg_init();
3010  if (arg == NULL) {
3011  elog(ERROR, "RASTER_clip: Could not initialize argument structure");
3012  PG_RETURN_NULL();
3013  }
3014 
3015  /* raster (0) */
3016  pgraster = (rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
3017 
3018  /* Get raster object */
3019  arg->raster = rt_raster_deserialize(pgraster, FALSE);
3020  if (arg->raster == NULL) {
3021  rtpg_clip_arg_destroy(arg);
3022  PG_FREE_IF_COPY(pgraster, 0);
3023  elog(ERROR, "RASTER_clip: Could not deserialize raster");
3024  PG_RETURN_NULL();
3025  }
3026 
3027  /* raster is empty, return empty raster */
3028  if (rt_raster_is_empty(arg->raster) || rt_raster_get_num_bands(arg->raster) == 0) {
3029  elog(NOTICE, "Input raster is empty or has no bands. Returning empty raster");
3030 
3031  rtpg_clip_arg_destroy(arg);
3032  PG_FREE_IF_COPY(pgraster, 0);
3033 
3034  rtn = rt_raster_new(0, 0);
3035  if (rtn == NULL) {
3036  elog(ERROR, "RASTER_clip: Could not create empty raster");
3037  PG_RETURN_NULL();
3038  }
3039 
3040  pgrtn = rt_raster_serialize(rtn);
3041  rt_raster_destroy(rtn);
3042  if (NULL == pgrtn)
3043  PG_RETURN_NULL();
3044 
3045  SET_VARSIZE(pgrtn, pgrtn->size);
3046  PG_RETURN_POINTER(pgrtn);
3047  }
3048 
3049  /* metadata */
3051  srid = clamp_srid(rt_raster_get_srid(arg->raster));
3052 
3053  /* geometry (2) */
3054  gser = PG_GETARG_GSERIALIZED_P(2);
3055  geom = lwgeom_from_gserialized(gser);
3056 
3057  /* Get a 2D version of the geometry if necessary */
3058  if (lwgeom_ndims(geom) > 2) {
3059  LWGEOM *geom2d = lwgeom_force_2d(geom);
3060  lwgeom_free(geom);
3061  geom = geom2d;
3062  }
3063 
3064  /* check that SRIDs match */
3065  if (srid != clamp_srid(gserialized_get_srid(gser))) {
3066  elog(NOTICE, "Geometry provided does not have the same SRID as the raster. Returning NULL");
3067 
3068  rtpg_clip_arg_destroy(arg);
3069  PG_FREE_IF_COPY(pgraster, 0);
3070  lwgeom_free(geom);
3071  PG_FREE_IF_COPY(gser, 2);
3072 
3073  PG_RETURN_NULL();
3074  }
3075 
3076  /* crop (4) */
3077  if (!PG_ARGISNULL(4) && !PG_GETARG_BOOL(4))
3078  arg->extenttype = ET_FIRST;
3079 
3080  /* get intersection geometry of input raster and input geometry */
3081  if (rt_raster_get_convex_hull(arg->raster, &rastgeom) != ES_NONE) {
3082 
3083  rtpg_clip_arg_destroy(arg);
3084  PG_FREE_IF_COPY(pgraster, 0);
3085  lwgeom_free(geom);
3086  PG_FREE_IF_COPY(gser, 2);
3087 
3088  elog(ERROR, "RASTER_clip: Could not get convex hull of raster");
3089  PG_RETURN_NULL();
3090  }
3091 
3092  tmpgeom = lwgeom_intersection(rastgeom, geom);
3093  lwgeom_free(rastgeom);
3094  lwgeom_free(geom);
3095  PG_FREE_IF_COPY(gser, 2);
3096  geom = tmpgeom;
3097 
3098  /* intersection is empty AND extent type is INTERSECTION, return empty */
3099  if (lwgeom_is_empty(geom) && arg->extenttype == ET_INTERSECTION) {
3100  elog(NOTICE, "The input raster and input geometry do not intersect. Returning empty raster");
3101 
3102  rtpg_clip_arg_destroy(arg);
3103  PG_FREE_IF_COPY(pgraster, 0);
3104  lwgeom_free(geom);
3105 
3106  rtn = rt_raster_new(0, 0);
3107  if (rtn == NULL) {
3108  elog(ERROR, "RASTER_clip: Could not create empty raster");
3109  PG_RETURN_NULL();
3110  }
3111 
3112  pgrtn = rt_raster_serialize(rtn);
3113  rt_raster_destroy(rtn);
3114  if (NULL == pgrtn)
3115  PG_RETURN_NULL();
3116 
3117  SET_VARSIZE(pgrtn, pgrtn->size);
3118  PG_RETURN_POINTER(pgrtn);
3119  }
3120 
3121  /* nband (1) */
3122  if (!PG_ARGISNULL(1)) {
3123  array = PG_GETARG_ARRAYTYPE_P(1);
3124  etype = ARR_ELEMTYPE(array);
3125  get_typlenbyvalalign(etype, &typlen, &typbyval, &typalign);
3126 
3127  switch (etype) {
3128  case INT2OID:
3129  case INT4OID:
3130  break;
3131  default:
3132  rtpg_clip_arg_destroy(arg);
3133  PG_FREE_IF_COPY(pgraster, 0);
3134  lwgeom_free(geom);
3135  elog(ERROR, "RASTER_clip: Invalid data type for band indexes");
3136  PG_RETURN_NULL();
3137  break;
3138  }
3139 
3140  deconstruct_array(
3141  array, etype,
3142  typlen, typbyval, typalign,
3143  &e, &nulls, &(arg->numbands)
3144  );
3145 
3146  arg->band = palloc(sizeof(struct rtpg_clip_band_t) * arg->numbands);
3147  if (arg->band == NULL) {
3148  rtpg_clip_arg_destroy(arg);
3149  PG_FREE_IF_COPY(pgraster, 0);
3150  lwgeom_free(geom);
3151  elog(ERROR, "RASTER_clip: Could not allocate memory for band arguments");
3152  PG_RETURN_NULL();
3153  }
3154 
3155  for (i = 0, j = 0; i < arg->numbands; i++) {
3156  if (nulls[i]) continue;
3157 
3158  switch (etype) {
3159  case INT2OID:
3160  arg->band[j].nband = DatumGetInt16(e[i]) - 1;
3161  break;
3162  case INT4OID:
3163  arg->band[j].nband = DatumGetInt32(e[i]) - 1;
3164  break;
3165  }
3166 
3167  j++;
3168  }
3169 
3170  if (j < arg->numbands) {
3171  arg->band = repalloc(arg->band, sizeof(struct rtpg_clip_band_t) * j);
3172  if (arg->band == NULL) {
3173  rtpg_clip_arg_destroy(arg);
3174  PG_FREE_IF_COPY(pgraster, 0);
3175  lwgeom_free(geom);
3176  elog(ERROR, "RASTER_clip: Could not reallocate memory for band arguments");
3177  PG_RETURN_NULL();
3178  }
3179 
3180  arg->numbands = j;
3181  }
3182 
3183  /* validate band */
3184  for (i = 0; i < arg->numbands; i++) {
3185  if (!rt_raster_has_band(arg->raster, arg->band[i].nband)) {
3186  elog(NOTICE, "Band at index %d not found in raster", arg->band[i].nband + 1);
3187  rtpg_clip_arg_destroy(arg);
3188  PG_FREE_IF_COPY(pgraster, 0);
3189  lwgeom_free(geom);
3190  PG_RETURN_NULL();
3191  }
3192 
3193  arg->band[i].hasnodata = 0;
3194  arg->band[i].nodataval = 0;
3195  }
3196  }
3197  else {
3199 
3200  /* raster may have no bands */
3201  if (arg->numbands) {
3202  arg->band = palloc(sizeof(struct rtpg_clip_band_t) * arg->numbands);
3203  if (arg->band == NULL) {
3204 
3205  rtpg_clip_arg_destroy(arg);
3206  PG_FREE_IF_COPY(pgraster, 0);
3207  lwgeom_free(geom);
3208 
3209  elog(ERROR, "RASTER_clip: Could not allocate memory for band arguments");
3210  PG_RETURN_NULL();
3211  }
3212 
3213  for (i = 0; i < arg->numbands; i++) {
3214  arg->band[i].nband = i;
3215  arg->band[i].hasnodata = 0;
3216  arg->band[i].nodataval = 0;
3217  }
3218  }
3219  }
3220 
3221  /* nodataval (3) */
3222  if (!PG_ARGISNULL(3)) {
3223  array = PG_GETARG_ARRAYTYPE_P(3);
3224  etype = ARR_ELEMTYPE(array);
3225  get_typlenbyvalalign(etype, &typlen, &typbyval, &typalign);
3226 
3227  switch (etype) {
3228  case FLOAT4OID:
3229  case FLOAT8OID:
3230  break;
3231  default:
3232  rtpg_clip_arg_destroy(arg);
3233  PG_FREE_IF_COPY(pgraster, 0);
3234  lwgeom_free(geom);
3235  elog(ERROR, "RASTER_clip: Invalid data type for NODATA values");
3236  PG_RETURN_NULL();
3237  break;
3238  }
3239 
3240  deconstruct_array(
3241  array, etype,
3242  typlen, typbyval, typalign,
3243  &e, &nulls, &k
3244  );
3245 
3246  /* it doesn't matter if there are more nodataval */
3247  for (i = 0, j = 0; i < arg->numbands; i++, j++) {
3248  /* cap j to the last nodataval element */
3249  if (j >= k)
3250  j = k - 1;
3251 
3252  if (nulls[j])
3253  continue;
3254 
3255  arg->band[i].hasnodata = 1;
3256  switch (etype) {
3257  case FLOAT4OID:
3258  arg->band[i].nodataval = DatumGetFloat4(e[j]);
3259  break;
3260  case FLOAT8OID:
3261  arg->band[i].nodataval = DatumGetFloat8(e[j]);
3262  break;
3263  }
3264  }
3265  }
3266 
3267  /* get wkb of geometry */
3268  POSTGIS_RT_DEBUG(3, "getting wkb of geometry");
3269  wkb = lwgeom_to_wkb(geom, WKB_SFSQL, &wkb_len);
3270  lwgeom_free(geom);
3271 
3272  /* rasterize geometry */
3274  wkb, wkb_len,
3275  NULL,
3276  0, NULL,
3277  NULL, NULL,
3278  NULL, NULL,
3279  NULL, NULL,
3280  &(gt[1]), &(gt[5]),
3281  NULL, NULL,
3282  &(gt[0]), &(gt[3]),
3283  &(gt[2]), &(gt[4]),
3284  NULL
3285  );
3286 
3287  pfree(wkb);
3288  if (arg->mask == NULL) {
3289  rtpg_clip_arg_destroy(arg);
3290  PG_FREE_IF_COPY(pgraster, 0);
3291  elog(ERROR, "RASTER_clip: Could not rasterize intersection geometry");
3292  PG_RETURN_NULL();
3293  }
3294 
3295  /* set SRID */
3296  rt_raster_set_srid(arg->mask, srid);
3297 
3298  /* run iterator */
3299 
3300  /* init itrset */
3301  itrset = palloc(sizeof(struct rt_iterator_t) * 2);
3302  if (itrset == NULL) {
3303  rtpg_clip_arg_destroy(arg);
3304  PG_FREE_IF_COPY(pgraster, 0);
3305  elog(ERROR, "RASTER_clip: Could not allocate memory for iterator arguments");
3306  PG_RETURN_NULL();
3307  }
3308 
3309  /* one band at a time */
3310  for (i = 0; i < arg->numbands; i++) {
3311  POSTGIS_RT_DEBUGF(4, "band arg %d (nband, hasnodata, nodataval) = (%d, %d, %f)",
3312  i, arg->band[i].nband, arg->band[i].hasnodata, arg->band[i].nodataval);
3313 
3314  band = rt_raster_get_band(arg->raster, arg->band[i].nband);
3315 
3316  /* band metadata */
3317  pixtype = rt_band_get_pixtype(band);
3318 
3319  if (arg->band[i].hasnodata) {
3320  hasnodata = 1;
3321  nodataval = arg->band[i].nodataval;
3322  }
3323  else if (rt_band_get_hasnodata_flag(band)) {
3324  hasnodata = 1;
3325  rt_band_get_nodata(band, &nodataval);
3326  }
3327  else {
3328  hasnodata = 0;
3329  nodataval = rt_band_get_min_value(band);
3330  }
3331 
3332  /* band is NODATA, create NODATA band and continue */
3333  if (rt_band_get_isnodata_flag(band)) {
3334  /* create raster */
3335  if (rtn == NULL) {
3336  noerr = rt_raster_from_two_rasters(arg->raster, arg->mask, arg->extenttype, &rtn, NULL);
3337  if (noerr != ES_NONE) {
3338  rtpg_clip_arg_destroy(arg);
3339  PG_FREE_IF_COPY(pgraster, 0);
3340  elog(ERROR, "RASTER_clip: Could not create output raster");
3341  PG_RETURN_NULL();
3342  }
3343  }
3344 
3345  /* create NODATA band */
3346  if (rt_raster_generate_new_band(rtn, pixtype, nodataval, hasnodata, nodataval, i) < 0) {
3347  rt_raster_destroy(rtn);
3348  rtpg_clip_arg_destroy(arg);
3349  PG_FREE_IF_COPY(pgraster, 0);
3350  elog(ERROR, "RASTER_clip: Could not add NODATA band to output raster");
3351  PG_RETURN_NULL();
3352  }
3353 
3354  continue;
3355  }
3356 
3357  /* raster */
3358  itrset[0].raster = arg->raster;
3359  itrset[0].nband = arg->band[i].nband;
3360  itrset[0].nbnodata = 1;
3361 
3362  /* mask */
3363  itrset[1].raster = arg->mask;
3364  itrset[1].nband = 0;
3365  itrset[1].nbnodata = 1;
3366 
3367  /* pass to iterator */
3368  noerr = rt_raster_iterator(
3369  itrset, 2,
3370  arg->extenttype, NULL,
3371  pixtype,
3372  hasnodata, nodataval,
3373  0, 0,
3374  NULL,
3375  NULL,
3377  &_raster
3378  );
3379 
3380  if (noerr != ES_NONE) {
3381  pfree(itrset);
3382  rtpg_clip_arg_destroy(arg);
3383  if (rtn != NULL) rt_raster_destroy(rtn);
3384  PG_FREE_IF_COPY(pgraster, 0);
3385  elog(ERROR, "RASTER_clip: Could not run raster iterator function");
3386  PG_RETURN_NULL();
3387  }
3388 
3389  /* new raster */
3390  if (rtn == NULL)
3391  rtn = _raster;
3392  /* copy band */
3393  else {
3394  band = rt_raster_get_band(_raster, 0);
3395  if (band == NULL) {
3396  pfree(itrset);
3397  rtpg_clip_arg_destroy(arg);
3398  rt_raster_destroy(_raster);
3399  rt_raster_destroy(rtn);
3400  PG_FREE_IF_COPY(pgraster, 0);
3401  elog(ERROR, "RASTER_clip: Could not get band from working raster");
3402  PG_RETURN_NULL();
3403  }
3404 
3405  if (rt_raster_add_band(rtn, band, i) < 0) {
3406  pfree(itrset);
3407  rtpg_clip_arg_destroy(arg);
3408  rt_raster_destroy(_raster);
3409  rt_raster_destroy(rtn);
3410  PG_FREE_IF_COPY(pgraster, 0);
3411  elog(ERROR, "RASTER_clip: Could not add new band to output raster");
3412  PG_RETURN_NULL();
3413  }
3414 
3415  rt_raster_destroy(_raster);
3416  }
3417  }
3418 
3419  pfree(itrset);
3420  rtpg_clip_arg_destroy(arg);
3421  PG_FREE_IF_COPY(pgraster, 0);
3422 
3423  pgrtn = rt_raster_serialize(rtn);
3424  rt_raster_destroy(rtn);
3425 
3426  POSTGIS_RT_DEBUG(3, "Finished");
3427 
3428  if (!pgrtn)
3429  PG_RETURN_NULL();
3430 
3431  SET_VARSIZE(pgrtn, pgrtn->size);
3432  PG_RETURN_POINTER(pgrtn);
3433 }
int clamp_srid(int srid)
Return a valid SRID from an arbitrary integer Raises a notice if what comes out is different from wha...
Definition: lwutil.c:350
void * rt_raster_serialize(rt_raster raster)
Return this raster in serialized form.
Definition: rt_serialize.c:521
int rt_raster_get_num_bands(rt_raster raster)
Definition: rt_raster.c:372
static void rtpg_clip_arg_destroy(rtpg_clip_arg arg)
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void rt_raster_get_geotransform_matrix(rt_raster raster, double *gt)
Get 6-element array of raster geotransform matrix.
Definition: rt_raster.c:706
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1050
band
Definition: ovdump.py:57
rt_errorstate rt_raster_from_two_rasters(rt_raster rast1, rt_raster rast2, rt_extenttype extenttype, rt_raster *rtnraster, double *offset)
Definition: rt_raster.c:3444
rt_raster rt_raster_gdal_rasterize(const unsigned char *wkb, uint32_t wkb_len, const char *srs, uint32_t num_bands, rt_pixtype *pixtype, double *init, double *value, double *nodata, uint8_t *hasnodata, int *width, int *height, double *scale_x, double *scale_y, double *ul_xw, double *ul_yw, double *grid_xw, double *grid_yw, double *skew_x, double *skew_y, char **options)
Return a raster of the provided geometry.
Definition: rt_raster.c:2492
gt
Definition: window.py:77
rt_pixtype
Definition: librtcore.h:197
static int rtpg_clip_callback(rt_iterator_arg arg, void *userarg, double *value, int *nodata)
int lwgeom_ndims(const LWGEOM *geom)
Return the number of dimensions (2, 3, 4) in a geometry.
Definition: lwgeom.c:850
#define WKB_SFSQL
Definition: liblwgeom.h:1931
int rt_raster_is_empty(rt_raster raster)
Return TRUE if the raster is empty.
Definition: rt_raster.c:1338
#define POSTGIS_RT_DEBUGF(level, msg,...)
Definition: rtpostgis.h:57
rt_errorstate rt_band_get_nodata(rt_band band, double *nodata)
Get NODATA value.
Definition: rt_band.c:1597
rt_errorstate rt_raster_get_convex_hull(rt_raster raster, LWGEOM **hull)
Get raster&#39;s convex hull.
Definition: rt_geometry.c:822
rt_extenttype extenttype
uint8_t * lwgeom_to_wkb(const LWGEOM *geom, uint8_t variant, size_t *size_out)
Convert LWGEOM to a char* in WKB format.
Definition: lwout_wkb.c:750
int rt_raster_generate_new_band(rt_raster raster, rt_pixtype pixtype, double initialvalue, uint32_t hasnodata, double nodatavalue, int index)
Generate a new inline band and add it to a raster.
Definition: rt_raster.c:485
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:172
LWGEOM * lwgeom_intersection(const LWGEOM *geom1, const LWGEOM *geom2)
LWGEOM * lwgeom_force_2d(const LWGEOM *geom)
Strip out the Z/M components of an LWGEOM.
Definition: lwgeom.c:690
rt_band rt_raster_get_band(rt_raster raster, int bandNum)
Return Nth band, or NULL if unavailable.
Definition: rt_raster.c:381
int rt_band_get_hasnodata_flag(rt_band band)
Get hasnodata flag value.
Definition: rt_band.c:541
int rt_raster_has_band(rt_raster raster, int nband)
Return TRUE if the raster has a band of this number.
Definition: rt_raster.c:1351
void rt_raster_set_srid(rt_raster raster, int32_t srid)
Set raster&#39;s SRID.
Definition: rt_raster.c:363
int32_t rt_raster_get_srid(rt_raster raster)
Get raster&#39;s SRID.
Definition: rt_raster.c:356
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_raster.c:82
rt_raster raster
Definition: librtcore.h:2406
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
Definition: rt_raster.c:48
uint16_t nband
Definition: librtcore.h:2407
rtpg_clip_band band
#define FALSE
Definition: dbfopen.c:168
uint8_t nbnodata
Definition: librtcore.h:2408
Struct definitions.
Definition: librtcore.h:2213
double rt_band_get_min_value(rt_band band)
Returns the minimal possible value for the band according to the pixel type.
Definition: rt_band.c:1612
rt_errorstate rt_raster_iterator(rt_iterator itrset, uint16_t itrcount, rt_extenttype extenttype, rt_raster customextent, rt_pixtype pixtype, uint8_t hasnodata, double nodataval, uint16_t distancex, uint16_t distancey, rt_mask mask, void *userarg, int(*callback)(rt_iterator_arg arg, void *userarg, double *value, int *nodata), rt_raster *rtnraster)
n-raster iterator.
static rtpg_clip_arg rtpg_clip_arg_init()
rt_pixtype rt_band_get_pixtype(rt_band band)
Return pixeltype of this band.
Definition: rt_band.c:498
int rt_raster_add_band(rt_raster raster, rt_band band, int index)
Add band data to a raster.
Definition: rt_raster.c:405
int rt_band_get_isnodata_flag(rt_band band)
Get isnodata flag value.
Definition: rt_band.c:581
#define POSTGIS_RT_DEBUG(level, msg)
Definition: rtpostgis.h:53
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
Definition: lwgeom.c:1297
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
Definition: rt_serialize.c:717
int32_t gserialized_get_srid(const GSERIALIZED *s)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
Definition: g_serialized.c:69
Here is the call graph for this function:
Here is the caller graph for this function: