PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ RASTER_setPixelValuesGeomval()

Datum RASTER_setPixelValuesGeomval ( PG_FUNCTION_ARGS  )

Definition at line 1178 of file rtpg_pixel.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_dumpvalues_arg_t::numbands, 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.

Referenced by rtpg_setvalues_geomval_callback().

1179 {
1180  rt_pgraster *pgraster = NULL;
1181  rt_pgraster *pgrtn = NULL;
1182  rt_raster raster = NULL;
1183  rt_band band = NULL;
1184  rt_raster _raster = NULL;
1185  rt_band _band = NULL;
1186  int nband = 0; /* 1-based */
1187 
1188  int numbands = 0;
1189  int width = 0;
1190  int height = 0;
1191  int srid = 0;
1192  double gt[6] = {0};
1193 
1194  rt_pixtype pixtype = PT_END;
1195  int hasnodata = 0;
1196  double nodataval = 0;
1197 
1198  rtpg_setvaluesgv_arg arg = NULL;
1199  int allpoint = 0;
1200 
1201  ArrayType *array;
1202  Oid etype;
1203  Datum *e;
1204  bool *nulls;
1205  int16 typlen;
1206  bool typbyval;
1207  char typalign;
1208  int n = 0;
1209 
1210  HeapTupleHeader tup;
1211  bool isnull;
1212  Datum tupv;
1213 
1214  GSERIALIZED *gser = NULL;
1215  uint8_t gtype;
1216  unsigned char *wkb = NULL;
1217  size_t wkb_len;
1218 
1219  int i = 0;
1220  uint32_t j = 0;
1221  int noerr = 1;
1222 
1223  /* pgraster is null, return null */
1224  if (PG_ARGISNULL(0))
1225  PG_RETURN_NULL();
1226  pgraster = (rt_pgraster *) PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0));
1227 
1228  /* raster */
1229  raster = rt_raster_deserialize(pgraster, FALSE);
1230  if (!raster) {
1231  PG_FREE_IF_COPY(pgraster, 0);
1232  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not deserialize raster");
1233  PG_RETURN_NULL();
1234  }
1235 
1236  /* raster attributes */
1237  numbands = rt_raster_get_num_bands(raster);
1238  width = rt_raster_get_width(raster);
1239  height = rt_raster_get_height(raster);
1240  srid = clamp_srid(rt_raster_get_srid(raster));
1242 
1243  /* nband */
1244  if (PG_ARGISNULL(1)) {
1245  elog(NOTICE, "Band index cannot be NULL. Value must be 1-based. Returning original raster");
1246  rt_raster_destroy(raster);
1247  PG_RETURN_POINTER(pgraster);
1248  }
1249 
1250  nband = PG_GETARG_INT32(1);
1251  if (nband < 1 || nband > numbands) {
1252  elog(NOTICE, "Band index is invalid. Value must be 1-based. Returning original raster");
1253  rt_raster_destroy(raster);
1254  PG_RETURN_POINTER(pgraster);
1255  }
1256 
1257  /* get band attributes */
1258  band = rt_raster_get_band(raster, nband - 1);
1259  pixtype = rt_band_get_pixtype(band);
1260  hasnodata = rt_band_get_hasnodata_flag(band);
1261  if (hasnodata)
1262  rt_band_get_nodata(band, &nodataval);
1263 
1264  /* array of geomval (2) */
1265  if (PG_ARGISNULL(2)) {
1266  elog(NOTICE, "No values to set. Returning original raster");
1267  rt_raster_destroy(raster);
1268  PG_RETURN_POINTER(pgraster);
1269  }
1270 
1271  array = PG_GETARG_ARRAYTYPE_P(2);
1272  etype = ARR_ELEMTYPE(array);
1273  get_typlenbyvalalign(etype, &typlen, &typbyval, &typalign);
1274 
1275  deconstruct_array(
1276  array,
1277  etype,
1278  typlen, typbyval, typalign,
1279  &e, &nulls, &n
1280  );
1281 
1282  if (!n) {
1283  elog(NOTICE, "No values to set. Returning original raster");
1284  rt_raster_destroy(raster);
1285  PG_RETURN_POINTER(pgraster);
1286  }
1287 
1288  /* init arg */
1289  arg = rtpg_setvaluesgv_arg_init();
1290  if (arg == NULL) {
1291  rt_raster_destroy(raster);
1292  PG_FREE_IF_COPY(pgraster, 0);
1293  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not intialize argument structure");
1294  PG_RETURN_NULL();
1295  }
1296 
1297  arg->gv = palloc(sizeof(struct rtpg_setvaluesgv_geomval_t) * n);
1298  if (arg->gv == NULL) {
1300  rt_raster_destroy(raster);
1301  PG_FREE_IF_COPY(pgraster, 0);
1302  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not allocate memory for geomval array");
1303  PG_RETURN_NULL();
1304  }
1305 
1306  /* process each element */
1307  arg->ngv = 0;
1308  for (i = 0; i < n; i++) {
1309  if (nulls[i])
1310  continue;
1311 
1312  arg->gv[arg->ngv].pixval.nodata = 0;
1313  arg->gv[arg->ngv].pixval.value = 0;
1314  arg->gv[arg->ngv].geom = NULL;
1315  arg->gv[arg->ngv].mask = NULL;
1316 
1317  /* each element is a tuple */
1318  tup = (HeapTupleHeader) DatumGetPointer(e[i]);
1319  if (NULL == tup) {
1321  rt_raster_destroy(raster);
1322  PG_FREE_IF_COPY(pgraster, 0);
1323  elog(ERROR, "RASTER_setPixelValuesGeomval: Invalid argument for geomval at index %d", i);
1324  PG_RETURN_NULL();
1325  }
1326 
1327  /* first element, geometry */
1328  POSTGIS_RT_DEBUG(4, "Processing first element (geometry)");
1329  tupv = GetAttributeByName(tup, "geom", &isnull);
1330  if (isnull) {
1331  elog(NOTICE, "First argument (geom) of geomval at index %d is NULL. Skipping", i);
1332  continue;
1333  }
1334 
1335  gser = (GSERIALIZED *) PG_DETOAST_DATUM(tupv);
1336  arg->gv[arg->ngv].geom = lwgeom_from_gserialized(gser);
1337  if (arg->gv[arg->ngv].geom == NULL) {
1339  rt_raster_destroy(raster);
1340  PG_FREE_IF_COPY(pgraster, 0);
1341  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not deserialize geometry of geomval at index %d", i);
1342  PG_RETURN_NULL();
1343  }
1344 
1345  /* empty geometry */
1346  if (lwgeom_is_empty(arg->gv[arg->ngv].geom)) {
1347  elog(NOTICE, "First argument (geom) of geomval at index %d is an empty geometry. Skipping", i);
1348  continue;
1349  }
1350 
1351  /* check SRID */
1352  if (clamp_srid(gserialized_get_srid(gser)) != srid) {
1353  elog(NOTICE, "Geometry provided for geomval at index %d does not have the same SRID as the raster: %d. Returning original raster", i, srid);
1355  rt_raster_destroy(raster);
1356  PG_RETURN_POINTER(pgraster);
1357  }
1358 
1359  /* Get a 2D version of the geometry if necessary */
1360  if (lwgeom_ndims(arg->gv[arg->ngv].geom) > 2) {
1361  LWGEOM *geom2d = lwgeom_force_2d(arg->gv[arg->ngv].geom);
1362  lwgeom_free(arg->gv[arg->ngv].geom);
1363  arg->gv[arg->ngv].geom = geom2d;
1364  }
1365 
1366  /* filter for types */
1367  gtype = gserialized_get_type(gser);
1368 
1369  /* shortcuts for POINT and MULTIPOINT */
1370  if (gtype == POINTTYPE || gtype == MULTIPOINTTYPE)
1371  allpoint++;
1372 
1373  /* get wkb of geometry */
1374  POSTGIS_RT_DEBUG(3, "getting wkb of geometry");
1375  wkb = lwgeom_to_wkb(arg->gv[arg->ngv].geom, WKB_SFSQL, &wkb_len);
1376 
1377  /* rasterize geometry */
1378  arg->gv[arg->ngv].mask = rt_raster_gdal_rasterize(
1379  wkb, wkb_len,
1380  NULL,
1381  0, NULL,
1382  NULL, NULL,
1383  NULL, NULL,
1384  NULL, NULL,
1385  &(gt[1]), &(gt[5]),
1386  NULL, NULL,
1387  &(gt[0]), &(gt[3]),
1388  &(gt[2]), &(gt[4]),
1389  NULL
1390  );
1391 
1392  pfree(wkb);
1393  if (gtype != POINTTYPE && gtype != MULTIPOINTTYPE) {
1394  lwgeom_free(arg->gv[arg->ngv].geom);
1395  arg->gv[arg->ngv].geom = NULL;
1396  }
1397 
1398  if (arg->gv[arg->ngv].mask == NULL) {
1400  rt_raster_destroy(raster);
1401  PG_FREE_IF_COPY(pgraster, 0);
1402  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not rasterize geometry of geomval at index %d", i);
1403  PG_RETURN_NULL();
1404  }
1405 
1406  /* set SRID */
1407  rt_raster_set_srid(arg->gv[arg->ngv].mask, srid);
1408 
1409  /* second element, value */
1410  POSTGIS_RT_DEBUG(4, "Processing second element (val)");
1411  tupv = GetAttributeByName(tup, "val", &isnull);
1412  if (isnull) {
1413  elog(NOTICE, "Second argument (val) of geomval at index %d is NULL. Treating as NODATA", i);
1414  arg->gv[arg->ngv].pixval.nodata = 1;
1415  }
1416  else
1417  arg->gv[arg->ngv].pixval.value = DatumGetFloat8(tupv);
1418 
1419  (arg->ngv)++;
1420  }
1421 
1422  /* redim arg->gv if needed */
1423  if (arg->ngv < n) {
1424  arg->gv = repalloc(arg->gv, sizeof(struct rtpg_setvaluesgv_geomval_t) * arg->ngv);
1425  if (arg->gv == NULL) {
1427  rt_raster_destroy(raster);
1428  PG_FREE_IF_COPY(pgraster, 0);
1429  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not reallocate memory for geomval array");
1430  PG_RETURN_NULL();
1431  }
1432  }
1433 
1434  /* keepnodata */
1435  if (!PG_ARGISNULL(3))
1436  arg->keepnodata = PG_GETARG_BOOL(3);
1437  POSTGIS_RT_DEBUGF(3, "keepnodata = %d", arg->keepnodata);
1438 
1439  /* keepnodata = TRUE and band is NODATA */
1440  if (arg->keepnodata && rt_band_get_isnodata_flag(band)) {
1441  POSTGIS_RT_DEBUG(3, "keepnodata = TRUE and band is NODATA. Not doing anything");
1442  }
1443  /* all elements are points */
1444  else if (allpoint == arg->ngv) {
1445  double igt[6] = {0};
1446  double xy[2] = {0};
1447  double value = 0;
1448  int isnodata = 0;
1449 
1450  LWCOLLECTION *coll = NULL;
1451  LWPOINT *point = NULL;
1452  POINT2D p;
1453 
1454  POSTGIS_RT_DEBUG(3, "all geometries are points, using direct to pixel method");
1455 
1456  /* cache inverse gretransform matrix */
1458 
1459  /* process each geometry */
1460  for (i = 0; i < arg->ngv; i++) {
1461  /* convert geometry to collection */
1462  coll = lwgeom_as_lwcollection(lwgeom_as_multi(arg->gv[i].geom));
1463 
1464  /* process each point in collection */
1465  for (j = 0; j < coll->ngeoms; j++) {
1466  point = lwgeom_as_lwpoint(coll->geoms[j]);
1467  getPoint2d_p(point->point, 0, &p);
1468 
1469  if (rt_raster_geopoint_to_cell(raster, p.x, p.y, &(xy[0]), &(xy[1]), igt) != ES_NONE) {
1471  rt_raster_destroy(raster);
1472  PG_FREE_IF_COPY(pgraster, 0);
1473  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not process coordinates of point");
1474  PG_RETURN_NULL();
1475  }
1476 
1477  /* skip point if outside raster */
1478  if (
1479  (xy[0] < 0 || xy[0] >= width) ||
1480  (xy[1] < 0 || xy[1] >= height)
1481  ) {
1482  elog(NOTICE, "Point is outside raster extent. Skipping");
1483  continue;
1484  }
1485 
1486  /* get pixel value */
1487  if (rt_band_get_pixel(band, xy[0], xy[1], &value, &isnodata) != ES_NONE) {
1489  rt_raster_destroy(raster);
1490  PG_FREE_IF_COPY(pgraster, 0);
1491  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not get pixel value");
1492  PG_RETURN_NULL();
1493  }
1494 
1495  /* keepnodata = TRUE AND pixel value is NODATA */
1496  if (arg->keepnodata && isnodata)
1497  continue;
1498 
1499  /* set pixel */
1500  if (arg->gv[i].pixval.nodata)
1501  noerr = rt_band_set_pixel(band, xy[0], xy[1], nodataval, NULL);
1502  else
1503  noerr = rt_band_set_pixel(band, xy[0], xy[1], arg->gv[i].pixval.value, NULL);
1504 
1505  if (noerr != ES_NONE) {
1507  rt_raster_destroy(raster);
1508  PG_FREE_IF_COPY(pgraster, 0);
1509  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not set pixel value");
1510  PG_RETURN_NULL();
1511  }
1512  }
1513  }
1514  }
1515  /* run iterator otherwise */
1516  else {
1517  rt_iterator itrset;
1518 
1519  POSTGIS_RT_DEBUG(3, "a mix of geometries, using iterator method");
1520 
1521  /* init itrset */
1522  itrset = palloc(sizeof(struct rt_iterator_t) * (arg->ngv + 1));
1523  if (itrset == NULL) {
1525  rt_raster_destroy(raster);
1526  PG_FREE_IF_COPY(pgraster, 0);
1527  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not allocate memory for iterator arguments");
1528  PG_RETURN_NULL();
1529  }
1530 
1531  /* set first raster's info */
1532  itrset[0].raster = raster;
1533  itrset[0].nband = nband - 1;
1534  itrset[0].nbnodata = 1;
1535 
1536  /* set other raster's info */
1537  for (i = 0, j = 1; i < arg->ngv; i++, j++) {
1538  itrset[j].raster = arg->gv[i].mask;
1539  itrset[j].nband = 0;
1540  itrset[j].nbnodata = 1;
1541  }
1542 
1543  /* pass to iterator */
1544  noerr = rt_raster_iterator(
1545  itrset, arg->ngv + 1,
1546  ET_FIRST, NULL,
1547  pixtype,
1548  hasnodata, nodataval,
1549  0, 0,
1550  NULL,
1551  arg,
1553  &_raster
1554  );
1555  pfree(itrset);
1556 
1557  if (noerr != ES_NONE) {
1559  rt_raster_destroy(raster);
1560  PG_FREE_IF_COPY(pgraster, 0);
1561  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not run raster iterator function");
1562  PG_RETURN_NULL();
1563  }
1564 
1565  /* copy band from _raster to raster */
1566  _band = rt_raster_get_band(_raster, 0);
1567  if (_band == NULL) {
1569  rt_raster_destroy(_raster);
1570  rt_raster_destroy(raster);
1571  PG_FREE_IF_COPY(pgraster, 0);
1572  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not get band from working raster");
1573  PG_RETURN_NULL();
1574  }
1575 
1576  _band = rt_raster_replace_band(raster, _band, nband - 1);
1577  if (_band == NULL) {
1579  rt_raster_destroy(_raster);
1580  rt_raster_destroy(raster);
1581  PG_FREE_IF_COPY(pgraster, 0);
1582  elog(ERROR, "RASTER_setPixelValuesGeomval: Could not replace band in output raster");
1583  PG_RETURN_NULL();
1584  }
1585 
1586  rt_band_destroy(_band);
1587  rt_raster_destroy(_raster);
1588  }
1589 
1591 
1592  pgrtn = rt_raster_serialize(raster);
1593  rt_raster_destroy(raster);
1594  PG_FREE_IF_COPY(pgraster, 0);
1595 
1596  POSTGIS_RT_DEBUG(3, "Finished");
1597 
1598  if (!pgrtn)
1599  PG_RETURN_NULL();
1600 
1601  SET_VARSIZE(pgrtn, pgrtn->size);
1602  PG_RETURN_POINTER(pgrtn);
1603 }
static int rtpg_setvalues_geomval_callback(rt_iterator_arg arg, void *userarg, double *value, int *nodata)
Definition: rtpg_pixel.c:1127
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:86
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:347
void * rt_raster_serialize(rt_raster raster)
Return this raster in serialized form.
Definition: rt_serialize.c:521
uint16_t rt_raster_get_num_bands(rt_raster raster)
Definition: rt_raster.c:372
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
raster
Be careful!! Zeros function&#39;s input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:121
void rt_raster_get_geotransform_matrix(rt_raster raster, double *gt)
Get 6-element array of raster geotransform matrix.
Definition: rt_raster.c:706
struct rtpg_setvaluesgv_geomval_t::@21 pixval
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
band
Definition: ovdump.py:57
#define MULTIPOINTTYPE
Definition: liblwgeom.h:87
rtpg_setvaluesgv_geomval gv
Definition: rtpg_pixel.c:1081
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:2509
gt
Definition: window.py:77
LWGEOM * lwgeom_as_multi(const LWGEOM *lwgeom)
Create a new LWGEOM of the appropriate MULTI* type.
Definition: lwgeom.c:371
rt_pixtype
Definition: librtcore.h:185
void rt_band_destroy(rt_band band)
Destroy a raster band.
Definition: rt_band.c:340
LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
Definition: lwgeom.c:161
uint32_t ngeoms
Definition: liblwgeom.h:509
POINTARRAY * point
Definition: liblwgeom.h:413
int lwgeom_ndims(const LWGEOM *geom)
Return the number of dimensions (2, 3, 4) in a geometry.
Definition: lwgeom.c:944
#define WKB_SFSQL
Definition: liblwgeom.h:2066
#define POSTGIS_RT_DEBUGF(level, msg,...)
Definition: rtpostgis.h:65
rt_errorstate rt_band_get_nodata(rt_band band, double *nodata)
Get NODATA value.
Definition: rt_band.c:1730
unsigned int uint32_t
Definition: uthash.h:78
double x
Definition: liblwgeom.h:330
nband
Definition: pixval.py:52
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:764
rt_errorstate rt_band_get_pixel(rt_band band, int x, int y, double *value, int *nodata)
Get pixel value.
Definition: rt_band.c:1221
LWGEOM ** geoms
Definition: liblwgeom.h:511
LWGEOM * lwgeom_force_2d(const LWGEOM *geom)
Strip out the Z/M components of an LWGEOM.
Definition: lwgeom.c:784
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:674
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:2443
rt_band rt_raster_replace_band(rt_raster raster, rt_band band, int index)
Replace band at provided index with new band.
Definition: rt_raster.c:1498
double y
Definition: liblwgeom.h:330
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_raster.c:806
static rtpg_setvaluesgv_arg rtpg_setvaluesgv_arg_init()
Definition: rtpg_pixel.c:1096
uint16_t nband
Definition: librtcore.h:2444
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
Definition: lwgeom_api.c:338
uint16_t rt_raster_get_width(rt_raster raster)
Definition: rt_raster.c:121
#define FALSE
Definition: dbfopen.c:168
uint8_t nbnodata
Definition: librtcore.h:2445
Struct definitions.
Definition: librtcore.h:2250
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_raster.c:676
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
Definition: lwgeom.c:224
static void rtpg_setvaluesgv_arg_destroy(rtpg_setvaluesgv_arg arg)
Definition: rtpg_pixel.c:1110
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.
rt_pixtype rt_band_get_pixtype(rt_band band)
Return pixeltype of this band.
Definition: rt_band.c:631
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
int rt_band_get_isnodata_flag(rt_band band)
Get isnodata flag value.
Definition: rt_band.c:714
rt_errorstate rt_band_set_pixel(rt_band band, int x, int y, double val, int *converted)
Set single pixel&#39;s value.
Definition: rt_band.c:974
int value
Definition: genraster.py:61
uint16_t rt_raster_get_height(rt_raster raster)
Definition: rt_raster.c:129
#define POSTGIS_RT_DEBUG(level, msg)
Definition: rtpostgis.h:61
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:1393
unsigned char uint8_t
Definition: uthash.h:79
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
Definition: rt_serialize.c:725
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:99
Here is the call graph for this function:
Here is the caller graph for this function: