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