33 #include <miscadmin.h>
34 #include <utils/builtins.h>
35 #include <access/htup_details.h>
36 #include <utils/lsyscache.h>
37 #include <utils/array.h>
38 #include <utils/guc.h>
39 #include <catalog/pg_type.h>
40 #include <utils/memutils.h>
42 #include "../../postgis_config.h"
68 VSILFILE *vsifp = NULL;
80 bytea_data = (bytea *) PG_GETARG_BYTEA_P(0);
81 data = (uint8_t *) VARDATA(bytea_data);
82 data_len = VARSIZE_ANY_EXHDR(bytea_data);
90 vsifp = VSIFileFromMemBuffer(
"/vsimem/in.dat",
data, data_len,
FALSE);
92 PG_FREE_IF_COPY(bytea_data, 0);
93 elog(ERROR,
"RASTER_fromGDALRaster: Could not load bytea into memory file for use by GDAL");
102 if (hdsSrc == NULL) {
104 PG_FREE_IF_COPY(bytea_data, 0);
105 elog(ERROR,
"RASTER_fromGDALRaster: Could not open bytea with GDAL. Check that the bytea is of a GDAL supported format");
109 #if POSTGIS_DEBUG_LEVEL > 3
111 GDALDriverH hdrv = GDALGetDatasetDriver(hdsSrc);
114 GDALGetDriverShortName(hdrv),
115 GDALGetRasterXSize(hdsSrc),
116 GDALGetRasterYSize(hdsSrc)
126 PG_FREE_IF_COPY(bytea_data, 0);
129 elog(ERROR,
"RASTER_fromGDALRaster: Could not convert GDAL raster to raster");
142 SET_VARSIZE(pgraster, pgraster->
size);
143 PG_RETURN_POINTER(pgraster);
155 text *formattext = NULL;
157 char **options = NULL;
158 text *optiontext = NULL;
174 uint8_t *gdal = NULL;
175 uint64_t gdal_size = 0;
177 uint64_t result_size = 0;
182 if (PG_ARGISNULL(0)) PG_RETURN_NULL();
183 pgraster = (
rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
187 PG_FREE_IF_COPY(pgraster, 0);
188 elog(ERROR,
"RASTER_asGDALRaster: Could not deserialize raster");
193 if (PG_ARGISNULL(1)) {
194 elog(NOTICE,
"Format must be provided");
196 PG_FREE_IF_COPY(pgraster, 0);
200 formattext = PG_GETARG_TEXT_P(1);
201 format = text_to_cstring(formattext);
207 if (!PG_ARGISNULL(2)) {
209 array = PG_GETARG_ARRAYTYPE_P(2);
210 etype = ARR_ELEMTYPE(array);
211 get_typlenbyvalalign(etype, &typlen, &typbyval, &typalign);
218 PG_FREE_IF_COPY(pgraster, 0);
219 elog(ERROR,
"RASTER_asGDALRaster: Invalid data type for options");
224 deconstruct_array(array, etype, typlen, typbyval, typalign, &e,
228 options = (
char **) palloc(
sizeof(
char *) * (n + 1));
229 if (options == NULL) {
231 PG_FREE_IF_COPY(pgraster, 0);
232 elog(ERROR,
"RASTER_asGDALRaster: Could not allocate memory for options");
237 for (i = 0, j = 0; i < n; i++) {
238 if (nulls[i])
continue;
243 optiontext = (text *) DatumGetPointer(e[i]);
244 if (NULL == optiontext)
break;
245 option = text_to_cstring(optiontext);
253 if (strlen(option)) {
254 options[j] = (
char *) palloc(
sizeof(
char) * (strlen(option) + 1));
255 strcpy(options[j], option);
262 options = repalloc(options, (j + 1) *
sizeof(
char *));
280 srid = PG_GETARG_INT32(3);
286 if (NULL != options) {
287 for (i = j - 1; i >= 0; i--) pfree(options[i]);
291 PG_FREE_IF_COPY(pgraster, 0);
292 elog(ERROR,
"RASTER_asGDALRaster: Could not find srtext for SRID (%d)", srid);
304 if (NULL != options) {
305 for (i = j - 1; i >= 0; i--) pfree(options[i]);
308 if (NULL != srs) pfree(srs);
310 PG_FREE_IF_COPY(pgraster, 0);
313 elog(ERROR,
"RASTER_asGDALRaster: Could not allocate and generate GDAL raster");
316 POSTGIS_RT_DEBUGF(3,
"RASTER_asGDALRaster: GDAL raster generated with %d bytes", (
int) gdal_size);
319 result_size = gdal_size + VARHDRSZ;
320 result = (bytea *) palloc(result_size);
322 elog(ERROR,
"RASTER_asGDALRaster: Insufficient virtual memory for GDAL raster");
325 SET_VARSIZE(
result, result_size);
326 memcpy(VARDATA(
result), gdal, VARSIZE_ANY_EXHDR(
result));
331 POSTGIS_RT_DEBUG(3,
"RASTER_asGDALRaster: Returning pointer to GDAL raster");
332 PG_RETURN_POINTER(
result);
335 #define VALUES_LENGTH 6
343 FuncCallContext *funcctx;
353 if (SRF_IS_FIRSTCALL()) {
354 MemoryContext oldcontext;
357 funcctx = SRF_FIRSTCALL_INIT();
360 oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
363 if (NULL == drv_set || !drv_count) {
364 elog(NOTICE,
"No GDAL drivers found");
365 MemoryContextSwitchTo(oldcontext);
366 SRF_RETURN_DONE(funcctx);
372 funcctx->user_fctx = drv_set;
375 funcctx->max_calls = drv_count;
378 if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE) {
380 errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
382 "function returning record called in context "
383 "that cannot accept type record"
388 BlessTupleDesc(tupdesc);
389 funcctx->tuple_desc = tupdesc;
390 MemoryContextSwitchTo(oldcontext);
394 funcctx = SRF_PERCALL_SETUP();
396 call_cntr = funcctx->call_cntr;
397 max_calls = funcctx->max_calls;
398 tupdesc = funcctx->tuple_desc;
399 drv_set2 = funcctx->user_fctx;
402 if (call_cntr < max_calls) {
412 values[0] = Int32GetDatum(drv_set2[call_cntr].idx);
413 values[1] = CStringGetTextDatum(drv_set2[call_cntr].short_name);
414 values[2] = CStringGetTextDatum(drv_set2[call_cntr].long_name);
415 values[3] = BoolGetDatum(drv_set2[call_cntr].can_read);
416 values[4] = BoolGetDatum(drv_set2[call_cntr].can_write);
417 values[5] = CStringGetTextDatum(drv_set2[call_cntr].create_options);
420 POSTGIS_RT_DEBUGF(4,
"Result %d, Short Name %s", call_cntr, drv_set2[call_cntr].short_name);
421 POSTGIS_RT_DEBUGF(4,
"Result %d, Full Name %s", call_cntr, drv_set2[call_cntr].long_name);
422 POSTGIS_RT_DEBUGF(4,
"Result %d, Can Read %u", call_cntr, drv_set2[call_cntr].can_read);
423 POSTGIS_RT_DEBUGF(4,
"Result %d, Can Write %u", call_cntr, drv_set2[call_cntr].can_write);
424 POSTGIS_RT_DEBUGF(5,
"Result %d, Create Options %s", call_cntr, drv_set2[call_cntr].create_options);
427 tuple = heap_form_tuple(tupdesc, values, nulls);
430 result = HeapTupleGetDatum(tuple);
433 pfree(drv_set2[call_cntr].short_name);
434 pfree(drv_set2[call_cntr].long_name);
435 pfree(drv_set2[call_cntr].create_options);
437 SRF_RETURN_NEXT(funcctx,
result);
442 SRF_RETURN_DONE(funcctx);
462 typedef struct gdal_contour_result_t {
465 } gdal_contour_result_t;
467 FuncCallContext *funcctx;
469 if (SRF_IS_FIRSTCALL())
471 MemoryContext oldcontext;
473 gdal_contour_result_t *
result;
478 char *src_srs = NULL;
485 size_t array_size = 0;
488 double level_base = 0.0;
489 double level_interval = 100.0;
490 double *fixed_levels = NULL;
491 size_t fixed_levels_count = 0;
494 bool polygonize =
false;
497 funcctx = SRF_FIRSTCALL_INIT();
500 oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
503 result = palloc0(
sizeof(gdal_contour_result_t));
506 if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE) {
507 MemoryContextSwitchTo(oldcontext);
509 errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
511 "function returning record called in context "
512 "that cannot accept type record"
516 BlessTupleDesc(tupdesc);
517 funcctx->tuple_desc = tupdesc;
520 pgraster = (
rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
527 band = PG_GETARG_INT32(1);
528 if (band < 1 || band > num_bands) {
529 elog(ERROR,
"%s: band number must be between 1 and %u inclusive", __func__, num_bands);
533 level_interval = PG_GETARG_FLOAT8(2);
536 level_base = PG_GETARG_FLOAT8(3);
538 if (level_interval <= 0.0) {
539 elog(ERROR,
"%s: level interval must be greater than zero", __func__);
543 polygonize = PG_GETARG_BOOL(5);
546 array = PG_GETARG_ARRAYTYPE_P(4);
547 array_size = ArrayGetNItems(ARR_NDIM(array), ARR_DIMS(array));
548 if (array_size > 0) {
551 ArrayIterator iterator = array_create_iterator(array, 0, NULL);
552 fixed_levels = palloc0(array_size *
sizeof(
double));
553 while (array_iterate(iterator, &
value, &isnull))
560 if (fixed_levels_count >= array_size)
563 fixed_levels[fixed_levels_count++] = DatumGetFloat8(
value);
589 funcctx->user_fctx =
result;
590 funcctx->max_calls =
result->ncontours;
591 MemoryContextSwitchTo(oldcontext);
595 funcctx = SRF_PERCALL_SETUP();
598 if (funcctx->call_cntr < funcctx->max_calls) {
602 Datum values[3] = {0, 0, 0};
603 bool nulls[3] = {0, 0, 0};
605 gdal_contour_result_t *
result = funcctx->user_fctx;
609 values[0] = PointerGetDatum(c.
geom);
610 values[1] = Int32GetDatum(c.
id);
620 tuple = heap_form_tuple(funcctx->tuple_desc, values, nulls);
621 srf_result = HeapTupleGetDatum(tuple);
622 SRF_RETURN_NEXT(funcctx, srf_result);
625 SRF_RETURN_DONE(funcctx);
632 const char *pszMessage,
639 return !(QueryCancelPending || ProcDiePending);
662 uint32_t out_rast_bands[1] = {0};
666 uint16_t in_band_width, in_band_height;
669 GDALDataType in_band_gdaltype;
670 size_t in_band_gdaltype_size;
674 GDALGridAlgorithm algorithm;
675 text *options_txt = NULL;
676 void *options_struct = NULL;
684 size_t coord_count = 0;
686 double *xcoords, *ycoords, *zcoords;
692 elog(ERROR,
"%s: input geometry does not have Z values", __func__);
698 in_pgrast = (
rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(2));
701 elog(ERROR,
"%s: Could not deserialize raster", __func__);
706 elog(ERROR,
"%s: Cannot generate a grid into a skewed raster",__func__);
710 options_txt = PG_GETARG_TEXT_P(1);
712 band_number = PG_GETARG_INT32(3);
714 elog(ERROR,
"%s: Invalid band number %d", __func__, band_number);
720 elog(ERROR,
"%s: Geometry has no points", __func__);
724 elog(ERROR,
"%s: Cannot access raster band %d", __func__, band_number);
729 elog(ERROR,
"%s: Unable to calculate envelope", __func__);
736 in_band_gdaltype_size = GDALGetDataTypeSizeBytes(in_band_gdaltype);
770 out_data = palloc(in_band_gdaltype_size * in_band_width * in_band_height);
773 xcoords = palloc(
sizeof(
double) * npoints);
774 ycoords = palloc(
sizeof(
double) * npoints);
775 zcoords = palloc(
sizeof(
double) * npoints);
780 if (coord_count >= npoints)
781 elog(ERROR,
"%s: More points from iterator than expected", __func__);
782 xcoords[coord_count] = pt.
x;
783 ycoords[coord_count] = pt.
y;
784 zcoords[coord_count] = pt.
z;
791 err = ParseAlgorithmAndOptions(
792 text_to_cstring(options_txt),
795 if (err != CE_None) {
796 if (options_struct)
free(options_struct);
797 elog(ERROR,
"%s: Unable to parse options string: %s", __func__, CPLGetLastErrorMsg());
801 err = GDALGridCreate(
802 algorithm, options_struct,
803 npoints, xcoords, ycoords, zcoords,
805 in_band_width, in_band_height,
806 in_band_gdaltype, out_data,
813 free(options_struct);
815 if (err != CE_None) {
816 elog(ERROR,
"%s: GDALGridCreate failed: %s", __func__, CPLGetLastErrorMsg());
819 out_rast_bands[0] = band_number-1;
823 elog(ERROR,
"%s: Cannot access output raster band", __func__);
826 for (uint32_t
y = 0;
y < in_band_height;
y++) {
827 size_t offset = (in_band_height-
y-1) * (in_band_gdaltype_size * in_band_width);
835 if (NULL == out_pgrast) PG_RETURN_NULL();
837 SET_VARSIZE(out_pgrast, out_pgrast->
size);
838 PG_RETURN_POINTER(out_pgrast);
854 text *algtext = NULL;
855 char *algchar = NULL;
856 GDALResampleAlg alg = GRA_NearestNeighbour;
857 double max_err = 0.125;
860 char *src_srs = NULL;
862 char *dst_srs = NULL;
865 double scale[2] = {0};
866 double *scale_x = NULL;
867 double *scale_y = NULL;
869 double gridw[2] = {0};
870 double *grid_xw = NULL;
871 double *grid_yw = NULL;
873 double skew[2] = {0};
874 double *skew_x = NULL;
875 double *skew_y = NULL;
886 pgraster = (
rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
891 PG_FREE_IF_COPY(pgraster, 0);
892 elog(ERROR,
"RASTER_GDALWarp: Could not deserialize raster");
897 if (!PG_ARGISNULL(1)) {
898 algtext = PG_GETARG_TEXT_P(1);
905 if (!PG_ARGISNULL(2)) {
906 max_err = PG_GETARG_FLOAT8(2);
907 if (max_err < 0.) max_err = 0.;
916 if (!PG_ARGISNULL(3)) {
920 PG_FREE_IF_COPY(pgraster, 0);
921 elog(ERROR,
"RASTER_GDALWarp: %d is an invalid target SRID", dst_srid);
932 PG_FREE_IF_COPY(pgraster, 0);
933 elog(ERROR,
"RASTER_GDALWarp: Input raster has unknown (%d) SRID", src_srid);
937 else if (dst_srid == src_srid) {
942 if (!PG_ARGISNULL(4)) {
943 scale[0] = PG_GETARG_FLOAT8(4);
949 if (!PG_ARGISNULL(5)) {
950 scale[1] = PG_GETARG_FLOAT8(5);
956 if (!PG_ARGISNULL(6)) {
957 gridw[0] = PG_GETARG_FLOAT8(6);
962 if (!PG_ARGISNULL(7)) {
963 gridw[1] = PG_GETARG_FLOAT8(7);
968 if (!PG_ARGISNULL(8)) {
969 skew[0] = PG_GETARG_FLOAT8(8);
975 if (!PG_ARGISNULL(9)) {
976 skew[1] = PG_GETARG_FLOAT8(9);
982 if (!PG_ARGISNULL(10)) {
983 dim[0] = PG_GETARG_INT32(10);
984 if (dim[0] < 0) dim[0] = 0;
985 if (dim[0] > 0) dim_x = &dim[0];
989 if (!PG_ARGISNULL(11)) {
990 dim[1] = PG_GETARG_INT32(11);
991 if (dim[1] < 0) dim[1] = 0;
992 if (dim[1] > 0) dim_y = &dim[1];
998 (scale_x == NULL) && (scale_y == NULL) &&
999 (grid_xw == NULL) && (grid_yw == NULL) &&
1000 (skew_x == NULL) && (skew_y == NULL) &&
1001 (dim_x == NULL) && (dim_y == NULL)
1003 elog(NOTICE,
"No resampling parameters provided. Returning original raster");
1005 PG_RETURN_POINTER(pgraster);
1009 (grid_xw != NULL && grid_yw == NULL) ||
1010 (grid_xw == NULL && grid_yw != NULL)
1012 elog(NOTICE,
"Values must be provided for both X and Y when specifying the alignment. Returning original raster");
1014 PG_RETURN_POINTER(pgraster);
1018 (scale_x != NULL && scale_y == NULL) ||
1019 (scale_x == NULL && scale_y != NULL)
1021 elog(NOTICE,
"Values must be provided for both X and Y when specifying the scale. Returning original raster");
1023 PG_RETURN_POINTER(pgraster);
1027 (scale_x != NULL || scale_y != NULL) &&
1028 (dim_x != NULL || dim_y != NULL)
1030 elog(NOTICE,
"Scale X/Y and width/height are mutually exclusive. Only provide one. Returning original raster");
1032 PG_RETURN_POINTER(pgraster);
1039 if (NULL == src_srs) {
1041 PG_FREE_IF_COPY(pgraster, 0);
1042 elog(ERROR,
"RASTER_GDALWarp: Input raster has unknown SRID (%d)", src_srid);
1048 if (NULL == dst_srs) {
1051 PG_FREE_IF_COPY(pgraster, 0);
1052 elog(ERROR,
"RASTER_GDALWarp: Target SRID (%d) is unknown", dst_srid);
1068 PG_FREE_IF_COPY(pgraster, 0);
1074 elog(ERROR,
"RASTER_band: Could not create transformed raster");
1084 if (NULL == pgrast) PG_RETURN_NULL();
1088 SET_VARSIZE(pgrast, pgrast->
size);
1089 PG_RETURN_POINTER(pgrast);
1095 #define gdalErrorTypesSize 17
1111 "AWSBucketNotFound",
1112 "AWSObjectNotFound",
1114 "AWSInvalidCredentials",
1115 "AWSSignatureDoesNotMatch"
1121 const char* gdalErrType =
"unknown type";
1129 elog(NOTICE,
"GDAL %s [%d] %s", gdalErrType, err_no, msg);
1132 elog(DEBUG2,
"GDAL %s [%d] %s", gdalErrType, err_no, msg);
1135 elog(WARNING,
"GDAL %s [%d] %s", gdalErrType, err_no, msg);
1140 elog(ERROR,
"GDAL %s [%d] %s", gdalErrType, err_no, msg);
1150 CPLSetConfigOption(
"CPL_DEBUG",
value ?
"ON" :
"OFF");
1153 CPLSetCurrentErrorHandlerCatchDebug(
value);
char result[OUT_DOUBLE_BUFFER_SIZE]
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
int gserialized_has_z(const GSERIALIZED *g)
Check if a GSERIALIZED has a Z ordinate.
LWPOINTITERATOR * lwpointiterator_create(const LWGEOM *g)
Create a new LWPOINTITERATOR over supplied LWGEOM*.
int lwpointiterator_next(LWPOINTITERATOR *s, POINT4D *p)
Attempts to assign the next point in the iterator to p, and advances the iterator to the next point.
void lwpointiterator_destroy(LWPOINTITERATOR *s)
Free all memory associated with the iterator.
uint32_t lwgeom_count_vertices(const LWGEOM *geom)
Count the total number of vertices in any LWGEOM.
#define SRID_UNKNOWN
Unknown SRID value.
int32_t clamp_srid(int32_t srid)
Return a valid SRID from an arbitrary integer Raises a notice if what comes out is different from wha...
uint16_t rt_band_get_width(rt_band band)
Return width of this band.
int32_t rt_raster_get_srid(rt_raster raster)
Get raster's SRID.
int rt_util_gdal_register_all(int force_register_all)
double rt_raster_get_x_skew(rt_raster raster)
Get skew about the X axis.
rt_gdaldriver rt_raster_gdal_drivers(uint32_t *drv_count, uint8_t cancc)
Returns a set of available GDAL drivers.
uint8_t * rt_raster_to_gdal(rt_raster raster, const char *srs, char *format, char **options, uint64_t *gdalsize)
Return formatted GDAL raster from raster.
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
GDALDataType rt_util_pixtype_to_gdal_datatype(rt_pixtype pt)
Convert rt_pixtype to GDALDataType.
void * rt_raster_serialize(rt_raster raster)
Return this raster in serialized form.
rt_raster rt_raster_from_gdal_dataset(GDALDatasetH ds)
Return a raster from a GDAL dataset.
GDALDatasetH rt_util_gdal_open(const char *fn, GDALAccess fn_access, int shared)
rt_errorstate
Enum definitions.
rt_errorstate rt_band_set_pixel_line(rt_band band, int x, int y, void *vals, uint32_t len)
Set values of multiple pixels.
GDALResampleAlg rt_util_gdal_resample_alg(const char *algname)
Convert cstring name to GDAL Resample Algorithm.
uint16_t rt_raster_get_num_bands(rt_raster raster)
void rt_raster_set_srid(rt_raster raster, int32_t srid)
Set raster's SRID.
rt_raster rt_raster_from_band(rt_raster raster, uint32_t *bandNums, int count)
Construct a new rt_raster from an existing rt_raster and an array of band numbers.
rt_pixtype rt_band_get_pixtype(rt_band band)
Return pixeltype of this band.
rt_raster rt_raster_gdal_warp(rt_raster raster, const char *src_srs, const char *dst_srs, double *scale_x, double *scale_y, int *width, int *height, double *ul_xw, double *ul_yw, double *grid_xw, double *grid_yw, double *skew_x, double *skew_y, GDALResampleAlg resample_alg, double max_err)
Return a warped raster using GDAL Warp API.
int rt_raster_gdal_contour(rt_raster src_raster, int src_band, int src_srid, const char *src_srs, double contour_interval, double contour_base, int fixed_level_count, double *fixed_levels, int polygonize, size_t *ncontours, struct rt_contour_t **contours)
Return palloc'ed list of contours.
rt_errorstate rt_raster_get_envelope(rt_raster raster, rt_envelope *env)
Get raster's envelope.
double rt_raster_get_y_skew(rt_raster raster)
Get skew about the Y axis.
uint16_t rt_band_get_height(rt_band band)
Return height of this band.
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
rt_band rt_raster_get_band(rt_raster raster, int bandNum)
Return Nth band, or NULL if unavailable.
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Datum RASTER_setGDALOpenOptions(PG_FUNCTION_ARGS)
Datum RASTER_Contour(PG_FUNCTION_ARGS)
Datum RASTER_fromGDALRaster(PG_FUNCTION_ARGS)
Datum RASTER_getGDALDrivers(PG_FUNCTION_ARGS)
static void ogrErrorHandler(CPLErr eErrClass, int err_no, const char *msg)
Datum RASTER_asGDALRaster(PG_FUNCTION_ARGS)
#define gdalErrorTypesSize
PG_FUNCTION_INFO_V1(RASTER_fromGDALRaster)
static const char *const gdalErrorTypes[gdalErrorTypesSize]
void rtpg_gdal_set_cpl_debug(bool value, void *extra)
Datum RASTER_InterpolateRaster(PG_FUNCTION_ARGS)
static int rtpg_util_gdal_progress_func(double dfComplete, const char *pszMessage, void *pProgressArg)
Datum RASTER_GDALWarp(PG_FUNCTION_ARGS)
char * rtpg_getSR(int32_t srid)
char * rtpg_strtoupper(char *str)
char * rtpg_trim(const char *input)
#define POSTGIS_RT_DEBUG(level, msg)
#define POSTGIS_RT_DEBUGF(level, msg,...)