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

Definition at line 3828 of file rt_pg.c.

References ovdump::band, clamp_srid(), ES_NONE, ET_FIRST, FALSE, rtpg_setvaluesgv_geomval_t::geom, LWCOLLECTION::geoms, getPoint2d_p(), gserialized_get_srid(), gserialized_get_type(), window::gt, rtpg_setvaluesgv_arg_t::gv, rtpg_setvaluesgv_arg_t::keepnodata, lwgeom_as_lwcollection(), lwgeom_as_lwpoint(), lwgeom_as_multi(), lwgeom_force_2d(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_is_empty(), lwgeom_ndims(), lwgeom_to_wkb(), rtpg_setvaluesgv_geomval_t::mask, MULTIPOINTTYPE, pixval::nband, rt_iterator_t::nband, rt_iterator_t::nbnodata, LWCOLLECTION::ngeoms, rtpg_setvaluesgv_arg_t::ngv, rtpg_setvaluesgv_geomval_t::nodata, rtpg_setvaluesgv_geomval_t::pixval, LWPOINT::point, POINTTYPE, POSTGIS_RT_DEBUG, POSTGIS_RT_DEBUGF, PT_END, rtrowdump::raster, rt_iterator_t::raster, rt_band_destroy(), rt_band_get_hasnodata_flag(), rt_band_get_isnodata_flag(), rt_band_get_nodata(), rt_band_get_pixel(), rt_band_get_pixtype(), rt_band_set_pixel(), rt_raster_deserialize(), rt_raster_destroy(), rt_raster_gdal_rasterize(), rt_raster_geopoint_to_cell(), rt_raster_get_band(), rt_raster_get_geotransform_matrix(), rt_raster_get_height(), rt_raster_get_inverse_geotransform_matrix(), rt_raster_get_num_bands(), rt_raster_get_srid(), rt_raster_get_width(), rt_raster_iterator(), rt_raster_replace_band(), rt_raster_serialize(), rt_raster_set_srid(), rtpg_setvalues_geomval_callback(), rtpg_setvaluesgv_arg_destroy(), rtpg_setvaluesgv_arg_init(), rt_raster_serialized_t::size, genraster::value, rtpg_setvaluesgv_geomval_t::value, WKB_SFSQL, POINT2D::x, and POINT2D::y.

3829 {
3830  rt_pgraster *pgraster = NULL;
3831  rt_pgraster *pgrtn = NULL;
3832  rt_raster raster = NULL;
3833  rt_band band = NULL;
3834  rt_raster _raster = NULL;
3835  rt_band _band = NULL;
3836  int nband = 0; /* 1-based */
3837 
3838  int numbands = 0;
3839  int width = 0;
3840  int height = 0;
3841  int srid = 0;
3842  double gt[6] = {0};
3843 
3844  rt_pixtype pixtype = PT_END;
3845  int hasnodata = 0;
3846  double nodataval = 0;
3847 
3848  rtpg_setvaluesgv_arg arg = NULL;
3849  int allpoint = 0;
3850 
3851  ArrayType *array;
3852  Oid etype;
3853  Datum *e;
3854  bool *nulls;
3855  int16 typlen;
3856  bool typbyval;
3857  char typalign;
3858  int n = 0;
3859 
3860  HeapTupleHeader tup;
3861  bool isnull;
3862  Datum tupv;
3863 
3864  GSERIALIZED *gser = NULL;
3865  uint8_t gtype;
3866  unsigned char *wkb = NULL;
3867  size_t wkb_len;
3868 
3869  int i = 0;
3870  int j = 0;
3871  int noerr = 1;
3872 
3873  /* pgraster is null, return null */
3874  if (PG_ARGISNULL(0))
3875  PG_RETURN_NULL();
3876  pgraster = (rt_pgraster *) PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0));
3877 
3878  /* raster */
3879  raster = rt_raster_deserialize(pgraster, FALSE);
3880  if (!raster) {
3881  PG_FREE_IF_COPY(pgraster, 0);
3882  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not deserialize raster");
3883  PG_RETURN_NULL();
3884  }
3885 
3886  /* raster attributes */
3887  numbands = rt_raster_get_num_bands(raster);
3888  width = rt_raster_get_width(raster);
3889  height = rt_raster_get_height(raster);
3890  srid = clamp_srid(rt_raster_get_srid(raster));
3892 
3893  /* nband */
3894  if (PG_ARGISNULL(1)) {
3895  elog(NOTICE, "Band index cannot be NULL. Value must be 1-based. Returning original raster");
3896  rt_raster_destroy(raster);
3897  PG_RETURN_POINTER(pgraster);
3898  }
3899 
3900  nband = PG_GETARG_INT32(1);
3901  if (nband < 1 || nband > numbands) {
3902  elog(NOTICE, "Band index is invalid. Value must be 1-based. Returning original raster");
3903  rt_raster_destroy(raster);
3904  PG_RETURN_POINTER(pgraster);
3905  }
3906 
3907  /* get band attributes */
3908  band = rt_raster_get_band(raster, nband - 1);
3909  pixtype = rt_band_get_pixtype(band);
3910  hasnodata = rt_band_get_hasnodata_flag(band);
3911  if (hasnodata)
3912  rt_band_get_nodata(band, &nodataval);
3913 
3914  /* array of geomval (2) */
3915  if (PG_ARGISNULL(2)) {
3916  elog(NOTICE, "No values to set. Returning original raster");
3917  rt_raster_destroy(raster);
3918  PG_RETURN_POINTER(pgraster);
3919  }
3920 
3921  array = PG_GETARG_ARRAYTYPE_P(2);
3922  etype = ARR_ELEMTYPE(array);
3923  get_typlenbyvalalign(etype, &typlen, &typbyval, &typalign);
3924 
3925  deconstruct_array(
3926  array,
3927  etype,
3928  typlen, typbyval, typalign,
3929  &e, &nulls, &n
3930  );
3931 
3932  if (!n) {
3933  elog(NOTICE, "No values to set. Returning original raster");
3934  rt_raster_destroy(raster);
3935  PG_RETURN_POINTER(pgraster);
3936  }
3937 
3938  /* init arg */
3939  arg = rtpg_setvaluesgv_arg_init();
3940  if (arg == NULL) {
3941  rt_raster_destroy(raster);
3942  PG_FREE_IF_COPY(pgraster, 0);
3943  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not intialize argument structure");
3944  PG_RETURN_NULL();
3945  }
3946 
3947  arg->gv = palloc(sizeof(struct rtpg_setvaluesgv_geomval_t) * n);
3948  if (arg->gv == NULL) {
3950  rt_raster_destroy(raster);
3951  PG_FREE_IF_COPY(pgraster, 0);
3952  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not allocate memory for geomval array");
3953  PG_RETURN_NULL();
3954  }
3955 
3956  /* process each element */
3957  arg->ngv = 0;
3958  for (i = 0; i < n; i++) {
3959  if (nulls[i])
3960  continue;
3961 
3962  arg->gv[arg->ngv].pixval.nodata = 0;
3963  arg->gv[arg->ngv].pixval.value = 0;
3964  arg->gv[arg->ngv].geom = NULL;
3965  arg->gv[arg->ngv].mask = NULL;
3966 
3967  /* each element is a tuple */
3968  tup = (HeapTupleHeader) DatumGetPointer(e[i]);
3969  if (NULL == tup) {
3971  rt_raster_destroy(raster);
3972  PG_FREE_IF_COPY(pgraster, 0);
3973  elog(ERROR, "RASTER_setPixelValuesGeomval: Invalid argument for geomval at index %d", i);
3974  PG_RETURN_NULL();
3975  }
3976 
3977  /* first element, geometry */
3978  POSTGIS_RT_DEBUG(4, "Processing first element (geometry)");
3979  tupv = GetAttributeByName(tup, "geom", &isnull);
3980  if (isnull) {
3981  elog(NOTICE, "First argument (geom) of geomval at index %d is NULL. Skipping", i);
3982  continue;
3983  }
3984 
3985  gser = (GSERIALIZED *) PG_DETOAST_DATUM(tupv);
3986  arg->gv[arg->ngv].geom = lwgeom_from_gserialized(gser);
3987  if (arg->gv[arg->ngv].geom == NULL) {
3989  rt_raster_destroy(raster);
3990  PG_FREE_IF_COPY(pgraster, 0);
3991  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not deserialize geometry of geomval at index %d", i);
3992  PG_RETURN_NULL();
3993  }
3994 
3995  /* empty geometry */
3996  if (lwgeom_is_empty(arg->gv[arg->ngv].geom)) {
3997  elog(NOTICE, "First argument (geom) of geomval at index %d is an empty geometry. Skipping", i);
3998  continue;
3999  }
4000 
4001  /* check SRID */
4002  if (clamp_srid(gserialized_get_srid(gser)) != srid) {
4003  elog(NOTICE, "Geometry provided for geomval at index %d does not have the same SRID as the raster: %d. Returning original raster", i, srid);
4005  rt_raster_destroy(raster);
4006  PG_RETURN_POINTER(pgraster);
4007  }
4008 
4009  /* Get a 2D version of the geometry if necessary */
4010  if (lwgeom_ndims(arg->gv[arg->ngv].geom) > 2) {
4011  LWGEOM *geom2d = lwgeom_force_2d(arg->gv[arg->ngv].geom);
4012  lwgeom_free(arg->gv[arg->ngv].geom);
4013  arg->gv[arg->ngv].geom = geom2d;
4014  }
4015 
4016  /* filter for types */
4017  gtype = gserialized_get_type(gser);
4018 
4019  /* shortcuts for POINT and MULTIPOINT */
4020  if (gtype == POINTTYPE || gtype == MULTIPOINTTYPE)
4021  allpoint++;
4022 
4023  /* get wkb of geometry */
4024  POSTGIS_RT_DEBUG(3, "getting wkb of geometry");
4025  wkb = lwgeom_to_wkb(arg->gv[arg->ngv].geom, WKB_SFSQL, &wkb_len);
4026 
4027  /* rasterize geometry */
4028  arg->gv[arg->ngv].mask = rt_raster_gdal_rasterize(
4029  wkb, wkb_len,
4030  NULL,
4031  0, NULL,
4032  NULL, NULL,
4033  NULL, NULL,
4034  NULL, NULL,
4035  &(gt[1]), &(gt[5]),
4036  NULL, NULL,
4037  &(gt[0]), &(gt[3]),
4038  &(gt[2]), &(gt[4]),
4039  NULL
4040  );
4041 
4042  pfree(wkb);
4043  if (gtype != POINTTYPE && gtype != MULTIPOINTTYPE) {
4044  lwgeom_free(arg->gv[arg->ngv].geom);
4045  arg->gv[arg->ngv].geom = NULL;
4046  }
4047 
4048  if (arg->gv[arg->ngv].mask == NULL) {
4050  rt_raster_destroy(raster);
4051  PG_FREE_IF_COPY(pgraster, 0);
4052  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not rasterize geometry of geomval at index %d", i);
4053  PG_RETURN_NULL();
4054  }
4055 
4056  /* set SRID */
4057  rt_raster_set_srid(arg->gv[arg->ngv].mask, srid);
4058 
4059  /* second element, value */
4060  POSTGIS_RT_DEBUG(4, "Processing second element (val)");
4061  tupv = GetAttributeByName(tup, "val", &isnull);
4062  if (isnull) {
4063  elog(NOTICE, "Second argument (val) of geomval at index %d is NULL. Treating as NODATA", i);
4064  arg->gv[arg->ngv].pixval.nodata = 1;
4065  }
4066  else
4067  arg->gv[arg->ngv].pixval.value = DatumGetFloat8(tupv);
4068 
4069  (arg->ngv)++;
4070  }
4071 
4072  /* redim arg->gv if needed */
4073  if (arg->ngv < n) {
4074  arg->gv = repalloc(arg->gv, sizeof(struct rtpg_setvaluesgv_geomval_t) * arg->ngv);
4075  if (arg->gv == NULL) {
4077  rt_raster_destroy(raster);
4078  PG_FREE_IF_COPY(pgraster, 0);
4079  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not reallocate memory for geomval array");
4080  PG_RETURN_NULL();
4081  }
4082  }
4083 
4084  /* keepnodata */
4085  if (!PG_ARGISNULL(3))
4086  arg->keepnodata = PG_GETARG_BOOL(3);
4087  POSTGIS_RT_DEBUGF(3, "keepnodata = %d", arg->keepnodata);
4088 
4089  /* keepnodata = TRUE and band is NODATA */
4090  if (arg->keepnodata && rt_band_get_isnodata_flag(band)) {
4091  POSTGIS_RT_DEBUG(3, "keepnodata = TRUE and band is NODATA. Not doing anything");
4092  }
4093  /* all elements are points */
4094  else if (allpoint == arg->ngv) {
4095  double igt[6] = {0};
4096  double xy[2] = {0};
4097  double value = 0;
4098  int isnodata = 0;
4099 
4100  LWCOLLECTION *coll = NULL;
4101  LWPOINT *point = NULL;
4102  POINT2D p;
4103 
4104  POSTGIS_RT_DEBUG(3, "all geometries are points, using direct to pixel method");
4105 
4106  /* cache inverse gretransform matrix */
4108 
4109  /* process each geometry */
4110  for (i = 0; i < arg->ngv; i++) {
4111  /* convert geometry to collection */
4112  coll = lwgeom_as_lwcollection(lwgeom_as_multi(arg->gv[i].geom));
4113 
4114  /* process each point in collection */
4115  for (j = 0; j < coll->ngeoms; j++) {
4116  point = lwgeom_as_lwpoint(coll->geoms[j]);
4117  getPoint2d_p(point->point, 0, &p);
4118 
4119  if (rt_raster_geopoint_to_cell(raster, p.x, p.y, &(xy[0]), &(xy[1]), igt) != ES_NONE) {
4121  rt_raster_destroy(raster);
4122  PG_FREE_IF_COPY(pgraster, 0);
4123  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not process coordinates of point");
4124  PG_RETURN_NULL();
4125  }
4126 
4127  /* skip point if outside raster */
4128  if (
4129  (xy[0] < 0 || xy[0] >= width) ||
4130  (xy[1] < 0 || xy[1] >= height)
4131  ) {
4132  elog(NOTICE, "Point is outside raster extent. Skipping");
4133  continue;
4134  }
4135 
4136  /* get pixel value */
4137  if (rt_band_get_pixel(band, xy[0], xy[1], &value, &isnodata) != ES_NONE) {
4139  rt_raster_destroy(raster);
4140  PG_FREE_IF_COPY(pgraster, 0);
4141  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not get pixel value");
4142  PG_RETURN_NULL();
4143  }
4144 
4145  /* keepnodata = TRUE AND pixel value is NODATA */
4146  if (arg->keepnodata && isnodata)
4147  continue;
4148 
4149  /* set pixel */
4150  if (arg->gv[i].pixval.nodata)
4151  noerr = rt_band_set_pixel(band, xy[0], xy[1], nodataval, NULL);
4152  else
4153  noerr = rt_band_set_pixel(band, xy[0], xy[1], arg->gv[i].pixval.value, NULL);
4154 
4155  if (noerr != ES_NONE) {
4157  rt_raster_destroy(raster);
4158  PG_FREE_IF_COPY(pgraster, 0);
4159  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not set pixel value");
4160  PG_RETURN_NULL();
4161  }
4162  }
4163  }
4164  }
4165  /* run iterator otherwise */
4166  else {
4167  rt_iterator itrset;
4168 
4169  POSTGIS_RT_DEBUG(3, "a mix of geometries, using iterator method");
4170 
4171  /* init itrset */
4172  itrset = palloc(sizeof(struct rt_iterator_t) * (arg->ngv + 1));
4173  if (itrset == NULL) {
4175  rt_raster_destroy(raster);
4176  PG_FREE_IF_COPY(pgraster, 0);
4177  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not allocate memory for iterator arguments");
4178  PG_RETURN_NULL();
4179  }
4180 
4181  /* set first raster's info */
4182  itrset[0].raster = raster;
4183  itrset[0].nband = nband - 1;
4184  itrset[0].nbnodata = 1;
4185 
4186  /* set other raster's info */
4187  for (i = 0, j = 1; i < arg->ngv; i++, j++) {
4188  itrset[j].raster = arg->gv[i].mask;
4189  itrset[j].nband = 0;
4190  itrset[j].nbnodata = 1;
4191  }
4192 
4193  /* pass to iterator */
4194  noerr = rt_raster_iterator(
4195  itrset, arg->ngv + 1,
4196  ET_FIRST, NULL,
4197  pixtype,
4198  hasnodata, nodataval,
4199  0, 0,
4200  arg,
4202  &_raster
4203  );
4204  pfree(itrset);
4205 
4206  if (noerr != ES_NONE) {
4208  rt_raster_destroy(raster);
4209  PG_FREE_IF_COPY(pgraster, 0);
4210  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not run raster iterator function");
4211  PG_RETURN_NULL();
4212  }
4213 
4214  /* copy band from _raster to raster */
4215  _band = rt_raster_get_band(_raster, 0);
4216  if (_band == NULL) {
4218  rt_raster_destroy(_raster);
4219  rt_raster_destroy(raster);
4220  PG_FREE_IF_COPY(pgraster, 0);
4221  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not get band from working raster");
4222  PG_RETURN_NULL();
4223  }
4224 
4225  _band = rt_raster_replace_band(raster, _band, nband - 1);
4226  if (_band == NULL) {
4228  rt_raster_destroy(_raster);
4229  rt_raster_destroy(raster);
4230  PG_FREE_IF_COPY(pgraster, 0);
4231  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not replace band in output raster");
4232  PG_RETURN_NULL();
4233  }
4234 
4235  rt_band_destroy(_band);
4236  rt_raster_destroy(_raster);
4237  }
4238 
4240 
4241  pgrtn = rt_raster_serialize(raster);
4242  rt_raster_destroy(raster);
4243  PG_FREE_IF_COPY(pgraster, 0);
4244 
4245  POSTGIS_RT_DEBUG(3, "Finished");
4246 
4247  if (!pgrtn)
4248  PG_RETURN_NULL();
4249 
4250  SET_VARSIZE(pgrtn, pgrtn->size);
4251  PG_RETURN_POINTER(pgrtn);
4252 }
uint32_t gserialized_get_type(const GSERIALIZED *s)
Extract the geometry type from the serialized form (it hides in the anonymous data area...
Definition: g_serialized.c:56
int rt_raster_get_num_bands(rt_raster raster)
Definition: rt_api.c:5677
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:326
void * rt_raster_serialize(rt_raster raster)
Return this raster in serialized form.
Definition: rt_api.c:8158
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_api.c:5387
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1006
tuple gt
Definition: window.py:79
#define MULTIPOINTTYPE
Definition: liblwgeom.h:63
Definition: rt_api.h:184
rtpg_setvaluesgv_geomval gv
Definition: rt_pg.c:3731
rt_pixtype rt_band_get_pixtype(rt_band band)
Return pixeltype of this band.
Definition: rt_api.c:1900
rt_band rt_raster_replace_band(rt_raster raster, rt_band band, int index)
Replace band at provided index with new band.
Definition: rt_api.c:8702
tuple band
Definition: ovdump.py:57
tuple raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:123
LWGEOM * lwgeom_as_multi(const LWGEOM *lwgeom)
Create a new LWGEOM of the appropriate MULTI* type.
Definition: lwgeom.c:284
void rt_raster_set_srid(rt_raster raster, int32_t srid)
Set raster's SRID.
Definition: rt_api.c:5668
int32_t rt_raster_get_srid(rt_raster raster)
Get raster's SRID.
Definition: rt_api.c:5661
LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
Definition: lwgeom.c:80
POINTARRAY * point
Definition: liblwgeom.h:367
int rt_band_get_isnodata_flag(rt_band band)
Get isnodata flag value.
Definition: rt_api.c:2042
int lwgeom_ndims(const LWGEOM *geom)
Return the number of dimensions (2, 3, 4) in a geometry.
Definition: lwgeom.c:806
#define WKB_SFSQL
Definition: liblwgeom.h:1768
void rt_raster_get_geotransform_matrix(rt_raster raster, double *gt)
Get 6-element array of raster geotransform matrix.
Definition: rt_api.c:6005
double x
Definition: liblwgeom.h:284
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:692
rt_pixtype
Definition: rt_api.h:172
static rtpg_setvaluesgv_arg rtpg_setvaluesgv_arg_init()
Definition: rt_pg.c:3746
rt_errorstate rt_raster_get_inverse_geotransform_matrix(rt_raster raster, double *gt, double *igt)
Get 6-element array of raster inverse geotransform matrix.
Definition: rt_api.c:5975
#define POSTGIS_RT_DEBUG(level, msg)
Definition: rt_pg.h:58
tuple nband
Definition: pixval.py:52
LWGEOM ** geoms
Definition: liblwgeom.h:465
static void rtpg_setvaluesgv_arg_destroy(rtpg_setvaluesgv_arg arg)
Definition: rt_pg.c:3760
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_api.c:10620
rt_errorstate rt_band_get_nodata(rt_band band, double *nodata)
Get NODATA value.
Definition: rt_api.c:3058
rt_errorstate rt_band_get_pixel(rt_band band, int x, int y, double *value, int *nodata)
Get pixel value.
Definition: rt_api.c:2549
LWGEOM * lwgeom_force_2d(const LWGEOM *geom)
Strip out the Z/M components of an LWGEOM.
Definition: lwgeom.c:646
rt_raster raster
Definition: rt_api.h:2360
double y
Definition: liblwgeom.h:284
int getPoint2d_p(const POINTARRAY *pa, int n, POINT2D *point)
Definition: lwgeom_api.c:434
void rt_band_destroy(rt_band band)
Destroy a raster band.
Definition: rt_api.c:1650
uint16_t nband
Definition: rt_api.h:2361
uint16_t rt_raster_get_height(rt_raster raster)
Definition: rt_api.c:5434
rt_band rt_raster_get_band(rt_raster raster, int n)
Return Nth band, or NULL if unavailable.
Definition: rt_api.c:5686
#define FALSE
Definition: dbfopen.c:169
uint8_t nbnodata
Definition: rt_api.h:2362
Struct definitions.
Definition: rt_api.h:2175
struct rtpg_setvaluesgv_geomval_t::@16 pixval
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
Definition: lwgeom.c:143
#define POSTGIS_RT_DEBUGF(level, msg,...)
Definition: rt_pg.h:62
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
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, void *userarg, int(*callback)(rt_iterator_arg arg, void *userarg, double *value, int *nodata), rt_raster *rtnraster)
n-raster iterator.
Definition: rt_api.c:13927
rt_errorstate rt_raster_geopoint_to_cell(rt_raster raster, double xw, double yw, double *xr, double *yr, double *igt)
Convert an xw,yw map point to a xr,yr raster point.
Definition: rt_api.c:6105
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
Definition: rt_api.c:8350
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:1229
int rt_band_get_hasnodata_flag(rt_band band)
Get hasnodata flag value.
Definition: rt_api.c:2002
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:70
static int rtpg_setvalues_geomval_callback(rt_iterator_arg arg, void *userarg, double *value, int *nodata)
Definition: rt_pg.c:3777
uint16_t rt_raster_get_width(rt_raster raster)
Definition: rt_api.c:5426
rt_errorstate rt_band_set_pixel(rt_band band, int x, int y, double val, int *converted)
Set single pixel's value.
Definition: rt_api.c:2302

Here is the call graph for this function: