PostGIS  2.2.7dev-r@@SVN_REVISION@@
rt_util.c
Go to the documentation of this file.
1 /*
2  *
3  * WKTRaster - Raster Types for PostGIS
4  * http://trac.osgeo.org/postgis/wiki/WKTRaster
5  *
6  * Copyright (C) 2011-2013 Regents of the University of California
7  * <bkpark@ucdavis.edu>
8  * Copyright (C) 2010-2011 Jorge Arevalo <jorge.arevalo@deimos-space.com>
9  * Copyright (C) 2010-2011 David Zwarg <dzwarg@azavea.com>
10  * Copyright (C) 2009-2011 Pierre Racine <pierre.racine@sbf.ulaval.ca>
11  * Copyright (C) 2009-2011 Mateusz Loskot <mateusz@loskot.net>
12  * Copyright (C) 2008-2009 Sandro Santilli <strk@keybit.net>
13  *
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version 2
17  * of the License, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software Foundation,
26  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27  *
28  */
29 
30 #include "librtcore.h"
31 #include "librtcore_internal.h"
32 
33 uint8_t
35  return (uint8_t)fmin(fmax((value), 0), POSTGIS_RT_1BBMAX);
36 }
37 
38 uint8_t
40  return (uint8_t)fmin(fmax((value), 0), POSTGIS_RT_2BUIMAX);
41 }
42 
43 uint8_t
45  return (uint8_t)fmin(fmax((value), 0), POSTGIS_RT_4BUIMAX);
46 }
47 
48 int8_t
50  return (int8_t)fmin(fmax((value), SCHAR_MIN), SCHAR_MAX);
51 }
52 
53 uint8_t
55  return (uint8_t)fmin(fmax((value), 0), UCHAR_MAX);
56 }
57 
58 int16_t
60  return (int16_t)fmin(fmax((value), SHRT_MIN), SHRT_MAX);
61 }
62 
63 uint16_t
65  return (uint16_t)fmin(fmax((value), 0), USHRT_MAX);
66 }
67 
68 int32_t
70  return (int32_t)fmin(fmax((value), INT_MIN), INT_MAX);
71 }
72 
73 uint32_t
75  return (uint32_t)fmin(fmax((value), 0), UINT_MAX);
76 }
77 
78 float
80  return (float)fmin(fmax((value), -FLT_MAX), FLT_MAX);
81 }
82 
90 GDALResampleAlg
91 rt_util_gdal_resample_alg(const char *algname) {
92  assert(algname != NULL && strlen(algname) > 0);
93 
94  if (strcmp(algname, "NEARESTNEIGHBOUR") == 0)
95  return GRA_NearestNeighbour;
96  else if (strcmp(algname, "NEARESTNEIGHBOR") == 0)
97  return GRA_NearestNeighbour;
98  else if (strcmp(algname, "BILINEAR") == 0)
99  return GRA_Bilinear;
100  else if (strcmp(algname, "CUBICSPLINE") == 0)
101  return GRA_CubicSpline;
102  else if (strcmp(algname, "CUBIC") == 0)
103  return GRA_Cubic;
104  else if (strcmp(algname, "LANCZOS") == 0)
105  return GRA_Lanczos;
106 
107  return GRA_NearestNeighbour;
108 }
109 
117 GDALDataType
119  switch (pt) {
120  case PT_1BB:
121  case PT_2BUI:
122  case PT_4BUI:
123  case PT_8BUI:
124  return GDT_Byte;
125  case PT_8BSI:
126  case PT_16BSI:
127  return GDT_Int16;
128  case PT_16BUI:
129  return GDT_UInt16;
130  case PT_32BSI:
131  return GDT_Int32;
132  case PT_32BUI:
133  return GDT_UInt32;
134  case PT_32BF:
135  return GDT_Float32;
136  case PT_64BF:
137  return GDT_Float64;
138  default:
139  return GDT_Unknown;
140  }
141 
142  return GDT_Unknown;
143 }
144 
154  switch (gdt) {
155  case GDT_Byte:
156  return PT_8BUI;
157  case GDT_UInt16:
158  return PT_16BUI;
159  case GDT_Int16:
160  return PT_16BSI;
161  case GDT_UInt32:
162  return PT_32BUI;
163  case GDT_Int32:
164  return PT_32BSI;
165  case GDT_Float32:
166  return PT_32BF;
167  case GDT_Float64:
168  return PT_64BF;
169  default:
170  return PT_END;
171  }
172 
173  return PT_END;
174 }
175 
176 /*
177  get GDAL runtime version information
178 */
179 const char*
180 rt_util_gdal_version(const char *request) {
181  if (NULL == request || !strlen(request))
182  return GDALVersionInfo("RELEASE_NAME");
183  else
184  return GDALVersionInfo(request);
185 }
186 
187 /*
188  computed extent type
189 */
191 rt_util_extent_type(const char *name) {
192  assert(name != NULL && strlen(name) > 0);
193 
194  if (strcmp(name, "UNION") == 0)
195  return ET_UNION;
196  else if (strcmp(name, "FIRST") == 0)
197  return ET_FIRST;
198  else if (strcmp(name, "SECOND") == 0)
199  return ET_SECOND;
200  else if (strcmp(name, "LAST") == 0)
201  return ET_LAST;
202  else if (strcmp(name, "CUSTOM") == 0)
203  return ET_CUSTOM;
204  else
205  return ET_INTERSECTION;
206 }
207 
208 /*
209  convert the spatial reference string from a GDAL recognized format to either WKT or Proj4
210 */
211 char*
212 rt_util_gdal_convert_sr(const char *srs, int proj4) {
213  OGRSpatialReferenceH hsrs;
214  char *rtn = NULL;
215 
216  assert(srs != NULL);
217 
218  hsrs = OSRNewSpatialReference(NULL);
219  if (OSRSetFromUserInput(hsrs, srs) == OGRERR_NONE) {
220  if (proj4)
221  OSRExportToProj4(hsrs, &rtn);
222  else
223  OSRExportToWkt(hsrs, &rtn);
224  }
225  else {
226  rterror("rt_util_gdal_convert_sr: Could not process the provided srs: %s", srs);
227  return NULL;
228  }
229 
230  OSRDestroySpatialReference(hsrs);
231  if (rtn == NULL) {
232  rterror("rt_util_gdal_convert_sr: Could not process the provided srs: %s", srs);
233  return NULL;
234  }
235 
236  return rtn;
237 }
238 
239 /*
240  is the spatial reference string supported by GDAL
241 */
242 int
243 rt_util_gdal_supported_sr(const char *srs) {
244  OGRSpatialReferenceH hsrs;
245  OGRErr rtn = OGRERR_NONE;
246 
247  assert(srs != NULL);
248 
249  hsrs = OSRNewSpatialReference(NULL);
250  rtn = OSRSetFromUserInput(hsrs, srs);
251  OSRDestroySpatialReference(hsrs);
252 
253  if (rtn == OGRERR_NONE)
254  return 1;
255  else
256  return 0;
257 }
258 
270 rt_util_gdal_sr_auth_info(GDALDatasetH hds, char **authname, char **authcode) {
271  const char *srs = NULL;
272 
273  assert(authname != NULL);
274  assert(authcode != NULL);
275 
276  *authname = NULL;
277  *authcode = NULL;
278 
279  srs = GDALGetProjectionRef(hds);
280  if (srs != NULL && srs[0] != '\0') {
281  OGRSpatialReferenceH hSRS = OSRNewSpatialReference(NULL);
282 
283  if (OSRSetFromUserInput(hSRS, srs) == OGRERR_NONE) {
284  const char* pszAuthorityName = OSRGetAuthorityName(hSRS, NULL);
285  const char* pszAuthorityCode = OSRGetAuthorityCode(hSRS, NULL);
286 
287  if (pszAuthorityName != NULL && pszAuthorityCode != NULL) {
288  *authname = rtalloc(sizeof(char) * (strlen(pszAuthorityName) + 1));
289  *authcode = rtalloc(sizeof(char) * (strlen(pszAuthorityCode) + 1));
290 
291  if (*authname == NULL || *authcode == NULL) {
292  rterror("rt_util_gdal_sr_auth_info: Could not allocate memory for auth name and code");
293  if (*authname != NULL) rtdealloc(*authname);
294  if (*authcode != NULL) rtdealloc(*authcode);
295  OSRDestroySpatialReference(hSRS);
296  return ES_ERROR;
297  }
298 
299  strncpy(*authname, pszAuthorityName, strlen(pszAuthorityName) + 1);
300  strncpy(*authcode, pszAuthorityCode, strlen(pszAuthorityCode) + 1);
301  }
302  }
303 
304  OSRDestroySpatialReference(hSRS);
305  }
306 
307  return ES_NONE;
308 }
309 
310 /*
311  is GDAL configured correctly?
312 */
314 
315  /* set of EPSG codes */
316  if (!rt_util_gdal_supported_sr("EPSG:4326"))
317  return 0;
318  if (!rt_util_gdal_supported_sr("EPSG:4269"))
319  return 0;
320  if (!rt_util_gdal_supported_sr("EPSG:4267"))
321  return 0;
322  if (!rt_util_gdal_supported_sr("EPSG:3310"))
323  return 0;
324  if (!rt_util_gdal_supported_sr("EPSG:2163"))
325  return 0;
326 
327  return 1;
328 }
329 
330 /*
331  register all GDAL drivers
332 */
333 int
334 rt_util_gdal_register_all(int force_register_all) {
335  static int registered = 0;
336 
337  if (registered && !force_register_all) {
338  RASTER_DEBUG(3, "Already called once... not calling GDALAllRegister");
339  return 0;
340  }
341 
342  RASTER_DEBUG(3, "Calling GDALAllRegister");
343  GDALAllRegister();
344  registered = 1;
345 
346  return 1;
347 }
348 
349 /*
350  is the driver registered?
351 */
352 int
354  int count = GDALGetDriverCount();
355  int i = 0;
356  GDALDriverH hdrv = NULL;
357 
358  if (drv == NULL || !strlen(drv) || count < 1)
359  return 0;
360 
361  for (i = 0; i < count; i++) {
362  hdrv = GDALGetDriver(i);
363  if (hdrv == NULL) continue;
364 
365  if (strcmp(drv, GDALGetDriverShortName(hdrv)) == 0)
366  return 1;
367  }
368 
369  return 0;
370 }
371 
372 /* variable for PostgreSQL GUC: postgis.gdal_enabled_drivers */
373 char *gdal_enabled_drivers = NULL;
374 
375 /*
376  wrapper for GDALOpen and GDALOpenShared
377 */
378 GDALDatasetH
379 rt_util_gdal_open(const char *fn, GDALAccess fn_access, int shared) {
380  assert(NULL != fn);
381 
382  if (gdal_enabled_drivers != NULL) {
383  if (strstr(gdal_enabled_drivers, GDAL_DISABLE_ALL) != NULL) {
384  rterror("rt_util_gdal_open: Cannot open file. All GDAL drivers disabled");
385  return NULL;
386  }
387  else if (strstr(gdal_enabled_drivers, GDAL_ENABLE_ALL) != NULL) {
388  /* do nothing */
389  }
390  else if (
391  (strstr(fn, "/vsicurl") != NULL) &&
392  (strstr(gdal_enabled_drivers, GDAL_VSICURL) == NULL)
393  ) {
394  rterror("rt_util_gdal_open: Cannot open VSICURL file. VSICURL disabled");
395  return NULL;
396  }
397  }
398 
399  if (shared)
400  return GDALOpenShared(fn, fn_access);
401  else
402  return GDALOpen(fn, fn_access);
403 }
404 
405 void
407  OGREnvelope env,
408  rt_envelope *ext
409 ) {
410  assert(ext != NULL);
411 
412  ext->MinX = env.MinX;
413  ext->MaxX = env.MaxX;
414  ext->MinY = env.MinY;
415  ext->MaxY = env.MaxY;
416 
417  ext->UpperLeftX = env.MinX;
418  ext->UpperLeftY = env.MaxY;
419 }
420 
421 void
423  rt_envelope ext,
424  OGREnvelope *env
425 ) {
426  assert(env != NULL);
427 
428  env->MinX = ext.MinX;
429  env->MaxX = ext.MaxX;
430  env->MinY = ext.MinY;
431  env->MaxY = ext.MaxY;
432 }
433 
434 LWPOLY *
436  rt_envelope env
437 ) {
438  LWPOLY *npoly = NULL;
439  POINTARRAY **rings = NULL;
440  POINTARRAY *pts = NULL;
441  POINT4D p4d;
442 
443  rings = (POINTARRAY **) rtalloc(sizeof (POINTARRAY*));
444  if (!rings) {
445  rterror("rt_util_envelope_to_lwpoly: Out of memory building envelope's geometry");
446  return NULL;
447  }
448  rings[0] = ptarray_construct(0, 0, 5);
449  if (!rings[0]) {
450  rterror("rt_util_envelope_to_lwpoly: Out of memory building envelope's geometry ring");
451  return NULL;
452  }
453 
454  pts = rings[0];
455 
456  /* Upper-left corner (first and last points) */
457  p4d.x = env.MinX;
458  p4d.y = env.MaxY;
459  ptarray_set_point4d(pts, 0, &p4d);
460  ptarray_set_point4d(pts, 4, &p4d);
461 
462  /* Upper-right corner (we go clockwise) */
463  p4d.x = env.MaxX;
464  p4d.y = env.MaxY;
465  ptarray_set_point4d(pts, 1, &p4d);
466 
467  /* Lower-right corner */
468  p4d.x = env.MaxX;
469  p4d.y = env.MinY;
470  ptarray_set_point4d(pts, 2, &p4d);
471 
472  /* Lower-left corner */
473  p4d.x = env.MinX;
474  p4d.y = env.MinY;
475  ptarray_set_point4d(pts, 3, &p4d);
476 
477  npoly = lwpoly_construct(SRID_UNKNOWN, 0, 1, rings);
478  if (npoly == NULL) {
479  rterror("rt_util_envelope_to_lwpoly: Could not build envelope's geometry");
480  return NULL;
481  }
482 
483  return npoly;
484 }
485 
486 int
487 rt_util_same_geotransform_matrix(double *gt1, double *gt2) {
488  int k = 0;
489 
490  if (gt1 == NULL || gt2 == NULL)
491  return FALSE;
492 
493  for (k = 0; k < 6; k++) {
494  if (FLT_NEQ(gt1[k], gt2[k]))
495  return FALSE;
496  }
497 
498  return TRUE;
499 }
500 
501 /* coordinates in RGB and HSV are floating point values between 0 and 1 */
503 rt_util_rgb_to_hsv(double rgb[3], double hsv[3]) {
504  int i;
505 
506  double minc;
507  double maxc;
508 
509  double h = 0.;
510  double s = 0.;
511  double v = 0.;
512 
513  minc = rgb[0];
514  maxc = rgb[0];
515 
516  /* get min and max values from RGB */
517  for (i = 1; i < 3; i++) {
518  if (rgb[i] > maxc)
519  maxc = rgb[i];
520  if (rgb[i] < minc)
521  minc = rgb[i];
522  }
523  v = maxc;
524 
525  if (maxc != minc) {
526  double diff = 0.;
527  double rc = 0.;
528  double gc = 0.;
529  double bc = 0.;
530  double junk = 0.;
531 
532  diff = maxc - minc;
533  s = diff / maxc;
534  rc = (maxc - rgb[0]) / diff;
535  gc = (maxc - rgb[1]) / diff;
536  bc = (maxc - rgb[2]) / diff;
537 
538  if (DBL_EQ(rgb[0], maxc))
539  h = bc - gc;
540  else if (DBL_EQ(rgb[1], maxc))
541  h = 2.0 + rc - bc;
542  else
543  h = 4.0 + gc - rc;
544 
545  h = modf((h / 6.0), &junk);
546  }
547 
548  hsv[0] = h;
549  hsv[1] = s;
550  hsv[2] = v;
551 
552  return ES_NONE;
553 }
554 
555 /* coordinates in RGB and HSV are floating point values between 0 and 1 */
557 rt_util_hsv_to_rgb(double hsv[3], double rgb[3]) {
558  double r = 0;
559  double g = 0;
560  double b = 0;
561  double v = hsv[2];
562 
563  if (DBL_EQ(hsv[1], 0.))
564  r = g = b = v;
565  else {
566  double i;
567  double f;
568  double p;
569  double q;
570  double t;
571 
572  int a;
573 
574  i = floor(hsv[0] * 6.);
575  f = (hsv[0] * 6.0) - i;
576  p = v * (1. - hsv[1]);
577  q = v * (1. - hsv[1] * f);
578  t = v * (1. - hsv[1] * (1. - f));
579 
580  a = (int) i;
581  switch (a) {
582  case 1:
583  r = q;
584  g = v;
585  b = p;
586  break;
587  case 2:
588  r = p;
589  g = v;
590  b = t;
591  break;
592  case 3:
593  r = p;
594  g = q;
595  b = v;
596  break;
597  case 4:
598  r = t;
599  g = p;
600  b = v;
601  break;
602  case 5:
603  r = v;
604  g = p;
605  b = q;
606  break;
607  case 0:
608  case 6:
609  default:
610  r = v;
611  g = t;
612  b = p;
613  break;
614  }
615  }
616 
617  rgb[0] = r;
618  rgb[1] = g;
619  rgb[2] = b;
620 
621  return ES_NONE;
622 }
623 
624 int
626  double initialvalue,
627  int32_t checkvalint, uint32_t checkvaluint,
628  float checkvalfloat, double checkvaldouble,
629  rt_pixtype pixtype
630 ) {
631  int result = 0;
632 
633  switch (pixtype) {
634  case PT_1BB:
635  case PT_2BUI:
636  case PT_4BUI:
637  case PT_8BSI:
638  case PT_8BUI:
639  case PT_16BSI:
640  case PT_16BUI:
641  case PT_32BSI: {
642  if (fabs(checkvalint - initialvalue) >= 1) {
643 #if POSTGIS_RASTER_WARN_ON_TRUNCATION > 0
644  rtwarn("Value set for %s band got clamped from %f to %d",
645  rt_pixtype_name(pixtype),
646  initialvalue, checkvalint
647  );
648 #endif
649  result = 1;
650  }
651  else if (FLT_NEQ(checkvalint, initialvalue)) {
652 #if POSTGIS_RASTER_WARN_ON_TRUNCATION > 0
653  rtwarn("Value set for %s band got truncated from %f to %d",
654  rt_pixtype_name(pixtype),
655  initialvalue, checkvalint
656  );
657 #endif
658  result = 1;
659  }
660  break;
661  }
662  case PT_32BUI: {
663  if (fabs(checkvaluint - initialvalue) >= 1) {
664 #if POSTGIS_RASTER_WARN_ON_TRUNCATION > 0
665  rtwarn("Value set for %s band got clamped from %f to %u",
666  rt_pixtype_name(pixtype),
667  initialvalue, checkvaluint
668  );
669 #endif
670  result = 1;
671  }
672  else if (FLT_NEQ(checkvaluint, initialvalue)) {
673 #if POSTGIS_RASTER_WARN_ON_TRUNCATION > 0
674  rtwarn("Value set for %s band got truncated from %f to %u",
675  rt_pixtype_name(pixtype),
676  initialvalue, checkvaluint
677  );
678 #endif
679  result = 1;
680  }
681  break;
682  }
683  case PT_32BF: {
684  /*
685  For float, because the initial value is a double,
686  there is very often a difference between the desired value and the obtained one
687  */
688  if (FLT_NEQ(checkvalfloat, initialvalue)) {
689 #if POSTGIS_RASTER_WARN_ON_TRUNCATION > 0
690  rtwarn("Value set for %s band got converted from %f to %f",
691  rt_pixtype_name(pixtype),
692  initialvalue, checkvalfloat
693  );
694 #endif
695  result = 1;
696  }
697  break;
698  }
699  case PT_64BF: {
700  if (FLT_NEQ(checkvaldouble, initialvalue)) {
701 #if POSTGIS_RASTER_WARN_ON_TRUNCATION > 0
702  rtwarn("Value set for %s band got converted from %f to %f",
703  rt_pixtype_name(pixtype),
704  initialvalue, checkvaldouble
705  );
706 #endif
707  result = 1;
708  }
709  break;
710  }
711  case PT_END:
712  break;
713  }
714 
715  return result;
716 }
717 
void ptarray_set_point4d(POINTARRAY *pa, int n, const POINT4D *p4d)
Definition: lwgeom_api.c:536
double x
Definition: liblwgeom.h:336
int rt_util_gdal_driver_registered(const char *drv)
Definition: rt_util.c:353
rt_extenttype rt_util_extent_type(const char *name)
Definition: rt_util.c:191
double MinY
Definition: librtcore.h:179
POINTARRAY * ptarray_construct(char hasz, char hasm, uint32_t npoints)
Construct an empty pointarray, allocating storage and setting the npoints, but not filling in any inf...
Definition: ptarray.c:62
#define GDAL_ENABLE_ALL
Definition: librtcore.h:2011
#define POSTGIS_RT_2BUIMAX
Definition: librtcore.h:2024
double UpperLeftX
Definition: librtcore.h:182
void rt_util_from_ogr_envelope(OGREnvelope env, rt_envelope *ext)
Definition: rt_util.c:406
int rt_util_gdal_supported_sr(const char *srs)
Definition: rt_util.c:243
char * r
Definition: cu_in_wkt.c:24
double MaxY
Definition: librtcore.h:180
double MaxX
Definition: librtcore.h:178
rt_extenttype
Definition: librtcore.h:212
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
Definition: rt_context.c:199
void * rtalloc(size_t size)
Wrappers used for managing memory.
Definition: rt_context.c:171
#define DBL_EQ(x, y)
Definition: librtcore.h:2199
rt_errorstate
Enum definitions.
Definition: librtcore.h:191
uint8_t rt_util_clamp_to_1BB(double value)
Definition: rt_util.c:34
const char * rt_util_gdal_version(const char *request)
Definition: rt_util.c:180
#define POSTGIS_RT_4BUIMAX
Definition: librtcore.h:2025
rt_pixtype
Definition: librtcore.h:197
GDALDatasetH rt_util_gdal_open(const char *fn, GDALAccess fn_access, int shared)
Definition: rt_util.c:379
#define GDAL_DISABLE_ALL
Definition: librtcore.h:2012
void rt_util_to_ogr_envelope(rt_envelope ext, OGREnvelope *env)
Definition: rt_util.c:422
int rt_util_same_geotransform_matrix(double *gt1, double *gt2)
Definition: rt_util.c:487
void rtwarn(const char *fmt,...)
Definition: rt_context.c:224
LWPOLY * lwpoly_construct(int srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points)
Definition: lwpoly.c:29
uint16_t rt_util_clamp_to_16BUI(double value)
Definition: rt_util.c:64
float rt_util_clamp_to_32F(double value)
Definition: rt_util.c:79
int32_t rt_util_clamp_to_32BSI(double value)
Definition: rt_util.c:69
rt_pixtype rt_util_gdal_datatype_to_pixtype(GDALDataType gdt)
Convert GDALDataType to rt_pixtype.
Definition: rt_util.c:153
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:172
GDALDataType rt_util_pixtype_to_gdal_datatype(rt_pixtype pt)
Convert rt_pixtype to GDALDataType.
Definition: rt_util.c:118
GDALResampleAlg rt_util_gdal_resample_alg(const char *algname)
Convert cstring name to GDAL Resample Algorithm.
Definition: rt_util.c:91
#define FLT_NEQ(x, y)
Definition: librtcore.h:2196
char * rt_util_gdal_convert_sr(const char *srs, int proj4)
Definition: rt_util.c:212
int count
Definition: genraster.py:56
char * gdal_enabled_drivers
Definition: rt_util.c:373
rt_errorstate rt_util_rgb_to_hsv(double rgb[3], double hsv[3])
Definition: rt_util.c:503
char * s
Definition: cu_in_wkt.c:23
#define POSTGIS_RT_1BBMAX
Definition: librtcore.h:2023
#define GDAL_VSICURL
Definition: librtcore.h:2013
int rt_util_gdal_configured(void)
Definition: rt_util.c:313
uint8_t rt_util_clamp_to_2BUI(double value)
Definition: rt_util.c:39
rt_errorstate rt_util_hsv_to_rgb(double hsv[3], double rgb[3])
Definition: rt_util.c:557
void rtdealloc(void *mem)
Definition: rt_context.c:186
#define FALSE
Definition: dbfopen.c:168
double MinX
Definition: librtcore.h:177
#define RASTER_DEBUG(level, msg)
Definition: librtcore.h:307
This library is the generic raster handling section of PostGIS.
const char * rt_pixtype_name(rt_pixtype pixtype)
Definition: rt_pixel.c:110
int16_t rt_util_clamp_to_16BSI(double value)
Definition: rt_util.c:59
uint8_t rt_util_clamp_to_8BUI(double value)
Definition: rt_util.c:54
int rt_util_gdal_register_all(int force_register_all)
Definition: rt_util.c:334
LWPOLY * rt_util_envelope_to_lwpoly(rt_envelope env)
Definition: rt_util.c:435
int rt_util_dbl_trunc_warning(double initialvalue, int32_t checkvalint, uint32_t checkvaluint, float checkvalfloat, double checkvaldouble, rt_pixtype pixtype)
Definition: rt_util.c:625
double y
Definition: liblwgeom.h:336
uint8_t rt_util_clamp_to_4BUI(double value)
Definition: rt_util.c:44
double UpperLeftY
Definition: librtcore.h:183
#define TRUE
Definition: dbfopen.c:169
int8_t rt_util_clamp_to_8BSI(double value)
Definition: rt_util.c:49
rt_errorstate rt_util_gdal_sr_auth_info(GDALDatasetH hds, char **authname, char **authcode)
Get auth name and code.
Definition: rt_util.c:270
uint32_t rt_util_clamp_to_32BUI(double value)
Definition: rt_util.c:74