Check-in [961e1780c4]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:implementing more WriteSection SQL functions
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 961e1780c4f016bc76c86c24177cec7845121d6d
User & Date: sandro 2014-08-11 15:02:42
Context
2014-08-17
15:33
implementing rl2sniff / removing any direct link to libspatialite check-in: f44dced488 user: sandro tags: trunk
2014-08-11
15:02
implementing more WriteSection SQL functions check-in: 961e1780c4 user: sandro tags: trunk
2014-08-10
11:46
switching to RC1 - implementing Policy Options check-in: 7e9b5e94f4 user: sandro tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to headers/rasterlite2/rasterlite2.h.

2969
2970
2971
2972
2973
2974
2975
















2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987














2988
2989
2990
2991
2992
2993
2994
....
3284
3285
3286
3287
3288
3289
3290


























3291
3292
3293
3294
3295
3296
3297
....
3298
3299
3300
3301
3302
3303
3304




















3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330

3331

3332
3333



























3334
3335
3336
3337
3338
3339
3340
....
3342
3343
3344
3345
3346
3347
3348

























3349
3350
3351
3352
3353
3354
3355
....
3357
3358
3359
3360
3361
3362
3363


















3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376














3377
3378
3379
3380
3381
3382
3383
					     unsigned char red_band,
					     unsigned char green_band,
					     unsigned char blue_band,
					     unsigned char **buffer,
					     int *buf_size,
					     rl2PixelPtr no_data);

















    RL2_DECLARE int
	rl2_get_mono_band_raw_raster_data (sqlite3 * handle,
					   rl2CoveragePtr cvg,
					   unsigned int width,
					   unsigned int height,
					   double minx, double miny,
					   double maxx, double maxy,
					   double x_res, double y_res,
					   unsigned char mono_band,
					   unsigned char **buffer,
					   int *buf_size, rl2PixelPtr no_data);















    RL2_DECLARE int
	rl2_get_raw_raster_data_bgcolor (sqlite3 * handle, rl2CoveragePtr cvg,
					 unsigned int width,
					 unsigned int height, double minx,
					 double miny, double maxx, double maxy,
					 double x_res, double y_res,
					 unsigned char **buffer, int *buf_size,
................................................................................
						  unsigned char red_band,
						  unsigned char green_band,
						  unsigned char blue_band,
						  unsigned char compression,
						  unsigned int tile_sz,
						  int with_worldfile);



























    RL2_DECLARE int
	rl2_export_mono_band_geotiff_from_dbms (sqlite3 * handle,
						const char *dst_path,
						rl2CoveragePtr coverage,
						double x_res, double y_res,
						double minx, double miny,
						double maxx, double maxy,
................................................................................
						unsigned int width,
						unsigned int height,
						unsigned char mono_band,
						unsigned char compression,
						unsigned int tile_sz,
						int with_worldfile);





















    RL2_DECLARE int
	rl2_export_triple_band_tiff_worldfile_from_dbms (sqlite3 * handle,
							 const char *dst_path,
							 rl2CoveragePtr
							 coverage,
							 double x_res,
							 double y_res,
							 double minx,
							 double miny,
							 double maxx,
							 double maxy,
							 unsigned int width,
							 unsigned int
							 height,
							 unsigned char
							 red_band,
							 unsigned char
							 green_band,
							 unsigned char
							 blue_band,
							 unsigned char
							 compression,
							 unsigned int tile_sz);

    RL2_DECLARE int
	rl2_export_mono_band_tiff_worldfile_from_dbms (sqlite3 * handle,

						       const char *dst_path,

						       rl2CoveragePtr
						       coverage,



























						       double x_res,
						       double y_res,
						       double minx,
						       double miny,
						       double maxx,
						       double maxy,
						       unsigned int width,
................................................................................
						       height,
						       unsigned char
						       mono_band,
						       unsigned char
						       compression,
						       unsigned int tile_sz);


























    RL2_DECLARE int
	rl2_export_triple_band_tiff_from_dbms (sqlite3 * handle,
					       const char *dst_path,
					       rl2CoveragePtr coverage,
					       double x_res, double y_res,
					       double minx, double miny,
					       double maxx, double maxy,
................................................................................
					       unsigned int height,
					       unsigned char red_band,
					       unsigned char green_band,
					       unsigned char blue_band,
					       unsigned char compression,
					       unsigned int tile_sz);



















    RL2_DECLARE int
	rl2_export_mono_band_tiff_from_dbms (sqlite3 * handle,
					     const char *dst_path,
					     rl2CoveragePtr coverage,
					     double x_res, double y_res,
					     double minx, double miny,
					     double maxx, double maxy,
					     unsigned int width,
					     unsigned int height,
					     unsigned char mono_band,
					     unsigned char compression,
					     unsigned int tile_sz);















    RL2_DECLARE int
	rl2_export_ascii_grid_from_dbms (sqlite3 * handle, const char *dst_path,
					 rl2CoveragePtr coverage, double res,
					 double minx, double miny, double maxx,
					 double maxy, unsigned int width,
					 unsigned int height, int is_centered,
					 int decimal_digits);







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>












>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




<
|






|
<
|
<









|
>
|
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>













>
>
>
>
>
>
>
>
>
>
>
>
>
>







2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
....
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
....
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384

3385
3386
3387
3388
3389
3390
3391
3392

3393

3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
....
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
....
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
					     unsigned char red_band,
					     unsigned char green_band,
					     unsigned char blue_band,
					     unsigned char **buffer,
					     int *buf_size,
					     rl2PixelPtr no_data);

    RL2_DECLARE int
	rl2_get_section_triple_band_raw_raster_data (sqlite3 * handle,
						     rl2CoveragePtr cvg,
						     sqlite3_int64 section_id,
						     unsigned int width,
						     unsigned int height,
						     double minx, double miny,
						     double maxx, double maxy,
						     double x_res, double y_res,
						     unsigned char red_band,
						     unsigned char green_band,
						     unsigned char blue_band,
						     unsigned char **buffer,
						     int *buf_size,
						     rl2PixelPtr no_data);

    RL2_DECLARE int
	rl2_get_mono_band_raw_raster_data (sqlite3 * handle,
					   rl2CoveragePtr cvg,
					   unsigned int width,
					   unsigned int height,
					   double minx, double miny,
					   double maxx, double maxy,
					   double x_res, double y_res,
					   unsigned char mono_band,
					   unsigned char **buffer,
					   int *buf_size, rl2PixelPtr no_data);

    RL2_DECLARE int
	rl2_get_section_mono_band_raw_raster_data (sqlite3 * handle,
						   rl2CoveragePtr cvg,
						   sqlite3_int64 section_id,
						   unsigned int width,
						   unsigned int height,
						   double minx, double miny,
						   double maxx, double maxy,
						   double x_res, double y_res,
						   unsigned char mono_band,
						   unsigned char **buffer,
						   int *buf_size,
						   rl2PixelPtr no_data);

    RL2_DECLARE int
	rl2_get_raw_raster_data_bgcolor (sqlite3 * handle, rl2CoveragePtr cvg,
					 unsigned int width,
					 unsigned int height, double minx,
					 double miny, double maxx, double maxy,
					 double x_res, double y_res,
					 unsigned char **buffer, int *buf_size,
................................................................................
						  unsigned char red_band,
						  unsigned char green_band,
						  unsigned char blue_band,
						  unsigned char compression,
						  unsigned int tile_sz,
						  int with_worldfile);

    RL2_DECLARE int
	rl2_export_section_triple_band_geotiff_from_dbms (sqlite3 * handle,
							  const char *dst_path,
							  rl2CoveragePtr
							  coverage,
							  sqlite3_int64
							  section_id,
							  double x_res,
							  double y_res,
							  double minx,
							  double miny,
							  double maxx,
							  double maxy,
							  unsigned int width,
							  unsigned int height,
							  unsigned char
							  red_band,
							  unsigned char
							  green_band,
							  unsigned char
							  blue_band,
							  unsigned char
							  compression,
							  unsigned int tile_sz,
							  int with_worldfile);

    RL2_DECLARE int
	rl2_export_mono_band_geotiff_from_dbms (sqlite3 * handle,
						const char *dst_path,
						rl2CoveragePtr coverage,
						double x_res, double y_res,
						double minx, double miny,
						double maxx, double maxy,
................................................................................
						unsigned int width,
						unsigned int height,
						unsigned char mono_band,
						unsigned char compression,
						unsigned int tile_sz,
						int with_worldfile);

    RL2_DECLARE int
	rl2_export_section_mono_band_geotiff_from_dbms (sqlite3 * handle,
							const char *dst_path,
							rl2CoveragePtr coverage,
							sqlite3_int64
							section_id,
							double x_res,
							double y_res,
							double minx,
							double miny,
							double maxx,
							double maxy,
							unsigned int width,
							unsigned int height,
							unsigned char mono_band,
							unsigned char
							compression,
							unsigned int tile_sz,
							int with_worldfile);

    RL2_DECLARE int
	rl2_export_triple_band_tiff_worldfile_from_dbms (sqlite3 * handle,
							 const char *dst_path,
							 rl2CoveragePtr

							 coverage, double x_res,
							 double y_res,
							 double minx,
							 double miny,
							 double maxx,
							 double maxy,
							 unsigned int width,
							 unsigned int height,

							 unsigned char red_band,

							 unsigned char
							 green_band,
							 unsigned char
							 blue_band,
							 unsigned char
							 compression,
							 unsigned int tile_sz);

    RL2_DECLARE int
	rl2_export_section_triple_band_tiff_worldfile_from_dbms (sqlite3 *
								 handle,
								 const char
								 *dst_path,
								 rl2CoveragePtr
								 coverage,
								 sqlite3_int64
								 section_id,
								 double x_res,
								 double y_res,
								 double minx,
								 double miny,
								 double maxx,
								 double maxy,
								 unsigned int
								 width,
								 unsigned int
								 height,
								 unsigned char
								 red_band,
								 unsigned char
								 green_band,
								 unsigned char
								 blue_band,
								 unsigned char
								 compression,
								 unsigned int
								 tile_sz);

    RL2_DECLARE int
	rl2_export_mono_band_tiff_worldfile_from_dbms (sqlite3 * handle,
						       const char *dst_path,
						       rl2CoveragePtr coverage,
						       double x_res,
						       double y_res,
						       double minx,
						       double miny,
						       double maxx,
						       double maxy,
						       unsigned int width,
................................................................................
						       height,
						       unsigned char
						       mono_band,
						       unsigned char
						       compression,
						       unsigned int tile_sz);

    RL2_DECLARE int
	rl2_export_section_mono_band_tiff_worldfile_from_dbms (sqlite3 * handle,
							       const char
							       *dst_path,
							       rl2CoveragePtr
							       coverage,
							       sqlite3_int64
							       section_id,
							       double x_res,
							       double y_res,
							       double minx,
							       double miny,
							       double maxx,
							       double maxy,
							       unsigned int
							       width,
							       unsigned int
							       height,
							       unsigned char
							       mono_band,
							       unsigned char
							       compression,
							       unsigned int
							       tile_sz);

    RL2_DECLARE int
	rl2_export_triple_band_tiff_from_dbms (sqlite3 * handle,
					       const char *dst_path,
					       rl2CoveragePtr coverage,
					       double x_res, double y_res,
					       double minx, double miny,
					       double maxx, double maxy,
................................................................................
					       unsigned int height,
					       unsigned char red_band,
					       unsigned char green_band,
					       unsigned char blue_band,
					       unsigned char compression,
					       unsigned int tile_sz);

    RL2_DECLARE int
	rl2_export_section_triple_band_tiff_from_dbms (sqlite3 * handle,
						       const char *dst_path,
						       rl2CoveragePtr coverage,
						       sqlite3_int64 section_id,
						       double x_res,
						       double y_res,
						       double minx, double miny,
						       double maxx, double maxy,
						       unsigned int width,
						       unsigned int height,
						       unsigned char red_band,
						       unsigned char green_band,
						       unsigned char blue_band,
						       unsigned char
						       compression,
						       unsigned int tile_sz);

    RL2_DECLARE int
	rl2_export_mono_band_tiff_from_dbms (sqlite3 * handle,
					     const char *dst_path,
					     rl2CoveragePtr coverage,
					     double x_res, double y_res,
					     double minx, double miny,
					     double maxx, double maxy,
					     unsigned int width,
					     unsigned int height,
					     unsigned char mono_band,
					     unsigned char compression,
					     unsigned int tile_sz);

    RL2_DECLARE int
	rl2_export_section_mono_band_tiff_from_dbms (sqlite3 * handle,
						     const char *dst_path,
						     rl2CoveragePtr coverage,
						     sqlite3_int64 section_id,
						     double x_res, double y_res,
						     double minx, double miny,
						     double maxx, double maxy,
						     unsigned int width,
						     unsigned int height,
						     unsigned char mono_band,
						     unsigned char compression,
						     unsigned int tile_sz);

    RL2_DECLARE int
	rl2_export_ascii_grid_from_dbms (sqlite3 * handle, const char *dst_path,
					 rl2CoveragePtr coverage, double res,
					 double minx, double miny, double maxx,
					 double maxy, unsigned int width,
					 unsigned int height, int is_centered,
					 int decimal_digits);

Changes to src/Makefile.am.

14
15
16
17
18
19
20

21
22

23
24
25
26
27
28
29
..
40
41
42
43
44
45
46

47
48

49
50
51
	rl2ascii.c rl2paint.c rl2dbms.c rl2import.c rl2pyramid.c \
	rl2sql.c rl2sqlaux.c rl2auxrender.c rl2svg.c rl2svgxml.c \
	rl2svgaux.c rl2symbolizer.c rl2rastersym.c rl2version.c \
	rl2md5.c md5.c

if MINGW
librasterlite2_la_LDFLAGS = -avoid-version -no-undefined

else
librasterlite2_la_LDFLAGS = -version-info 1:0:0

endif

librasterlite2_la_LIBADD = @LIBPNG_LIBS@ @LIBWEBP_LIBS@ \
	@LIBLZMA_LIBS@ @LIBSPATIALITE_LIBS@ @LIBCAIRO_LIBS@ \
	@LIBCURL_LIBS@ @LIBXML2_LIBS@

mod_rasterlite2_la_SOURCES = rasterlite2.c rl2raw.c rl2codec.c \
................................................................................
mod_rasterlite2_la_CPPFLAGS = @CFLAGS@
mod_rasterlite2_la_CPPFLAGS += -I$(top_srcdir)/headers -I.
mod_rasterlite2_la_CPPFLAGS += -DLOADABLE_EXTENSION
mod_rasterlite2_la_LIBTOOLFLAGS = --tag=disable-static

if MINGW
mod_rasterlite2_la_LDFLAGS = -module -avoid-version -no-undefined

else
mod_rasterlite2_la_LDFLAGS = -module -version-info 1:0:0

endif

MOSTLYCLEANFILES = *.gcna *.gcno *.gcda







>


>







 







>


>



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
..
42
43
44
45
46
47
48
49
50
51
52
53
54
55
	rl2ascii.c rl2paint.c rl2dbms.c rl2import.c rl2pyramid.c \
	rl2sql.c rl2sqlaux.c rl2auxrender.c rl2svg.c rl2svgxml.c \
	rl2svgaux.c rl2symbolizer.c rl2rastersym.c rl2version.c \
	rl2md5.c md5.c

if MINGW
librasterlite2_la_LDFLAGS = -avoid-version -no-undefined
librasterlite2_la_LIBADD += -lm
else
librasterlite2_la_LDFLAGS = -version-info 1:0:0
librasterlite2_la_LIBADD += -lpthread -lm
endif

librasterlite2_la_LIBADD = @LIBPNG_LIBS@ @LIBWEBP_LIBS@ \
	@LIBLZMA_LIBS@ @LIBSPATIALITE_LIBS@ @LIBCAIRO_LIBS@ \
	@LIBCURL_LIBS@ @LIBXML2_LIBS@

mod_rasterlite2_la_SOURCES = rasterlite2.c rl2raw.c rl2codec.c \
................................................................................
mod_rasterlite2_la_CPPFLAGS = @CFLAGS@
mod_rasterlite2_la_CPPFLAGS += -I$(top_srcdir)/headers -I.
mod_rasterlite2_la_CPPFLAGS += -DLOADABLE_EXTENSION
mod_rasterlite2_la_LIBTOOLFLAGS = --tag=disable-static

if MINGW
mod_rasterlite2_la_LDFLAGS = -module -avoid-version -no-undefined
mod_rasterlite2_la_LIBADD += -lm
else
mod_rasterlite2_la_LDFLAGS = -module -version-info 1:0:0
mod_rasterlite2_la_LIBADD += -lpthread -lm
endif

MOSTLYCLEANFILES = *.gcna *.gcno *.gcda

Changes to src/rl2ascii.c.

255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
....
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343

RL2_DECLARE rl2AsciiGridOriginPtr
rl2_create_ascii_grid_origin (const char *path, int srid,
			      unsigned char sample_type)
{
/* creating an ASCII Grid Origin */
    FILE *in;
    unsigned int width;
    unsigned int height;
    double minx;
    double miny;
    double maxx;
    double maxy;
    double xres;
    double yres;
    double no_data;
    char buf[1024];
    char *p_out = buf;
    unsigned int line_no = 0;
    unsigned int col_no = 0;
    int new_line = 1;
    int c;
    rl2PrivAsciiOriginPtr ascii = NULL;
................................................................................
}

RL2_DECLARE int
rl2_write_ascii_grid_scanline (rl2AsciiGridDestinationPtr ascii,
			       unsigned int *line_no)
{
/* attempting to write a scanline into an ASCII Grid */
    char *p8;
    unsigned char *pu8;
    short *p16;
    unsigned short *pu16;
    int *p32;
    unsigned int *pu32;
    float *pflt;
    double *pdbl;
    double cell_value;
    char *pxl;
    unsigned int x;
    rl2PrivAsciiDestinationPtr dst = (rl2PrivAsciiDestinationPtr) ascii;

    if (dst == NULL)
	return RL2_ERROR;
    if (dst->out == NULL)







|
|
|
|
|
|
|
|
|







 







|
|
|
|
|
|
|
|
|







255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
....
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343

RL2_DECLARE rl2AsciiGridOriginPtr
rl2_create_ascii_grid_origin (const char *path, int srid,
			      unsigned char sample_type)
{
/* creating an ASCII Grid Origin */
    FILE *in;
    unsigned int width = 0;
    unsigned int height = 0;
    double minx = 0.0;
    double miny = 0.0;
    double maxx = 0.0;
    double maxy = 0.0;
    double xres = 0.0;
    double yres = 0.0;
    double no_data = 0.0;
    char buf[1024];
    char *p_out = buf;
    unsigned int line_no = 0;
    unsigned int col_no = 0;
    int new_line = 1;
    int c;
    rl2PrivAsciiOriginPtr ascii = NULL;
................................................................................
}

RL2_DECLARE int
rl2_write_ascii_grid_scanline (rl2AsciiGridDestinationPtr ascii,
			       unsigned int *line_no)
{
/* attempting to write a scanline into an ASCII Grid */
    char *p8 = NULL;
    unsigned char *pu8 = NULL;
    short *p16 = NULL;
    unsigned short *pu16 = NULL;
    int *p32 = NULL;
    unsigned int *pu32 = NULL;
    float *pflt = NULL;
    double *pdbl = NULL;
    double cell_value = 0.0;
    char *pxl;
    unsigned int x;
    rl2PrivAsciiDestinationPtr dst = (rl2PrivAsciiDestinationPtr) ascii;

    if (dst == NULL)
	return RL2_ERROR;
    if (dst->out == NULL)

Changes to src/rl2codec.c.

1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
....
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
....
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
    int o_stride = 0;
    int e_stride = 0;
    unsigned char *pix_odd = NULL;
    unsigned char *pix_even = NULL;
    int o_size;
    int e_size;
    unsigned int row;
    int pix_size;
    int swap = 0;
    if (little_endian != endianArch ())
	swap = 1;
    else
	swap = 0;

/* computing the required sizes */
................................................................................
    int mask_pix_size = 0;
    unsigned char *block_odd = NULL;
    int block_odd_size = 0;
    int row_stride_even = 0;
    unsigned char *block_even = NULL;
    int block_even_size = 0;
    unsigned char *ptr;
    int uncompressed;
    int compressed;
    int uncompressed_mask = 0;
    int compressed_mask = 0;
    unsigned char *compr_data = NULL;
    unsigned char *compr_mask = NULL;
    unsigned char *to_clean1 = NULL;
    unsigned char *to_clean2 = NULL;
................................................................................
{
/* decoding from internal RL2 binary format to Raster */
    rl2RasterPtr raster;
    rl2PalettePtr palette = NULL;
    rl2PalettePtr palette2 = NULL;
    unsigned int width;
    unsigned int height;
    unsigned short mask_width;
    unsigned short mask_height;
    unsigned char sample_type;
    unsigned char pixel_type;
    unsigned char num_bands;
    unsigned char compression;
    unsigned short row_stride_odd;
    unsigned int odd_rows;
    unsigned int even_rows;







|







 







|







 







|
|







1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
....
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
....
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
    int o_stride = 0;
    int e_stride = 0;
    unsigned char *pix_odd = NULL;
    unsigned char *pix_even = NULL;
    int o_size;
    int e_size;
    unsigned int row;
    int pix_size = 1;
    int swap = 0;
    if (little_endian != endianArch ())
	swap = 1;
    else
	swap = 0;

/* computing the required sizes */
................................................................................
    int mask_pix_size = 0;
    unsigned char *block_odd = NULL;
    int block_odd_size = 0;
    int row_stride_even = 0;
    unsigned char *block_even = NULL;
    int block_even_size = 0;
    unsigned char *ptr;
    int uncompressed = 0;
    int compressed;
    int uncompressed_mask = 0;
    int compressed_mask = 0;
    unsigned char *compr_data = NULL;
    unsigned char *compr_mask = NULL;
    unsigned char *to_clean1 = NULL;
    unsigned char *to_clean2 = NULL;
................................................................................
{
/* decoding from internal RL2 binary format to Raster */
    rl2RasterPtr raster;
    rl2PalettePtr palette = NULL;
    rl2PalettePtr palette2 = NULL;
    unsigned int width;
    unsigned int height;
    unsigned short mask_width = 0;
    unsigned short mask_height = 0;
    unsigned char sample_type;
    unsigned char pixel_type;
    unsigned char num_bands;
    unsigned char compression;
    unsigned short row_stride_odd;
    unsigned int odd_rows;
    unsigned int even_rows;

Changes to src/rl2dbms.c.

745
746
747
748
749
750
751
752
753
754
755

756
757























758
759
760
761
762
763
764
...
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
....
4023
4024
4025
4026
4027
4028
4029
4030
4031


4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
....
4100
4101
4102
4103
4104
4105
4106









4107

4108
4109
4110
4111
4112
4113











4114
4115
4116
4117
4118
4119
4120
....
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168













































4169
4170
4171
4172
4173
4174
4175
....
4227
4228
4229
4230
4231
4232
4233










4234

4235
4236
4237
4238
4239
4240











4241
4242
4243
4244
4245
4246
4247
....
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303




















4304
4305
4306
4307
4308
4309
4310
....
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
      }
    sqlite3_free (xcoverage);

/* creating the TILES index by section */
    xcoverage = sqlite3_mprintf ("%s_tiles", coverage);
    xxcoverage = gaiaDoubleQuotedSql (xcoverage);
    sqlite3_free (xcoverage);
    xindex = sqlite3_mprintf ("idx_%s_tiles", coverage);
    xxindex = gaiaDoubleQuotedSql (xindex);
    sqlite3_free (xindex);
    sql =

	sqlite3_mprintf ("CREATE INDEX \"%s\" ON \"%s\" (section_id)", xxindex,
			 xxcoverage);























    free (xxcoverage);
    ret = sqlite3_exec (handle, sql, NULL, NULL, &sql_err);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
      {
	  fprintf (stderr, "CREATE INDEX \"%s\" error: %s\n", xxindex, sql_err);
	  sqlite3_free (sql_err);
................................................................................
    unsigned char scale;
    int ret;
    char *sql;
    char *table;
    char *xtable;
    int count = 0;
    sqlite3_stmt *stmt = NULL;
    double minx;
    double miny;
    double maxx;
    double maxy;
    int width;
    int height;

    cvg = rl2_create_coverage_from_dbms (handle, coverage);
    if (cvg == NULL)
	return RL2_ERROR;
    if (rl2_find_matching_resolution
	(handle, cvg, &xx_res, &yy_res, &level, &scale) != RL2_OK)
	return RL2_ERROR;
................................................................................
/* attempting to return a buffer containing raw pixels from the DBMS Coverage/Section */
    return get_raw_raster_data_common (handle, cvg, 1, section_id, width,
				       height, minx, miny, maxx, maxy, x_res,
				       y_res, buffer, buf_size, palette,
				       out_pixel, NULL, NULL, NULL);
}

RL2_DECLARE int
rl2_get_triple_band_raw_raster_data (sqlite3 * handle, rl2CoveragePtr cvg,


				     unsigned int width,
				     unsigned int height, double minx,
				     double miny, double maxx, double maxy,
				     double x_res, double y_res,
				     unsigned char red_band,
				     unsigned char green_band,
				     unsigned char blue_band,
				     unsigned char **buffer, int *buf_size,
				     rl2PixelPtr bgcolor)
{
/* attempting to return a buffer containing raw pixels from the DBMS Coverage */
    rl2PixelPtr no_data = NULL;
    const char *coverage;
    unsigned char level;
    unsigned char scale;
    double xx_res = x_res;
................................................................................
		   "rl2_get_triple_band_raw_raster_data: Insufficient Memory !!!\n");
	  goto error;
      }

/* preparing the "tiles" SQL query */
    xtiles = sqlite3_mprintf ("%s_tiles", coverage);
    xxtiles = gaiaDoubleQuotedSql (xtiles);









    sql =

	sqlite3_mprintf ("SELECT tile_id, MbrMinX(geometry), MbrMaxY(geometry) "
			 "FROM \"%s\" "
			 "WHERE pyramid_level = ? AND ROWID IN ( "
			 "SELECT ROWID FROM SpatialIndex WHERE f_table_name = %Q "
			 "AND search_frame = BuildMBR(?, ?, ?, ?))", xxtiles,
			 xtiles);











    sqlite3_free (xtiles);
    free (xxtiles);
    ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt_tiles, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
      {
	  printf ("SELECT raw tiles SQL error: %s\n", sqlite3_errmsg (handle));
................................................................................
	sqlite3_finalize (stmt_tiles);
    if (stmt_data != NULL)
	sqlite3_finalize (stmt_data);
    if (bufpix != NULL)
	free (bufpix);
    return RL2_ERROR;
}

static int
get_mono_band_raw_raster_data_common (sqlite3 * handle, rl2CoveragePtr cvg,
				      unsigned int width,
				      unsigned int height, double minx,
				      double miny, double maxx, double maxy,
				      double x_res, double y_res,













































				      unsigned char **buffer, int *buf_size,
				      unsigned char mono_band,
				      rl2PixelPtr bgcolor)
{
/* attempting to return a buffer containing raw pixels from the DBMS Coverage */
    rl2PixelPtr no_data = NULL;
    const char *coverage;
................................................................................
		   "rl2_get_mono_band_raw_raster_data: Insufficient Memory !!!\n");
	  goto error;
      }

/* preparing the "tiles" SQL query */
    xtiles = sqlite3_mprintf ("%s_tiles", coverage);
    xxtiles = gaiaDoubleQuotedSql (xtiles);










    sql =

	sqlite3_mprintf ("SELECT tile_id, MbrMinX(geometry), MbrMaxY(geometry) "
			 "FROM \"%s\" "
			 "WHERE pyramid_level = ? AND ROWID IN ( "
			 "SELECT ROWID FROM SpatialIndex WHERE f_table_name = %Q "
			 "AND search_frame = BuildMBR(?, ?, ?, ?))", xxtiles,
			 xtiles);











    sqlite3_free (xtiles);
    free (xxtiles);
    ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt_tiles, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
      {
	  printf ("SELECT raw tiles SQL error: %s\n", sqlite3_errmsg (handle));
................................................................................
				   double miny, double maxx, double maxy,
				   double x_res, double y_res,
				   unsigned char mono_band,
				   unsigned char **buffer, int *buf_size,
				   rl2PixelPtr no_data)
{
/* attempting to return a buffer containing raw pixels from the DBMS Coverage */
    return get_mono_band_raw_raster_data_common (handle, cvg, width, height,
						 minx, miny, maxx, maxy,
						 x_res, y_res, buffer,
						 buf_size, mono_band, no_data);




















}

RL2_DECLARE int
rl2_get_raw_raster_data_bgcolor (sqlite3 * handle, rl2CoveragePtr cvg,
				 unsigned int width, unsigned int height,
				 double minx, double miny, double maxx,
				 double maxy, double x_res, double y_res,
................................................................................
	    {
		/* RGB RasterSymbolizer: promoting to RGB */
		*out_pixel = RL2_PIXEL_RGB;
	    }
      }
    if (pixel_type == RL2_PIXEL_MONOCHROME)
      {
	  unsigned char red;
	  unsigned char green;
	  unsigned char blue;
	  int ok = 0;
	  if (style != NULL)
	    {
		rl2PrivRasterStylePtr stl = (rl2PrivRasterStylePtr) style;
		if (stl->categorize != NULL)
		  {
		      rl2PrivColorMapPointPtr color = stl->categorize->first;







|



>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
|
|
|
|
|







 







|
|
>
>
|
<
|
|
|
|
|
|
|







 







>
>
>
>
>
>
>
>
>
|
>
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>







 








|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
|
>
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>







 







|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
|
|







745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
...
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
....
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058

4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
....
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
....
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
....
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
....
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
....
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
      }
    sqlite3_free (xcoverage);

/* creating the TILES index by section */
    xcoverage = sqlite3_mprintf ("%s_tiles", coverage);
    xxcoverage = gaiaDoubleQuotedSql (xcoverage);
    sqlite3_free (xcoverage);
    xindex = sqlite3_mprintf ("idx_%s_tiles_sect", coverage);
    xxindex = gaiaDoubleQuotedSql (xindex);
    sqlite3_free (xindex);
    sql =
	sqlite3_mprintf
	("CREATE INDEX \"%s\" ON \"%s\" (section_id, pyramid_level)", xxindex,
	 xxcoverage);
    free (xxcoverage);
    ret = sqlite3_exec (handle, sql, NULL, NULL, &sql_err);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
      {
	  fprintf (stderr, "CREATE INDEX \"%s\" error: %s\n", xxindex, sql_err);
	  sqlite3_free (sql_err);
	  free (xxindex);
	  return 0;
      }
    free (xxindex);

/* creating the TILES index by level */
    xcoverage = sqlite3_mprintf ("%s_tiles", coverage);
    xxcoverage = gaiaDoubleQuotedSql (xcoverage);
    sqlite3_free (xcoverage);
    xindex = sqlite3_mprintf ("idx_%s_tiles_lev", coverage);
    xxindex = gaiaDoubleQuotedSql (xindex);
    sqlite3_free (xindex);
    sql =
	sqlite3_mprintf
	("CREATE INDEX \"%s\" ON \"%s\" (pyramid_level, section_id)", xxindex,
	 xxcoverage);
    free (xxcoverage);
    ret = sqlite3_exec (handle, sql, NULL, NULL, &sql_err);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
      {
	  fprintf (stderr, "CREATE INDEX \"%s\" error: %s\n", xxindex, sql_err);
	  sqlite3_free (sql_err);
................................................................................
    unsigned char scale;
    int ret;
    char *sql;
    char *table;
    char *xtable;
    int count = 0;
    sqlite3_stmt *stmt = NULL;
    double minx = 0.0;
    double miny = 0.0;
    double maxx = 0.0;
    double maxy = 0.0;
    int width = 0;
    int height = 0;

    cvg = rl2_create_coverage_from_dbms (handle, coverage);
    if (cvg == NULL)
	return RL2_ERROR;
    if (rl2_find_matching_resolution
	(handle, cvg, &xx_res, &yy_res, &level, &scale) != RL2_OK)
	return RL2_ERROR;
................................................................................
/* attempting to return a buffer containing raw pixels from the DBMS Coverage/Section */
    return get_raw_raster_data_common (handle, cvg, 1, section_id, width,
				       height, minx, miny, maxx, maxy, x_res,
				       y_res, buffer, buf_size, palette,
				       out_pixel, NULL, NULL, NULL);
}

static int
get_triple_band_raw_raster_data_common (int by_section, sqlite3 * handle,
					rl2CoveragePtr cvg,
					sqlite3_int64 section_id,
					unsigned int width, unsigned int height,

					double minx, double miny, double maxx,
					double maxy, double x_res, double y_res,
					unsigned char red_band,
					unsigned char green_band,
					unsigned char blue_band,
					unsigned char **buffer, int *buf_size,
					rl2PixelPtr bgcolor)
{
/* attempting to return a buffer containing raw pixels from the DBMS Coverage */
    rl2PixelPtr no_data = NULL;
    const char *coverage;
    unsigned char level;
    unsigned char scale;
    double xx_res = x_res;
................................................................................
		   "rl2_get_triple_band_raw_raster_data: Insufficient Memory !!!\n");
	  goto error;
      }

/* preparing the "tiles" SQL query */
    xtiles = sqlite3_mprintf ("%s_tiles", coverage);
    xxtiles = gaiaDoubleQuotedSql (xtiles);
    if (by_section)
      {
	  /* only from a single Section */
	  char sctn[1024];
#if defined(_WIN32) && !defined(__MINGW32__)
	  sprintf (sctn, "%I64d", section_id);
#else
	  sprintf (sctn, "%lld", section_id);
#endif
	  sql =
	      sqlite3_mprintf
	      ("SELECT tile_id, MbrMinX(geometry), MbrMaxY(geometry) "
	       "FROM \"%s\" "
	       "WHERE section_id = %s AND pyramid_level = ? AND ROWID IN ( "
	       "SELECT ROWID FROM SpatialIndex WHERE f_table_name = %Q "
	       "AND search_frame = BuildMBR(?, ?, ?, ?))", xxtiles, sctn,
	       xtiles);
      }
    else
      {
	  /* whole Coverage */
	  sql =
	      sqlite3_mprintf
	      ("SELECT tile_id, MbrMinX(geometry), MbrMaxY(geometry) "
	       "FROM \"%s\" " "WHERE pyramid_level = ? AND ROWID IN ( "
	       "SELECT ROWID FROM SpatialIndex WHERE f_table_name = %Q "
	       "AND search_frame = BuildMBR(?, ?, ?, ?))", xxtiles, xtiles);
      }
    sqlite3_free (xtiles);
    free (xxtiles);
    ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt_tiles, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
      {
	  printf ("SELECT raw tiles SQL error: %s\n", sqlite3_errmsg (handle));
................................................................................
	sqlite3_finalize (stmt_tiles);
    if (stmt_data != NULL)
	sqlite3_finalize (stmt_data);
    if (bufpix != NULL)
	free (bufpix);
    return RL2_ERROR;
}

RL2_DECLARE int
rl2_get_triple_band_raw_raster_data (sqlite3 * handle, rl2CoveragePtr cvg,
				     unsigned int width,
				     unsigned int height, double minx,
				     double miny, double maxx, double maxy,
				     double x_res, double y_res,
				     unsigned char red_band,
				     unsigned char green_band,
				     unsigned char blue_band,
				     unsigned char **buffer, int *buf_size,
				     rl2PixelPtr bgcolor)
{
/* attempting to return a buffer containing raw pixels from the DBMS Coverage */
    return get_triple_band_raw_raster_data_common (0, handle, cvg, 0, width,
						   height, minx, miny, maxx,
						   maxy, x_res, y_res, red_band,
						   green_band, blue_band,
						   buffer, buf_size, bgcolor);
}

RL2_DECLARE int
rl2_get_section_triple_band_raw_raster_data (sqlite3 * handle,
					     rl2CoveragePtr cvg,
					     sqlite3_int64 section_id,
					     unsigned int width,
					     unsigned int height, double minx,
					     double miny, double maxx,
					     double maxy, double x_res,
					     double y_res,
					     unsigned char red_band,
					     unsigned char green_band,
					     unsigned char blue_band,
					     unsigned char **buffer,
					     int *buf_size, rl2PixelPtr bgcolor)
{
/* attempting to return a buffer containing raw pixels - Section */
    return get_triple_band_raw_raster_data_common (1, handle, cvg, section_id,
						   width, height, minx, miny,
						   maxx, maxy, x_res, y_res,
						   red_band, green_band,
						   blue_band, buffer, buf_size,
						   bgcolor);
}

static int
get_mono_band_raw_raster_data_common (int by_section, sqlite3 * handle,
				      rl2CoveragePtr cvg,
				      sqlite3_int64 section_id,
				      unsigned int width, unsigned int height,
				      double minx, double miny, double maxx,
				      double maxy, double x_res, double y_res,
				      unsigned char **buffer, int *buf_size,
				      unsigned char mono_band,
				      rl2PixelPtr bgcolor)
{
/* attempting to return a buffer containing raw pixels from the DBMS Coverage */
    rl2PixelPtr no_data = NULL;
    const char *coverage;
................................................................................
		   "rl2_get_mono_band_raw_raster_data: Insufficient Memory !!!\n");
	  goto error;
      }

/* preparing the "tiles" SQL query */
    xtiles = sqlite3_mprintf ("%s_tiles", coverage);
    xxtiles = gaiaDoubleQuotedSql (xtiles);

    if (by_section)
      {
	  /* single Section */
	  char sctn[1024];
#if defined(_WIN32) && !defined(__MINGW32__)
	  sprintf (sctn, "%I64d", section_id);
#else
	  sprintf (sctn, "%lld", section_id);
#endif
	  sql =
	      sqlite3_mprintf
	      ("SELECT tile_id, MbrMinX(geometry), MbrMaxY(geometry) "
	       "FROM \"%s\" "
	       "WHERE section_id = %s AND pyramid_level = ? AND ROWID IN ( "
	       "SELECT ROWID FROM SpatialIndex WHERE f_table_name = %Q "
	       "AND search_frame = BuildMBR(?, ?, ?, ?))", xxtiles, sctn,
	       xtiles);
      }
    else
      {
	  /* whole Coverage */
	  sql =
	      sqlite3_mprintf
	      ("SELECT tile_id, MbrMinX(geometry), MbrMaxY(geometry) "
	       "FROM \"%s\" " "WHERE pyramid_level = ? AND ROWID IN ( "
	       "SELECT ROWID FROM SpatialIndex WHERE f_table_name = %Q "
	       "AND search_frame = BuildMBR(?, ?, ?, ?))", xxtiles, xtiles);
      }
    sqlite3_free (xtiles);
    free (xxtiles);
    ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt_tiles, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
      {
	  printf ("SELECT raw tiles SQL error: %s\n", sqlite3_errmsg (handle));
................................................................................
				   double miny, double maxx, double maxy,
				   double x_res, double y_res,
				   unsigned char mono_band,
				   unsigned char **buffer, int *buf_size,
				   rl2PixelPtr no_data)
{
/* attempting to return a buffer containing raw pixels from the DBMS Coverage */
    return get_mono_band_raw_raster_data_common (0, handle, cvg, 0, width,
						 height, minx, miny, maxx, maxy,
						 x_res, y_res, buffer, buf_size,
						 mono_band, no_data);
}

RL2_DECLARE int
rl2_get_section_mono_band_raw_raster_data (sqlite3 * handle, rl2CoveragePtr cvg,
					   sqlite3_int64 section_id,
					   unsigned int width,
					   unsigned int height, double minx,
					   double miny, double maxx,
					   double maxy, double x_res,
					   double y_res,
					   unsigned char mono_band,
					   unsigned char **buffer,
					   int *buf_size, rl2PixelPtr no_data)
{
/* attempting to return a buffer containing raw pixels from the DBMS Coverage */
    return get_mono_band_raw_raster_data_common (1, handle, cvg, section_id,
						 width, height, minx, miny,
						 maxx, maxy, x_res, y_res,
						 buffer, buf_size, mono_band,
						 no_data);
}

RL2_DECLARE int
rl2_get_raw_raster_data_bgcolor (sqlite3 * handle, rl2CoveragePtr cvg,
				 unsigned int width, unsigned int height,
				 double minx, double miny, double maxx,
				 double maxy, double x_res, double y_res,
................................................................................
	    {
		/* RGB RasterSymbolizer: promoting to RGB */
		*out_pixel = RL2_PIXEL_RGB;
	    }
      }
    if (pixel_type == RL2_PIXEL_MONOCHROME)
      {
	  unsigned char red = 0;
	  unsigned char green = 0;
	  unsigned char blue = 0;
	  int ok = 0;
	  if (style != NULL)
	    {
		rl2PrivRasterStylePtr stl = (rl2PrivRasterStylePtr) style;
		if (stl->categorize != NULL)
		  {
		      rl2PrivColorMapPointPtr color = stl->categorize->first;

Changes to src/rl2import.c.

666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
....
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
....
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
....
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
....
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
....
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
....
2706
2707
2708
2709
2710
2711
2712












2713
2714
2715
2716
2717

2718
2719
2720
2721
2722
2723
2724
....
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797


2798
2799
2800
2801
2802














































2803
2804
2805
2806
2807
2808
2809
....
2838
2839
2840
2841
2842
2843
2844












2845
2846
2847
2848

2849
2850
2851
2852
2853
2854
2855
....
2919
2920
2921
2922
2923
2924
2925
2926
2927





















2928

2929
2930
2931
2932
2933






















2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
....
2981
2982
2983
2984
2985
2986
2987












2988
2989
2990
2991
2992

2993
2994
2995
2996
2997
2998
2999
....
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069























































3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
....
3110
3111
3112
3113
3114
3115
3116












3117
3118
3119
3120

3121
3122
3123
3124
3125
3126
3127
....
3188
3189
3190
3191
3192
3193
3194

3195
3196

3197
3198
3199
3200
3201






















3202
3203
3204
3205
3206



















3207
3208
3209
3210
3211
3212
3213
3214
....
3248
3249
3250
3251
3252
3253
3254












3255
3256
3257
3258
3259

3260
3261
3262
3263
3264
3265
3266
....
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329


3330
3331
3332
3333







































3334
3335
3336
3337
3338
3339
3340
....
3369
3370
3371
3372
3373
3374
3375












3376
3377
3378
3379

3380
3381
3382
3383
3384
3385
3386
....
3439
3440
3441
3442
3443
3444
3445







































3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
....
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
....
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
		      unsigned char num_bands, unsigned char compression,
		      sqlite3_stmt * stmt_data, sqlite3_stmt * stmt_tils,
		      sqlite3_stmt * stmt_sect, sqlite3_stmt * stmt_levl,
		      sqlite3_stmt * stmt_upd_sect, int verbose, int current,
		      int total)
{
/* importing a JPEG image file [with optional WorldFile */
    rl2SectionPtr origin;
    rl2RasterPtr rst_in;
    rl2PrivRasterPtr raster_in;
    rl2RasterPtr raster = NULL;
    rl2RasterStatisticsPtr section_stats = NULL;
    rl2PixelPtr no_data = NULL;
    unsigned int row;
    unsigned int col;
................................................................................
		       rl2CoveragePtr cvg, int by_section,
		       sqlite3_int64 section_id, double x_res, double y_res,
		       double minx, double miny, double maxx, double maxy,
		       unsigned int width, unsigned int height,
		       unsigned char compression, unsigned int tile_sz,
		       int with_worldfile)
{
/* exporting a GeoTIFF from the DBMS into the file-system */
    rl2RasterPtr raster = NULL;
    rl2PalettePtr palette = NULL;
    rl2PalettePtr plt2 = NULL;
    rl2TiffDestinationPtr tiff = NULL;
    rl2PixelPtr no_data = NULL;
    unsigned char level;
    unsigned char scale;
................................................................................
				      sqlite3_int64 section_id, double x_res,
				      double y_res, double minx, double miny,
				      double maxx, double maxy,
				      unsigned int width, unsigned int height,
				      unsigned char compression,
				      unsigned int tile_sz, int with_worldfile)
{
/* exporting a GeoTIFF from the DBMS into the file-system - Section*/
    return export_geotiff_common (handle, dst_path, cvg, 1, section_id, x_res,
				  y_res, minx, miny, maxx, maxy, width, height,
				  compression, tile_sz, with_worldfile);
}

static int
export_tiff_worlfile_common (sqlite3 * handle, const char *dst_path,
................................................................................
			     rl2CoveragePtr cvg, int by_section,
			     sqlite3_int64 section_id, double x_res,
			     double y_res, double minx, double miny,
			     double maxx, double maxy, unsigned int width,
			     unsigned int height, unsigned char compression,
			     unsigned int tile_sz)
{
/* exporting a TIFF+TFW from the DBMS into the file-system */
    rl2RasterPtr raster = NULL;
    rl2PalettePtr palette = NULL;
    rl2PalettePtr plt2 = NULL;
    rl2PixelPtr no_data = NULL;
    rl2TiffDestinationPtr tiff = NULL;
    unsigned char level;
    unsigned char scale;
................................................................................
					     double minx, double miny,
					     double maxx, double maxy,
					     unsigned int width,
					     unsigned int height,
					     unsigned char compression,
					     unsigned int tile_sz)
{
/* exporting a TIFF+TFW from the DBMS into the file-system / single Section */
    return export_tiff_worlfile_common (handle, dst_path, cvg, 1, section_id,
					x_res, y_res, minx, miny, maxx, maxy,
					width, height, compression, tile_sz);
}

static int
export_tiff_common (sqlite3 * handle, const char *dst_path,
		    rl2CoveragePtr cvg, int by_section,
		    sqlite3_int64 section_id, double x_res, double y_res,
		    double minx, double miny, double maxx, double maxy,
		    unsigned int width, unsigned int height,
		    unsigned char compression, unsigned int tile_sz)
{
/* exporting a plain TIFF from the DBMS into the file-system */
    rl2RasterPtr raster = NULL;
    rl2PalettePtr palette = NULL;
    rl2PalettePtr plt2 = NULL;
    rl2PixelPtr no_data = NULL;
    rl2TiffDestinationPtr tiff = NULL;
    unsigned char level;
    unsigned char scale;
................................................................................
				   rl2CoveragePtr cvg, sqlite3_int64 section_id,
				   double x_res, double y_res, double minx,
				   double miny, double maxx, double maxy,
				   unsigned int width, unsigned int height,
				   unsigned char compression,
				   unsigned int tile_sz)
{
/* exporting a plain TIFF from the DBMS into the file-system - single Section*/
    return export_tiff_common (handle, dst_path, cvg, 1, section_id, x_res,
			       y_res, minx, miny, maxx, maxy, width, height,
			       compression, tile_sz);
}

RL2_DECLARE int
rl2_export_triple_band_geotiff_from_dbms (sqlite3 * handle,
					  const char *dst_path,
					  rl2CoveragePtr cvg, double x_res,
					  double y_res, double minx,
					  double miny, double maxx,
					  double maxy, unsigned int width,
					  unsigned int height,
					  unsigned char red_band,
					  unsigned char green_band,
					  unsigned char blue_band,
					  unsigned char compression,
					  unsigned int tile_sz,
					  int with_worldfile)
{
/* exporting a Band-Composed GeoTIFF from the DBMS into the file-system */
    rl2RasterPtr raster = NULL;
    rl2TiffDestinationPtr tiff = NULL;
    rl2PixelPtr no_data_multi = NULL;
    rl2PixelPtr no_data = NULL;
    unsigned char level;
    unsigned char scale;
    double xx_res = x_res;
................................................................................
    if (rl2_get_coverage_srid (cvg, &srid) != RL2_OK)
	goto error;
    no_data_multi = rl2_get_coverage_no_data (cvg);
    no_data =
	rl2_create_triple_band_pixel (no_data_multi, red_band, green_band,
				      blue_band);













    if (rl2_get_triple_band_raw_raster_data
	(handle, cvg, width, height, minx, miny, maxx, maxy, xx_res,
	 yy_res, red_band, green_band, blue_band, &outbuf, &outbuf_size,
	 no_data) != RL2_OK)
	goto error;


    tiff =
	rl2_create_geotiff_destination (dst_path, handle, width, height,
					sample_type, RL2_PIXEL_RGB, 3,
					NULL, compression, 1, tile_sz, srid,
					minx, miny, maxx, maxy, xx_res, yy_res,
					with_worldfile);
................................................................................
	free (bufpix);
    if (no_data != NULL)
	rl2_destroy_pixel (no_data);
    return RL2_ERROR;
}

RL2_DECLARE int
rl2_export_mono_band_geotiff_from_dbms (sqlite3 * handle,
					const char *dst_path,
					rl2CoveragePtr cvg, double x_res,
					double y_res, double minx,
					double miny, double maxx,
					double maxy, unsigned int width,
					unsigned int height,
					unsigned char mono_band,


					unsigned char compression,
					unsigned int tile_sz,
					int with_worldfile)
{
/* exporting a Mono-Band GeoTIFF from the DBMS into the file-system */














































    rl2RasterPtr raster = NULL;
    rl2TiffDestinationPtr tiff = NULL;
    rl2PixelPtr no_data_mono = NULL;
    rl2PixelPtr no_data = NULL;
    unsigned char level;
    unsigned char scale;
    double xx_res = x_res;
................................................................................
    if (mono_band >= num_bands)
	goto error;
    if (rl2_get_coverage_srid (cvg, &srid) != RL2_OK)
	goto error;
    no_data_mono = rl2_get_coverage_no_data (cvg);
    no_data = rl2_create_mono_band_pixel (no_data_mono, mono_band);













    if (rl2_get_mono_band_raw_raster_data
	(handle, cvg, width, height, minx, miny, maxx, maxy, xx_res,
	 yy_res, mono_band, &outbuf, &outbuf_size, no_data) != RL2_OK)
	goto error;


    if (sample_type == RL2_SAMPLE_UINT16)
	out_pixel = RL2_PIXEL_DATAGRID;
    else
	out_pixel = RL2_PIXEL_GRAYSCALE;

    tiff =
................................................................................
	free (bufpix);
    if (no_data != NULL)
	rl2_destroy_pixel (no_data);
    return RL2_ERROR;
}

RL2_DECLARE int
rl2_export_triple_band_tiff_worldfile_from_dbms (sqlite3 * handle,
						 const char *dst_path,





















						 rl2CoveragePtr cvg,

						 double x_res, double y_res,
						 double minx, double miny,
						 double maxx, double maxy,
						 unsigned int width,
						 unsigned int height,






















						 unsigned char red_band,
						 unsigned char green_band,
						 unsigned char blue_band,
						 unsigned char compression,
						 unsigned int tile_sz)
{
/* exporting a Band-Composed TIFF+TFW from the DBMS into the file-system */
    rl2RasterPtr raster = NULL;
    rl2PixelPtr no_data_multi = NULL;
    rl2PixelPtr no_data = NULL;
    rl2TiffDestinationPtr tiff = NULL;
    unsigned char level;
    unsigned char scale;
    double xx_res = x_res;
................................................................................
    if (rl2_get_coverage_srid (cvg, &srid) != RL2_OK)
	goto error;
    no_data_multi = rl2_get_coverage_no_data (cvg);
    no_data =
	rl2_create_triple_band_pixel (no_data_multi, red_band, green_band,
				      blue_band);













    if (rl2_get_triple_band_raw_raster_data
	(handle, cvg, width, height, minx, miny, maxx, maxy, xx_res,
	 yy_res, red_band, green_band, blue_band, &outbuf, &outbuf_size,
	 no_data) != RL2_OK)
	goto error;


    tiff =
	rl2_create_tiff_worldfile_destination (dst_path, width, height,
					       sample_type, RL2_PIXEL_RGB,
					       3, NULL, compression, 1, tile_sz,
					       srid, minx, miny, maxx, maxy,
					       xx_res, yy_res);
................................................................................
	free (bufpix);
    if (no_data != NULL)
	rl2_destroy_pixel (no_data);
    return RL2_ERROR;
}

RL2_DECLARE int
rl2_export_mono_band_tiff_worldfile_from_dbms (sqlite3 * handle,
					       const char *dst_path,
					       rl2CoveragePtr cvg,
					       double x_res, double y_res,
					       double minx, double miny,
					       double maxx, double maxy,
					       unsigned int width,
					       unsigned int height,























































					       unsigned char mono_band,
					       unsigned char compression,
					       unsigned int tile_sz)
{
/* exporting a Mono-Band TIFF+TFW from the DBMS into the file-system */
    rl2RasterPtr raster = NULL;
    rl2PixelPtr no_data_multi = NULL;
    rl2PixelPtr no_data = NULL;
    rl2TiffDestinationPtr tiff = NULL;
    unsigned char level;
    unsigned char scale;
    double xx_res = x_res;
................................................................................
    if (mono_band >= num_bands)
	goto error;
    if (rl2_get_coverage_srid (cvg, &srid) != RL2_OK)
	goto error;
    no_data_multi = rl2_get_coverage_no_data (cvg);
    no_data = rl2_create_mono_band_pixel (no_data_multi, mono_band);













    if (rl2_get_mono_band_raw_raster_data
	(handle, cvg, width, height, minx, miny, maxx, maxy, xx_res,
	 yy_res, mono_band, &outbuf, &outbuf_size, no_data) != RL2_OK)
	goto error;


    if (sample_type == RL2_SAMPLE_UINT16)
	out_pixel = RL2_PIXEL_DATAGRID;
    else
	out_pixel = RL2_PIXEL_GRAYSCALE;

    tiff =
................................................................................
	free (bufpix);
    if (no_data != NULL)
	rl2_destroy_pixel (no_data);
    return RL2_ERROR;
}

RL2_DECLARE int

rl2_export_triple_band_tiff_from_dbms (sqlite3 * handle, const char *dst_path,
				       rl2CoveragePtr cvg, double x_res,

				       double y_res, double minx, double miny,
				       double maxx, double maxy,
				       unsigned int width,
				       unsigned int height,
				       unsigned char red_band,






















				       unsigned char green_band,
				       unsigned char blue_band,
				       unsigned char compression,
				       unsigned int tile_sz)
{



















/* exporting a plain Band-Composed TIFF from the DBMS into the file-system */
    rl2RasterPtr raster = NULL;
    rl2PixelPtr no_data_multi = NULL;
    rl2PixelPtr no_data = NULL;
    rl2TiffDestinationPtr tiff = NULL;
    unsigned char level;
    unsigned char scale;
    double xx_res = x_res;
................................................................................
    if (rl2_get_coverage_srid (cvg, &srid) != RL2_OK)
	goto error;
    no_data_multi = rl2_get_coverage_no_data (cvg);
    no_data =
	rl2_create_triple_band_pixel (no_data_multi, red_band, green_band,
				      blue_band);













    if (rl2_get_triple_band_raw_raster_data
	(handle, cvg, width, height, minx, miny, maxx, maxy, xx_res,
	 yy_res, red_band, green_band, blue_band, &outbuf, &outbuf_size,
	 no_data) != RL2_OK)
	goto error;


    tiff =
	rl2_create_tiff_destination (dst_path, width, height, sample_type,
				     RL2_PIXEL_RGB, 3, NULL,
				     compression, 1, tile_sz);
    if (tiff == NULL)
	goto error;
................................................................................
	free (bufpix);
    if (no_data != NULL)
	rl2_destroy_pixel (no_data);
    return RL2_ERROR;
}

RL2_DECLARE int
rl2_export_mono_band_tiff_from_dbms (sqlite3 * handle, const char *dst_path,
				     rl2CoveragePtr cvg, double x_res,
				     double y_res, double minx, double miny,
				     double maxx, double maxy,
				     unsigned int width,
				     unsigned int height,
				     unsigned char mono_band,


				     unsigned char compression,
				     unsigned int tile_sz)
{
/* exporting a plain Mono-Band TIFF from the DBMS into the file-system */







































    rl2RasterPtr raster = NULL;
    rl2PixelPtr no_data_multi = NULL;
    rl2PixelPtr no_data = NULL;
    rl2TiffDestinationPtr tiff = NULL;
    unsigned char level;
    unsigned char scale;
    double xx_res = x_res;
................................................................................
    if (mono_band >= num_bands)
	goto error;
    if (rl2_get_coverage_srid (cvg, &srid) != RL2_OK)
	goto error;
    no_data_multi = rl2_get_coverage_no_data (cvg);
    no_data = rl2_create_mono_band_pixel (no_data_multi, mono_band);













    if (rl2_get_mono_band_raw_raster_data
	(handle, cvg, width, height, minx, miny, maxx, maxy, xx_res,
	 yy_res, mono_band, &outbuf, &outbuf_size, no_data) != RL2_OK)
	goto error;


    if (sample_type == RL2_SAMPLE_UINT16)
	out_pixel = RL2_PIXEL_DATAGRID;
    else
	out_pixel = RL2_PIXEL_GRAYSCALE;

    tiff =
................................................................................
	free (outbuf);
    if (bufpix != NULL)
	free (bufpix);
    if (no_data != NULL)
	rl2_destroy_pixel (no_data);
    return RL2_ERROR;
}








































static int
export_ascii_grid_common (int by_section, sqlite3 * handle,
			  const char *dst_path, rl2CoveragePtr cvg,
			  sqlite3_int64 section_id, double res, double minx,
			  double miny, double maxx, double maxy,
			  unsigned int width, unsigned int height,
			  int is_centered, int decimal_digits)
{
/* exporting an ASCII Grid from the DBMS into the file-system */
    rl2PalettePtr palette = NULL;
    rl2AsciiGridDestinationPtr ascii = NULL;
    rl2PixelPtr pixel;
    unsigned char level;
    unsigned char scale;
    double xx_res = res;
    double yy_res = res;
................................................................................
					 rl2CoveragePtr cvg,
					 sqlite3_int64 section_id, double res,
					 double minx, double miny, double maxx,
					 double maxy, unsigned int width,
					 unsigned int height, int is_centered,
					 int decimal_digits)
{
/* exporting an ASCII Grid from the DBMS- Section */
    return export_ascii_grid_common (1, handle, dst_path, cvg, section_id, res,
				     minx, miny, maxx, maxy, width, height,
				     is_centered, decimal_digits);
}

static int
export_jpeg_common (int by_section, sqlite3 * handle, const char *dst_path,
................................................................................
rl2_export_section_jpeg_from_dbms (sqlite3 * handle, const char *dst_path,
				   rl2CoveragePtr cvg, sqlite3_int64 section_id,
				   double x_res, double y_res, double minx,
				   double miny, double maxx, double maxy,
				   unsigned int width, unsigned int height,
				   int quality, int with_worldfile)
{
/* exporting a JPEG (with possible JGW) from the DBMS - Section */
    return export_jpeg_common (1, handle, dst_path, cvg, section_id, x_res,
			       y_res, minx, miny, maxx, maxy, width, height,
			       quality, with_worldfile);
}







|







 







|







 







|







 







|







 







|













|







 







|





|
|
|
|
|
|
<
|
|
|
|
|
|
<

|







 







>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
>







 







|
|
|
|
|
|
|
|
>
>
|
|
|

|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
>







 







|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|

|







 







>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
>







 







|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|

|







 







>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
>







 







>
|
|
>
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|







 







>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
>







 







|
|
|
|
|
|
|
>
>
|
|

|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>









|







 







|







 







|




666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
....
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
....
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
....
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
....
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
....
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655

2656
2657
2658
2659
2660
2661

2662
2663
2664
2665
2666
2667
2668
2669
2670
....
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
....
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
....
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
....
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
....
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
....
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
....
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
....
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
....
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
....
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
....
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
....
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
....
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
....
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
		      unsigned char num_bands, unsigned char compression,
		      sqlite3_stmt * stmt_data, sqlite3_stmt * stmt_tils,
		      sqlite3_stmt * stmt_sect, sqlite3_stmt * stmt_levl,
		      sqlite3_stmt * stmt_upd_sect, int verbose, int current,
		      int total)
{
/* importing a JPEG image file [with optional WorldFile */
    rl2SectionPtr origin = NULL;
    rl2RasterPtr rst_in;
    rl2PrivRasterPtr raster_in;
    rl2RasterPtr raster = NULL;
    rl2RasterStatisticsPtr section_stats = NULL;
    rl2PixelPtr no_data = NULL;
    unsigned int row;
    unsigned int col;
................................................................................
		       rl2CoveragePtr cvg, int by_section,
		       sqlite3_int64 section_id, double x_res, double y_res,
		       double minx, double miny, double maxx, double maxy,
		       unsigned int width, unsigned int height,
		       unsigned char compression, unsigned int tile_sz,
		       int with_worldfile)
{
/* exporting a GeoTIFF common implementation */
    rl2RasterPtr raster = NULL;
    rl2PalettePtr palette = NULL;
    rl2PalettePtr plt2 = NULL;
    rl2TiffDestinationPtr tiff = NULL;
    rl2PixelPtr no_data = NULL;
    unsigned char level;
    unsigned char scale;
................................................................................
				      sqlite3_int64 section_id, double x_res,
				      double y_res, double minx, double miny,
				      double maxx, double maxy,
				      unsigned int width, unsigned int height,
				      unsigned char compression,
				      unsigned int tile_sz, int with_worldfile)
{
/* exporting a GeoTIFF - Section*/
    return export_geotiff_common (handle, dst_path, cvg, 1, section_id, x_res,
				  y_res, minx, miny, maxx, maxy, width, height,
				  compression, tile_sz, with_worldfile);
}

static int
export_tiff_worlfile_common (sqlite3 * handle, const char *dst_path,
................................................................................
			     rl2CoveragePtr cvg, int by_section,
			     sqlite3_int64 section_id, double x_res,
			     double y_res, double minx, double miny,
			     double maxx, double maxy, unsigned int width,
			     unsigned int height, unsigned char compression,
			     unsigned int tile_sz)
{
/* exporting a TIFF+TFW common implementation */
    rl2RasterPtr raster = NULL;
    rl2PalettePtr palette = NULL;
    rl2PalettePtr plt2 = NULL;
    rl2PixelPtr no_data = NULL;
    rl2TiffDestinationPtr tiff = NULL;
    unsigned char level;
    unsigned char scale;
................................................................................
					     double minx, double miny,
					     double maxx, double maxy,
					     unsigned int width,
					     unsigned int height,
					     unsigned char compression,
					     unsigned int tile_sz)
{
/* exporting a TIFF+TFW - single Section */
    return export_tiff_worlfile_common (handle, dst_path, cvg, 1, section_id,
					x_res, y_res, minx, miny, maxx, maxy,
					width, height, compression, tile_sz);
}

static int
export_tiff_common (sqlite3 * handle, const char *dst_path,
		    rl2CoveragePtr cvg, int by_section,
		    sqlite3_int64 section_id, double x_res, double y_res,
		    double minx, double miny, double maxx, double maxy,
		    unsigned int width, unsigned int height,
		    unsigned char compression, unsigned int tile_sz)
{
/* exporting a plain TIFF common implementation */
    rl2RasterPtr raster = NULL;
    rl2PalettePtr palette = NULL;
    rl2PalettePtr plt2 = NULL;
    rl2PixelPtr no_data = NULL;
    rl2TiffDestinationPtr tiff = NULL;
    unsigned char level;
    unsigned char scale;
................................................................................
				   rl2CoveragePtr cvg, sqlite3_int64 section_id,
				   double x_res, double y_res, double minx,
				   double miny, double maxx, double maxy,
				   unsigned int width, unsigned int height,
				   unsigned char compression,
				   unsigned int tile_sz)
{
/* exporting a plain TIFF - single Section*/
    return export_tiff_common (handle, dst_path, cvg, 1, section_id, x_res,
			       y_res, minx, miny, maxx, maxy, width, height,
			       compression, tile_sz);
}

static int
export_triple_band_geotiff_common (int by_section, sqlite3 * handle,
				   const char *dst_path,
				   rl2CoveragePtr cvg, sqlite3_int64 section_id,
				   double x_res, double y_res, double minx,
				   double miny, double maxx, double maxy,

				   unsigned int width, unsigned int height,
				   unsigned char red_band,
				   unsigned char green_band,
				   unsigned char blue_band,
				   unsigned char compression,
				   unsigned int tile_sz, int with_worldfile)

{
/* exporting a Band-Composed GeoTIFF - common implementation */
    rl2RasterPtr raster = NULL;
    rl2TiffDestinationPtr tiff = NULL;
    rl2PixelPtr no_data_multi = NULL;
    rl2PixelPtr no_data = NULL;
    unsigned char level;
    unsigned char scale;
    double xx_res = x_res;
................................................................................
    if (rl2_get_coverage_srid (cvg, &srid) != RL2_OK)
	goto error;
    no_data_multi = rl2_get_coverage_no_data (cvg);
    no_data =
	rl2_create_triple_band_pixel (no_data_multi, red_band, green_band,
				      blue_band);

    if (by_section)
      {
	  /* single Section */
	  if (rl2_get_section_triple_band_raw_raster_data
	      (handle, cvg, section_id, width, height, minx, miny, maxx, maxy,
	       xx_res, yy_res, red_band, green_band, blue_band, &outbuf,
	       &outbuf_size, no_data) != RL2_OK)
	      goto error;
      }
    else
      {
	  /* whole Coverage */
	  if (rl2_get_triple_band_raw_raster_data
	      (handle, cvg, width, height, minx, miny, maxx, maxy, xx_res,
	       yy_res, red_band, green_band, blue_band, &outbuf, &outbuf_size,
	       no_data) != RL2_OK)
	      goto error;
      }

    tiff =
	rl2_create_geotiff_destination (dst_path, handle, width, height,
					sample_type, RL2_PIXEL_RGB, 3,
					NULL, compression, 1, tile_sz, srid,
					minx, miny, maxx, maxy, xx_res, yy_res,
					with_worldfile);
................................................................................
	free (bufpix);
    if (no_data != NULL)
	rl2_destroy_pixel (no_data);
    return RL2_ERROR;
}

RL2_DECLARE int
rl2_export_triple_band_geotiff_from_dbms (sqlite3 * handle,
					  const char *dst_path,
					  rl2CoveragePtr cvg, double x_res,
					  double y_res, double minx,
					  double miny, double maxx,
					  double maxy, unsigned int width,
					  unsigned int height,
					  unsigned char red_band,
					  unsigned char green_band,
					  unsigned char blue_band,
					  unsigned char compression,
					  unsigned int tile_sz,
					  int with_worldfile)
{
/* exporting a Band-Composed GeoTIFF from the DBMS into the file-system */
    return export_triple_band_geotiff_common (0, handle, dst_path, cvg, 0,
					      x_res, y_res, minx, miny, maxx,
					      maxy, width, height, red_band,
					      green_band, blue_band,
					      compression, tile_sz,
					      with_worldfile);
}

RL2_DECLARE int
rl2_export_section_triple_band_geotiff_from_dbms (sqlite3 * handle,
						  const char *dst_path,
						  rl2CoveragePtr cvg,
						  sqlite3_int64 section_id,
						  double x_res, double y_res,
						  double minx, double miny,
						  double maxx, double maxy,
						  unsigned int width,
						  unsigned int height,
						  unsigned char red_band,
						  unsigned char green_band,
						  unsigned char blue_band,
						  unsigned char compression,
						  unsigned int tile_sz,
						  int with_worldfile)
{
/* exporting a Band-Composed GeoTIFF - Section */
    return export_triple_band_geotiff_common (1, handle, dst_path, cvg,
					      section_id, x_res, y_res, minx,
					      miny, maxx, maxy, width, height,
					      red_band, green_band, blue_band,
					      compression, tile_sz,
					      with_worldfile);
}

static int
export_mono_band_geotiff_common (int by_section, sqlite3 * handle,
				 const char *dst_path,
				 rl2CoveragePtr cvg, sqlite3_int64 section_id,
				 double x_res, double y_res, double minx,
				 double miny, double maxx, double maxy,
				 unsigned int width, unsigned int height,
				 unsigned char mono_band,
				 unsigned char compression,
				 unsigned int tile_sz, int with_worldfile)
{
/* exporting a Mono-Band GeoTIFF common implementation */
    rl2RasterPtr raster = NULL;
    rl2TiffDestinationPtr tiff = NULL;
    rl2PixelPtr no_data_mono = NULL;
    rl2PixelPtr no_data = NULL;
    unsigned char level;
    unsigned char scale;
    double xx_res = x_res;
................................................................................
    if (mono_band >= num_bands)
	goto error;
    if (rl2_get_coverage_srid (cvg, &srid) != RL2_OK)
	goto error;
    no_data_mono = rl2_get_coverage_no_data (cvg);
    no_data = rl2_create_mono_band_pixel (no_data_mono, mono_band);

    if (by_section)
      {
	  /* single Section */
	  if (rl2_get_section_mono_band_raw_raster_data
	      (handle, cvg, section_id, width, height, minx, miny, maxx, maxy,
	       xx_res, yy_res, mono_band, &outbuf, &outbuf_size,
	       no_data) != RL2_OK)
	      goto error;
      }
    else
      {
	  /* whole Coverage */
	  if (rl2_get_mono_band_raw_raster_data
	      (handle, cvg, width, height, minx, miny, maxx, maxy, xx_res,
	       yy_res, mono_band, &outbuf, &outbuf_size, no_data) != RL2_OK)
	      goto error;
      }

    if (sample_type == RL2_SAMPLE_UINT16)
	out_pixel = RL2_PIXEL_DATAGRID;
    else
	out_pixel = RL2_PIXEL_GRAYSCALE;

    tiff =
................................................................................
	free (bufpix);
    if (no_data != NULL)
	rl2_destroy_pixel (no_data);
    return RL2_ERROR;
}

RL2_DECLARE int
rl2_export_mono_band_geotiff_from_dbms (sqlite3 * handle,
					const char *dst_path,
					rl2CoveragePtr cvg, double x_res,
					double y_res, double minx,
					double miny, double maxx,
					double maxy, unsigned int width,
					unsigned int height,
					unsigned char mono_band,
					unsigned char compression,
					unsigned int tile_sz,
					int with_worldfile)
{
/* exporting a Mono-Band GeoTIFF from the DBMS into the file-system */
    return export_mono_band_geotiff_common (0, handle, dst_path, cvg, 0, x_res,
					    y_res, minx, miny, maxx, maxy,
					    width, height, mono_band,
					    compression, tile_sz,
					    with_worldfile);
}

RL2_DECLARE int
rl2_export_section_mono_band_geotiff_from_dbms (sqlite3 * handle,
						const char *dst_path,
						rl2CoveragePtr cvg,
						sqlite3_int64 section_id,
						double x_res, double y_res,
						double minx, double miny,
						double maxx, double maxy,
						unsigned int width,
						unsigned int height,
						unsigned char mono_band,
						unsigned char compression,
						unsigned int tile_sz,
						int with_worldfile)
{
/* exporting a Mono-Band GeoTIFF - Section */
    return export_mono_band_geotiff_common (1, handle, dst_path, cvg,
					    section_id, x_res, y_res, minx,
					    miny, maxx, maxy, width, height,
					    mono_band, compression, tile_sz,
					    with_worldfile);
}

static int
export_triple_band_tiff_worldfile_common (int by_section, sqlite3 * handle,
					  const char *dst_path,
					  rl2CoveragePtr cvg,
					  sqlite3_int64 section_id,
					  double x_res, double y_res,
					  double minx, double miny, double maxx,
					  double maxy, unsigned int width,
					  unsigned int height,
					  unsigned char red_band,
					  unsigned char green_band,
					  unsigned char blue_band,
					  unsigned char compression,
					  unsigned int tile_sz)
{
/* exporting a Band-Composed TIFF+TFW common implementation */
    rl2RasterPtr raster = NULL;
    rl2PixelPtr no_data_multi = NULL;
    rl2PixelPtr no_data = NULL;
    rl2TiffDestinationPtr tiff = NULL;
    unsigned char level;
    unsigned char scale;
    double xx_res = x_res;
................................................................................
    if (rl2_get_coverage_srid (cvg, &srid) != RL2_OK)
	goto error;
    no_data_multi = rl2_get_coverage_no_data (cvg);
    no_data =
	rl2_create_triple_band_pixel (no_data_multi, red_band, green_band,
				      blue_band);

    if (by_section)
      {
	  /* single Section */
	  if (rl2_get_section_triple_band_raw_raster_data
	      (handle, cvg, section_id, width, height, minx, miny, maxx, maxy,
	       xx_res, yy_res, red_band, green_band, blue_band, &outbuf,
	       &outbuf_size, no_data) != RL2_OK)
	      goto error;
      }
    else
      {
	  /* whole Coverage */
	  if (rl2_get_triple_band_raw_raster_data
	      (handle, cvg, width, height, minx, miny, maxx, maxy, xx_res,
	       yy_res, red_band, green_band, blue_band, &outbuf, &outbuf_size,
	       no_data) != RL2_OK)
	      goto error;
      }

    tiff =
	rl2_create_tiff_worldfile_destination (dst_path, width, height,
					       sample_type, RL2_PIXEL_RGB,
					       3, NULL, compression, 1, tile_sz,
					       srid, minx, miny, maxx, maxy,
					       xx_res, yy_res);
................................................................................
	free (bufpix);
    if (no_data != NULL)
	rl2_destroy_pixel (no_data);
    return RL2_ERROR;
}

RL2_DECLARE int
rl2_export_triple_band_tiff_worldfile_from_dbms (sqlite3 * handle,
						 const char *dst_path,
						 rl2CoveragePtr cvg,
						 double x_res, double y_res,
						 double minx, double miny,
						 double maxx, double maxy,
						 unsigned int width,
						 unsigned int height,
						 unsigned char red_band,
						 unsigned char green_band,
						 unsigned char blue_band,
						 unsigned char compression,
						 unsigned int tile_sz)
{
/* exporting a Band-Composed TIFF+TFW from the DBMS into the file-system */
    return export_triple_band_tiff_worldfile_common (0, handle, dst_path, cvg,
						     0, x_res, y_res, minx,
						     miny, maxx, maxy, width,
						     height, red_band,
						     green_band, blue_band,
						     compression, tile_sz);
}

RL2_DECLARE int
rl2_export_section_triple_band_tiff_worldfile_from_dbms (sqlite3 * handle,
							 const char *dst_path,
							 rl2CoveragePtr cvg,
							 sqlite3_int64
							 section_id,
							 double x_res,
							 double y_res,
							 double minx,
							 double miny,
							 double maxx,
							 double maxy,
							 unsigned int width,
							 unsigned int height,
							 unsigned char red_band,
							 unsigned char
							 green_band,
							 unsigned char
							 blue_band,
							 unsigned char
							 compression,
							 unsigned int tile_sz)
{
/* exporting a Band-Composed TIFF+TFW - Sction */
    return export_triple_band_tiff_worldfile_common (1, handle, dst_path, cvg,
						     section_id, x_res, y_res,
						     minx, miny, maxx, maxy,
						     width, height, red_band,
						     green_band, blue_band,
						     compression, tile_sz);
}

static int
export_mono_band_tiff_worldfile_common (int by_section, sqlite3 * handle,
					const char *dst_path,
					rl2CoveragePtr cvg,
					sqlite3_int64 section_id, double x_res,
					double y_res, double minx, double miny,
					double maxx, double maxy,
					unsigned int width, unsigned int height,
					unsigned char mono_band,
					unsigned char compression,
					unsigned int tile_sz)
{
/* exporting a Mono-Band TIFF+TFW - common implementation */
    rl2RasterPtr raster = NULL;
    rl2PixelPtr no_data_multi = NULL;
    rl2PixelPtr no_data = NULL;
    rl2TiffDestinationPtr tiff = NULL;
    unsigned char level;
    unsigned char scale;
    double xx_res = x_res;
................................................................................
    if (mono_band >= num_bands)
	goto error;
    if (rl2_get_coverage_srid (cvg, &srid) != RL2_OK)
	goto error;
    no_data_multi = rl2_get_coverage_no_data (cvg);
    no_data = rl2_create_mono_band_pixel (no_data_multi, mono_band);

    if (by_section)
      {
	  /* single Section */
	  if (rl2_get_section_mono_band_raw_raster_data
	      (handle, cvg, section_id, width, height, minx, miny, maxx, maxy,
	       xx_res, yy_res, mono_band, &outbuf, &outbuf_size,
	       no_data) != RL2_OK)
	      goto error;
      }
    else
      {
	  /* whole Coverage */
	  if (rl2_get_mono_band_raw_raster_data
	      (handle, cvg, width, height, minx, miny, maxx, maxy, xx_res,
	       yy_res, mono_band, &outbuf, &outbuf_size, no_data) != RL2_OK)
	      goto error;
      }

    if (sample_type == RL2_SAMPLE_UINT16)
	out_pixel = RL2_PIXEL_DATAGRID;
    else
	out_pixel = RL2_PIXEL_GRAYSCALE;

    tiff =
................................................................................
	free (bufpix);
    if (no_data != NULL)
	rl2_destroy_pixel (no_data);
    return RL2_ERROR;
}

RL2_DECLARE int
rl2_export_mono_band_tiff_worldfile_from_dbms (sqlite3 * handle,
					       const char *dst_path,
					       rl2CoveragePtr cvg,
					       double x_res, double y_res,
					       double minx, double miny,
					       double maxx, double maxy,
					       unsigned int width,
					       unsigned int height,
					       unsigned char mono_band,
					       unsigned char compression,
					       unsigned int tile_sz)
{
/* exporting a Mono-Band TIFF+TFW from the DBMS into the file-system */
    return export_mono_band_tiff_worldfile_common (0, handle, dst_path, cvg, 0,
						   x_res, y_res, minx, miny,
						   maxx, maxy, width, height,
						   mono_band, compression,
						   tile_sz);
}

RL2_DECLARE int
rl2_export_section_mono_band_tiff_worldfile_from_dbms (sqlite3 * handle,
						       const char *dst_path,
						       rl2CoveragePtr cvg,
						       sqlite3_int64 section_id,
						       double x_res,
						       double y_res,
						       double minx, double miny,
						       double maxx, double maxy,
						       unsigned int width,
						       unsigned int height,
						       unsigned char mono_band,
						       unsigned char
						       compression,
						       unsigned int tile_sz)
{
/* exporting a Mono-Band TIFF+TFW - Section */
    return export_mono_band_tiff_worldfile_common (1, handle, dst_path, cvg,
						   section_id, x_res, y_res,
						   minx, miny, maxx, maxy,
						   width, height, mono_band,
						   compression, tile_sz);
}

static int
export_triple_band_tiff_common (int by_section, sqlite3 * handle,
				const char *dst_path, rl2CoveragePtr cvg,
				sqlite3_int64 section_id, double x_res,
				double y_res, double minx, double miny,
				double maxx, double maxy, unsigned int width,
				unsigned int height, unsigned char red_band,
				unsigned char green_band,
				unsigned char blue_band,
				unsigned char compression, unsigned int tile_sz)
{
/* exporting a plain Band-Composed TIFF common implementation */
    rl2RasterPtr raster = NULL;
    rl2PixelPtr no_data_multi = NULL;
    rl2PixelPtr no_data = NULL;
    rl2TiffDestinationPtr tiff = NULL;
    unsigned char level;
    unsigned char scale;
    double xx_res = x_res;
................................................................................
    if (rl2_get_coverage_srid (cvg, &srid) != RL2_OK)
	goto error;
    no_data_multi = rl2_get_coverage_no_data (cvg);
    no_data =
	rl2_create_triple_band_pixel (no_data_multi, red_band, green_band,
				      blue_band);

    if (by_section)
      {
	  /* single Section */
	  if (rl2_get_section_triple_band_raw_raster_data
	      (handle, cvg, section_id, width, height, minx, miny, maxx, maxy,
	       xx_res, yy_res, red_band, green_band, blue_band, &outbuf,
	       &outbuf_size, no_data) != RL2_OK)
	      goto error;
      }
    else
      {
	  /* whole Coverage */
	  if (rl2_get_triple_band_raw_raster_data
	      (handle, cvg, width, height, minx, miny, maxx, maxy, xx_res,
	       yy_res, red_band, green_band, blue_band, &outbuf, &outbuf_size,
	       no_data) != RL2_OK)
	      goto error;
      }

    tiff =
	rl2_create_tiff_destination (dst_path, width, height, sample_type,
				     RL2_PIXEL_RGB, 3, NULL,
				     compression, 1, tile_sz);
    if (tiff == NULL)
	goto error;
................................................................................
	free (bufpix);
    if (no_data != NULL)
	rl2_destroy_pixel (no_data);
    return RL2_ERROR;
}

RL2_DECLARE int
rl2_export_triple_band_tiff_from_dbms (sqlite3 * handle, const char *dst_path,
				       rl2CoveragePtr cvg, double x_res,
				       double y_res, double minx, double miny,
				       double maxx, double maxy,
				       unsigned int width,
				       unsigned int height,
				       unsigned char red_band,
				       unsigned char green_band,
				       unsigned char blue_band,
				       unsigned char compression,
				       unsigned int tile_sz)
{
/* exporting a plain Band-Composed TIFF from the DBMS into the file-system */
    return export_triple_band_tiff_common (0, handle, dst_path, cvg, 0, x_res,
					   y_res, minx, miny, maxx, maxy, width,
					   height, red_band, green_band,
					   blue_band, compression, tile_sz);
}

RL2_DECLARE int
rl2_export_section_triple_band_tiff_from_dbms (sqlite3 * handle,
					       const char *dst_path,
					       rl2CoveragePtr cvg,
					       sqlite3_int64 section_id,
					       double x_res, double y_res,
					       double minx, double miny,
					       double maxx, double maxy,
					       unsigned int width,
					       unsigned int height,
					       unsigned char red_band,
					       unsigned char green_band,
					       unsigned char blue_band,
					       unsigned char compression,
					       unsigned int tile_sz)
{
/* exporting a plain Band-Composed TIFF - Section */
    return export_triple_band_tiff_common (1, handle, dst_path, cvg, section_id,
					   x_res, y_res, minx, miny, maxx, maxy,
					   width, height, red_band, green_band,
					   blue_band, compression, tile_sz);
}

static int
export_mono_band_tiff_common (int by_section, sqlite3 * handle,
			      const char *dst_path, rl2CoveragePtr cvg,
			      sqlite3_int64 section_id, double x_res,
			      double y_res, double minx, double miny,
			      double maxx, double maxy, unsigned int width,
			      unsigned int height, unsigned char mono_band,
			      unsigned char compression, unsigned int tile_sz)
{
/* exporting a plain Mono-Band TIFF - common implementation */
    rl2RasterPtr raster = NULL;
    rl2PixelPtr no_data_multi = NULL;
    rl2PixelPtr no_data = NULL;
    rl2TiffDestinationPtr tiff = NULL;
    unsigned char level;
    unsigned char scale;
    double xx_res = x_res;
................................................................................
    if (mono_band >= num_bands)
	goto error;
    if (rl2_get_coverage_srid (cvg, &srid) != RL2_OK)
	goto error;
    no_data_multi = rl2_get_coverage_no_data (cvg);
    no_data = rl2_create_mono_band_pixel (no_data_multi, mono_band);

    if (by_section)
      {
	  /* single Section */
	  if (rl2_get_section_mono_band_raw_raster_data
	      (handle, cvg, section_id, width, height, minx, miny, maxx, maxy,
	       xx_res, yy_res, mono_band, &outbuf, &outbuf_size,
	       no_data) != RL2_OK)
	      goto error;
      }
    else
      {
	  /* whole Coverage */
	  if (rl2_get_mono_band_raw_raster_data
	      (handle, cvg, width, height, minx, miny, maxx, maxy, xx_res,
	       yy_res, mono_band, &outbuf, &outbuf_size, no_data) != RL2_OK)
	      goto error;
      }

    if (sample_type == RL2_SAMPLE_UINT16)
	out_pixel = RL2_PIXEL_DATAGRID;
    else
	out_pixel = RL2_PIXEL_GRAYSCALE;

    tiff =
................................................................................
	free (outbuf);
    if (bufpix != NULL)
	free (bufpix);
    if (no_data != NULL)
	rl2_destroy_pixel (no_data);
    return RL2_ERROR;
}

RL2_DECLARE int
rl2_export_mono_band_tiff_from_dbms (sqlite3 * handle, const char *dst_path,
				     rl2CoveragePtr cvg, double x_res,
				     double y_res, double minx, double miny,
				     double maxx, double maxy,
				     unsigned int width,
				     unsigned int height,
				     unsigned char mono_band,
				     unsigned char compression,
				     unsigned int tile_sz)
{
/* exporting a plain Mono-Band TIFF from the DBMS into the file-system */
    return export_mono_band_tiff_common (0, handle, dst_path, cvg, 0, x_res,
					 y_res, minx, miny, maxx, maxy, width,
					 height, mono_band, compression,
					 tile_sz);
}

RL2_DECLARE int
rl2_export_section_mono_band_tiff_from_dbms (sqlite3 * handle,
					     const char *dst_path,
					     rl2CoveragePtr cvg,
					     sqlite3_int64 section_id,
					     double x_res, double y_res,
					     double minx, double miny,
					     double maxx, double maxy,
					     unsigned int width,
					     unsigned int height,
					     unsigned char mono_band,
					     unsigned char compression,
					     unsigned int tile_sz)
{
/* exporting a plain Mono-Band TIFF from the DBMS - Section */
    return export_mono_band_tiff_common (1, handle, dst_path, cvg, section_id,
					 x_res, y_res, minx, miny, maxx, maxy,
					 width, height, mono_band, compression,
					 tile_sz);
}

static int
export_ascii_grid_common (int by_section, sqlite3 * handle,
			  const char *dst_path, rl2CoveragePtr cvg,
			  sqlite3_int64 section_id, double res, double minx,
			  double miny, double maxx, double maxy,
			  unsigned int width, unsigned int height,
			  int is_centered, int decimal_digits)
{
/* exporting an ASCII Grid common implementation */
    rl2PalettePtr palette = NULL;
    rl2AsciiGridDestinationPtr ascii = NULL;
    rl2PixelPtr pixel;
    unsigned char level;
    unsigned char scale;
    double xx_res = res;
    double yy_res = res;
................................................................................
					 rl2CoveragePtr cvg,
					 sqlite3_int64 section_id, double res,
					 double minx, double miny, double maxx,
					 double maxy, unsigned int width,
					 unsigned int height, int is_centered,
					 int decimal_digits)
{
/* exporting an ASCII Grid - Section */
    return export_ascii_grid_common (1, handle, dst_path, cvg, section_id, res,
				     minx, miny, maxx, maxy, width, height,
				     is_centered, decimal_digits);
}

static int
export_jpeg_common (int by_section, sqlite3 * handle, const char *dst_path,
................................................................................
rl2_export_section_jpeg_from_dbms (sqlite3 * handle, const char *dst_path,
				   rl2CoveragePtr cvg, sqlite3_int64 section_id,
				   double x_res, double y_res, double minx,
				   double miny, double maxx, double maxy,
				   unsigned int width, unsigned int height,
				   int quality, int with_worldfile)
{
/* exporting a JPEG (with possible JGW) - Section */
    return export_jpeg_common (1, handle, dst_path, cvg, section_id, x_res,
			       y_res, minx, miny, maxx, maxy, width, height,
			       quality, with_worldfile);
}

Changes to src/rl2png.c.

113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
...
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
...
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
		      unsigned int height, rl2PalettePtr plt,
		      unsigned char sample_type, unsigned char **png,
		      int *png_size)
{
/* compressing a PNG image of the PALETTE type */
    png_structp png_ptr;
    png_infop info_ptr;
    int bit_depth;
    png_bytep *row_pointers = NULL;
    png_bytep p_out;
    unsigned int row;
    unsigned int col;
    png_color palette[256];
    unsigned short num_entries;
    unsigned char *red = NULL;
................................................................................
RL2_PRIVATE int
rl2_data_to_png (const unsigned char *pixels, const unsigned char *mask,
		 double opacity, rl2PalettePtr plt, unsigned int width,
		 unsigned int height, unsigned char sample_type,
		 unsigned char pixel_type, unsigned char **png, int *png_size)
{
/* encoding a PNG image */
    int ret;
    unsigned char *blob;
    int blob_size;

    if (pixels == NULL)
	return RL2_ERROR;
    switch (pixel_type)
      {
................................................................................
    int color_type;
    int interlace_type;
    png_structp png_ptr;
    png_infop info_ptr;
    struct png_memory_buffer membuf;
    unsigned char sample_type = RL2_SAMPLE_UNKNOWN;
    unsigned char pixel_type = RL2_PIXEL_UNKNOWN;
    int nBands;
    int i;
    png_colorp palette;
    int red[256];
    int green[256];
    int blue[256];
    int alpha[256];
    unsigned char *data = NULL;







|







 







|







 







|







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
...
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
...
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
		      unsigned int height, rl2PalettePtr plt,
		      unsigned char sample_type, unsigned char **png,
		      int *png_size)
{
/* compressing a PNG image of the PALETTE type */
    png_structp png_ptr;
    png_infop info_ptr;
    int bit_depth = 0;
    png_bytep *row_pointers = NULL;
    png_bytep p_out;
    unsigned int row;
    unsigned int col;
    png_color palette[256];
    unsigned short num_entries;
    unsigned char *red = NULL;
................................................................................
RL2_PRIVATE int
rl2_data_to_png (const unsigned char *pixels, const unsigned char *mask,
		 double opacity, rl2PalettePtr plt, unsigned int width,
		 unsigned int height, unsigned char sample_type,
		 unsigned char pixel_type, unsigned char **png, int *png_size)
{
/* encoding a PNG image */
    int ret = RL2_ERROR;
    unsigned char *blob;
    int blob_size;

    if (pixels == NULL)
	return RL2_ERROR;
    switch (pixel_type)
      {
................................................................................
    int color_type;
    int interlace_type;
    png_structp png_ptr;
    png_infop info_ptr;
    struct png_memory_buffer membuf;
    unsigned char sample_type = RL2_SAMPLE_UNKNOWN;
    unsigned char pixel_type = RL2_PIXEL_UNKNOWN;
    int nBands = 1;
    int i;
    png_colorp palette;
    int red[256];
    int green[256];
    int blue[256];
    int alpha[256];
    unsigned char *data = NULL;

Changes to src/rl2pyramid.c.

2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
....
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
....
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
/* copying pixels from rescaled to destination tile buffer */
    rl2PrivRasterPtr rst_in = (rl2PrivRasterPtr) raster_in;
    rl2PrivRasterPtr rst_out = (rl2PrivRasterPtr) raster_out;
    unsigned int x;
    unsigned int y;
    int dx;
    int dy;
    unsigned char *p_in_u8;
    unsigned char *p_out_u8;
    unsigned short *p_in_u16;
    unsigned short *p_out_u16;
    unsigned char *p_msk_in;
    unsigned char *p_msk_out;
    int mismatch = 0;
    int ib;

    if (rst_in->sampleType != rst_out->sampleType)
	mismatch = 1;
................................................................................
/* copying pixels from rescaled to destination tile buffer */
    rl2PrivRasterPtr rst_in = (rl2PrivRasterPtr) raster_in;
    rl2PrivRasterPtr rst_out = (rl2PrivRasterPtr) raster_out;
    unsigned int x;
    unsigned int y;
    int dx;
    int dy;
    char *p_in_8;
    char *p_out_8;
    unsigned char *p_in_u8;
    unsigned char *p_out_u8;
    short *p_in_16;
    short *p_out_16;
    unsigned short *p_in_u16;
    unsigned short *p_out_u16;
    int *p_in_32;
    int *p_out_32;
    unsigned int *p_in_u32;
    unsigned int *p_out_u32;
    float *p_in_flt;
    float *p_out_flt;
    double *p_in_dbl;
    double *p_out_dbl;
    unsigned char *p_msk_in;
    unsigned char *p_msk_out;
    int mismatch = 0;

    if (rst_in->sampleType != rst_out->sampleType)
	mismatch = 1;
    if (rst_in->pixelType != RL2_PIXEL_DATAGRID
................................................................................
get_coverage_extent (sqlite3 * handle, const char *coverage, double *minx,
		     double *miny, double *maxx, double *maxy)
{
/* attempting to get the Extent from a Coverage Object */
    char *sql;
    int ret;
    sqlite3_stmt *stmt;
    double extent_minx;
    double extent_miny;
    double extent_maxx;
    double extent_maxy;
    int ok = 0;

/* querying the Coverage metadata defs */
    sql =
	"SELECT extent_minx, extent_miny, extent_maxx, extent_maxy "
	"FROM raster_coverages WHERE Lower(coverage_name) = Lower(?)";
    ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL);







|
|
|
|







 







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







 







|
|
|
|







2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
....
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
....
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
/* copying pixels from rescaled to destination tile buffer */
    rl2PrivRasterPtr rst_in = (rl2PrivRasterPtr) raster_in;
    rl2PrivRasterPtr rst_out = (rl2PrivRasterPtr) raster_out;
    unsigned int x;
    unsigned int y;
    int dx;
    int dy;
    unsigned char *p_in_u8 = NULL;
    unsigned char *p_out_u8 = NULL;
    unsigned short *p_in_u16 = NULL;
    unsigned short *p_out_u16 = NULL;
    unsigned char *p_msk_in;
    unsigned char *p_msk_out;
    int mismatch = 0;
    int ib;

    if (rst_in->sampleType != rst_out->sampleType)
	mismatch = 1;
................................................................................
/* copying pixels from rescaled to destination tile buffer */
    rl2PrivRasterPtr rst_in = (rl2PrivRasterPtr) raster_in;
    rl2PrivRasterPtr rst_out = (rl2PrivRasterPtr) raster_out;
    unsigned int x;
    unsigned int y;
    int dx;
    int dy;
    char *p_in_8 = NULL;
    char *p_out_8 = NULL;
    unsigned char *p_in_u8 = NULL;
    unsigned char *p_out_u8 = NULL;
    short *p_in_16 = NULL;
    short *p_out_16 = NULL;
    unsigned short *p_in_u16 = NULL;
    unsigned short *p_out_u16 = NULL;
    int *p_in_32 = NULL;
    int *p_out_32 = NULL;
    unsigned int *p_in_u32 = NULL;
    unsigned int *p_out_u32 = NULL;
    float *p_in_flt = NULL;
    float *p_out_flt = NULL;
    double *p_in_dbl = NULL;
    double *p_out_dbl = NULL;
    unsigned char *p_msk_in;
    unsigned char *p_msk_out;
    int mismatch = 0;

    if (rst_in->sampleType != rst_out->sampleType)
	mismatch = 1;
    if (rst_in->pixelType != RL2_PIXEL_DATAGRID
................................................................................
get_coverage_extent (sqlite3 * handle, const char *coverage, double *minx,
		     double *miny, double *maxx, double *maxy)
{
/* attempting to get the Extent from a Coverage Object */
    char *sql;
    int ret;
    sqlite3_stmt *stmt;
    double extent_minx = 0.0;
    double extent_miny = 0.0;
    double extent_maxx = 0.0;
    double extent_maxy = 0.0;
    int ok = 0;

/* querying the Coverage metadata defs */
    sql =
	"SELECT extent_minx, extent_miny, extent_maxx, extent_maxy "
	"FROM raster_coverages WHERE Lower(coverage_name) = Lower(?)";
    ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL);

Changes to src/rl2rastersym.c.

2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
{
/* computing the Stretching/Normalize values */
    int i;
    double total;
    double sum = 0.0;
    double percentile_2;
    double percentile_98;
    double vmin;
    double vmax;
    double range;

    for (i = 0; i < band->nHistogram; i++)
	sum += *(band->histogram + i);
    total = sum;
    percentile_2 = (sum / 100.0) * 2.0;
    percentile_98 = sum - percentile_2;







|
|







2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
{
/* computing the Stretching/Normalize values */
    int i;
    double total;
    double sum = 0.0;
    double percentile_2;
    double percentile_98;
    double vmin = DBL_MAX;
    double vmax = 0.0 - DBL_MAX;
    double range;

    for (i = 0; i < band->nHistogram; i++)
	sum += *(band->histogram + i);
    total = sum;
    percentile_2 = (sum / 100.0) * 2.0;
    percentile_98 = sum - percentile_2;

Changes to src/rl2raw.c.

603
604
605
606
607
608
609

610
611
612
613
614
615
616
...
669
670
671
672
673
674
675

676
677
678
679
680
681
682
683
....
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
		break;
	    };
      }

    p_in = rst->rasterBuffer;
    p_mask = rst->maskBuffer;
    p_out = buf;

    for (row = 0; row < rst->height; row++)
      {
	  for (col = 0; col < rst->width; col++)
	    {
		if (p_mask == NULL)
		    a = 255;
		else
................................................................................
		      if (rst->noData != NULL)
			{
			    /* evaluating transparent color */
			    if (eval_transparent_pixels
				(r, g, b, transpR, transpG, transpB))
				a = 0;
			}

		      *p_alpha = a;
		  }
	    }
      }

    *buffer = buf;
    *buf_size = sz;
    if (red != NULL)
................................................................................

    p_in = rst->rasterBuffer;
    p_out = buf;
    for (row = 0; row < rst->height; row++)
      {
	  for (col = 0; col < rst->width; col++)
	    {
		unsigned char red;
		unsigned char green;
		unsigned char blue;
		for (nBand = 0; nBand < rst->nBands; nBand++)
		  {
		      if (nBand == bandR)
			  red = *p_in;
		      if (nBand == bandG)
			  green = *p_in;
		      if (nBand == bandB)







>







 







>
|







 







|
|
|







603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
...
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
....
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
		break;
	    };
      }

    p_in = rst->rasterBuffer;
    p_mask = rst->maskBuffer;
    p_out = buf;
    p_alpha = NULL;
    for (row = 0; row < rst->height; row++)
      {
	  for (col = 0; col < rst->width; col++)
	    {
		if (p_mask == NULL)
		    a = 255;
		else
................................................................................
		      if (rst->noData != NULL)
			{
			    /* evaluating transparent color */
			    if (eval_transparent_pixels
				(r, g, b, transpR, transpG, transpB))
				a = 0;
			}
		      if (p_alpha != NULL)
			  *p_alpha = a;
		  }
	    }
      }

    *buffer = buf;
    *buf_size = sz;
    if (red != NULL)
................................................................................

    p_in = rst->rasterBuffer;
    p_out = buf;
    for (row = 0; row < rst->height; row++)
      {
	  for (col = 0; col < rst->width; col++)
	    {
		unsigned char red = 0;
		unsigned char green = 0;
		unsigned char blue = 0;
		for (nBand = 0; nBand < rst->nBands; nBand++)
		  {
		      if (nBand == bandR)
			  red = *p_in;
		      if (nBand == bandG)
			  green = *p_in;
		      if (nBand == bandB)

Changes to src/rl2sql.c.

964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
....
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
....
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
....
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
....
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
....
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
....
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
....
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759

3760
3761
3762
3763
3764
3765
3766
....
3777
3778
3779
3780
3781
3782
3783



3784
3785


































3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811

3812
3813
3814
3815
3816
3817
3818



3819























































3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850

3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867

3868
3869
3870
3871
3872
3873
3874
....
3940
3941
3942
3943
3944
3945
3946



3947




















3948
3949
3950
3951
3952
3953
3954

3955
3956
3957
3958
3959
3960
3961
....
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975

3976
3977

3978
3979
3980

3981
3982
3983

3984
3985

3986

3987
3988


























3989










3990
3991
3992
3993
3994









3995
3996

3997
3998
3999
4000
4001
4002
4003
....
4012
4013
4014
4015
4016
4017
4018



4019
4020






























4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042

4043
4044
4045
4046
4047
4048
4049



4050





















































4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096

4097
4098
4099
4100
4101
4102
4103
....
4159
4160
4161
4162
4163
4164
4165



4166
















4167
4168
4169
4170
4171
4172


4173
4174
4175
4176
4177
4178
4179
....
4180
4181
4182
4183
4184
4185
4186



























































4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
....
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
....
4914
4915
4916
4917
4918
4919
4920
4921

4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945

4946
4947
4948
4949
4950
4951
4952
....
4962
4963
4964
4965
4966
4967
4968



4969
4970
































4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994

4995
4996
4997
4998
4999
5000
5001



5002

5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022









5023
5024
5025




















































5026
5027
5028
5029
5030
5031

5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048

5049
5050
5051
5052
5053
5054
5055
....
5121
5122
5123
5124
5125
5126
5127



5128
5129
5130
5131
































5132

5133
5134
5135
5136

5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149

5150
5151
5152
5153

5154


5155
5156
5157
5158
5159
5160
5161
....
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202


























































5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226

5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247

5248
5249
5250
5251
5252
5253
5254
....
5262
5263
5264
5265
5266
5267
5268



5269
5270




























5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290

5291
5292
5293
5294
5295
5296
5297



5298


















































5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342

5343
5344
5345
5346
5347
5348
5349
....
5405
5406
5407
5408
5409
5410
5411



5412
5413
5414
5415
5416









5417

5418
5419
5420
5421
5422
5423
5424
5425
5426

5427
5428



















5429
5430
5431
5432
5433

5434
5435

5436
5437
5438
5439
5440
5441
5442
....
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
....
5490
5491
5492
5493
5494
5495
5496
5497






















































5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
....
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
....
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
....
7568
7569
7570
7571
7572
7573
7574






























7575
7576
7577
7578
7579
7580
7581
....
7593
7594
7595
7596
7597
7598
7599






























7600
7601
7602
7603
7604
7605
7606
....
7613
7614
7615
7616
7617
7618
7619
















































7620

7621
7622

7623
7624
7625

7626
7627
7628
7629
7630
7631
7632
....
7652
7653
7654
7655
7656
7657
7658
























7659
7660
7661
7662
7663
7664
7665
....
7668
7669
7670
7671
7672
7673
7674
























7675
7676
7677
7678
7679
7680
7681
*/
    unsigned char *blob = NULL;
    int blob_sz = 0;
    rl2PixelPtr pxl = NULL;
    rl2PrivPixelPtr pixel;
    rl2PrivSamplePtr sample;
    int band_id;
    int intval;
    double dblval;
    RL2_UNUSED ();		/* LCOV_EXCL_LINE */

    if (sqlite3_value_type (argv[0]) != SQLITE_BLOB)
	goto error;
    if (sqlite3_value_type (argv[1]) != SQLITE_INTEGER)
	goto error;
    if (sqlite3_value_type (argv[2]) != SQLITE_INTEGER
................................................................................
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    int err = 0;
    const char *cvg_name;
    const char *path;
    const char *file_ext;
    int worldfile = 0;
    int force_srid = -1;
    int transaction = 1;
    int pyramidize = 1;
    rl2CoveragePtr coverage = NULL;
    sqlite3 *sqlite;
    int ret;
................................................................................
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    int err = 0;
    const char *cvg_name;
    sqlite3_int64 section_id;
    int null_id = 1;
    int forced_rebuild = 0;
    int transaction = 1;
    sqlite3 *sqlite;
    int ret;
    RL2_UNUSED ();		/* LCOV_EXCL_LINE */

................................................................................
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    int err = 0;
    const char *cvg_name;
    sqlite3_int64 section_id;
    int null_id = 1;
    int transaction = 1;
    sqlite3 *sqlite;
    int ret;
    RL2_UNUSED ();		/* LCOV_EXCL_LINE */

    if (sqlite3_value_type (argv[0]) != SQLITE_TEXT)
................................................................................
    gaiaGeomCollPtr geom;
    rl2CoveragePtr coverage = NULL;
    rl2PrivCoveragePtr cvg;
    rl2RasterStatisticsPtr section_stats = NULL;
    sqlite3 *sqlite;
    int ret;
    int n;
    double x;
    double y;
    double tilew;
    double tileh;
    unsigned int tile_width;
    unsigned int tile_height;
    WmsRetryListPtr retry_list = NULL;
    char *table;
    char *xtable;
................................................................................
    sqlite3_stmt *stmt_levl = NULL;
    sqlite3_stmt *stmt_upd_sect = NULL;
    int first = 1;
    double ext_x;
    double ext_y;
    unsigned int width;
    unsigned int height;
    sqlite3_int64 section_id;
    rl2PixelPtr no_data = NULL;
    unsigned char sample_type;
    unsigned char pixel_type;
    unsigned char num_bands;
    unsigned char compression;
    int quality;
    InsertWms params;
................................................................................
common_write_geotiff (int by_section, sqlite3_context * context, int argc,
		      sqlite3_value ** argv)
{
/* common implementation for Write GeoTIFF */
    int err = 0;
    const char *cvg_name;
    const char *path;
    sqlite3_int64 section_id;
    int width;
    int height;
    const unsigned char *blob;
    int blob_sz;
    double horz_res;
    double vert_res;
    int worldfile = 0;
................................................................................
/ or -1 (INVALID ARGS)
/
*/
    common_write_geotiff (1, context, argc, argv);
}

static void
fnct_WriteTripleBandGeoTiff (sqlite3_context * context, int argc,
			     sqlite3_value ** argv)
{
/* SQL function:
/ WriteTripleBandGeoTiff(text coverage, text geotiff_path, int width,
/              int height, int red_band, int green_band, int blue_band,
/              BLOB geom, double resolution)
/ WriteTripleBandGeoTiff(text coverage, text geotiff_path, int width,
/              int height, int red_band, int green_band, int blue_band, 
/              BLOB geom, double horz_res, double vert_res)
/ WriteTripleBandGeoTiff(text coverage, text geotiff_path, int width,
/              int height, int red_band, int green_band, int blue_band,
/              BLOB geom, double horz_res, double vert_res, 
/              int with_worldfile)
/ WriteTripleBandGeoTiff(text coverage, text geotiff_path, int width,
/              int height, int red_band, int green_band, int blue_band, 
/              BLOB geom, double horz_res, double vert_res, 
/              int with_worldfile, text compression)
/ WriteTripleBandGeoTiff(text coverage, text geotiff_path, int width,
/              int height, int red_band, int green_band, int blue_band, 
/              BLOB geom, double horz_res, double vert_res, 
/              int with_worldfile, text compression, int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    int err = 0;
    const char *cvg_name;

    const char *path;
    int width;
    int height;
    int red_band;
    int green_band;
    int blue_band;
    const unsigned char *blob;
................................................................................
    gaiaGeomCollPtr geom;
    double minx;
    double maxx;
    double miny;
    double maxy;
    RL2_UNUSED ();		/* LCOV_EXCL_LINE */




    if (sqlite3_value_type (argv[0]) != SQLITE_TEXT)
	err = 1;


































    if (sqlite3_value_type (argv[1]) != SQLITE_TEXT)
	err = 1;
    if (sqlite3_value_type (argv[2]) != SQLITE_INTEGER)
	err = 1;
    if (sqlite3_value_type (argv[3]) != SQLITE_INTEGER)
	err = 1;
    if (sqlite3_value_type (argv[4]) != SQLITE_INTEGER)
	err = 1;
    if (sqlite3_value_type (argv[5]) != SQLITE_INTEGER)
	err = 1;
    if (sqlite3_value_type (argv[6]) != SQLITE_INTEGER)
	err = 1;
    if (sqlite3_value_type (argv[7]) != SQLITE_BLOB)
	err = 1;
    if (sqlite3_value_type (argv[8]) != SQLITE_INTEGER
	&& sqlite3_value_type (argv[8]) != SQLITE_FLOAT)
	err = 1;
    if (argc > 9 && sqlite3_value_type (argv[9]) != SQLITE_INTEGER
	&& sqlite3_value_type (argv[9]) != SQLITE_FLOAT)
	err = 1;
    if (argc > 10 && sqlite3_value_type (argv[10]) != SQLITE_INTEGER)
	err = 1;
    if (argc > 11 && sqlite3_value_type (argv[11]) != SQLITE_TEXT)
	err = 1;
    if (argc > 12 && sqlite3_value_type (argv[12]) != SQLITE_INTEGER)
	err = 1;

    if (err)
      {
	  sqlite3_result_int (context, -1);
	  return;
      }

/* retrieving all arguments */



    cvg_name = (const char *) sqlite3_value_text (argv[0]);























































    path = (const char *) sqlite3_value_text (argv[1]);
    width = sqlite3_value_int (argv[2]);
    height = sqlite3_value_int (argv[3]);
    red_band = sqlite3_value_int (argv[4]);
    green_band = sqlite3_value_int (argv[5]);
    blue_band = sqlite3_value_int (argv[6]);
    blob = sqlite3_value_blob (argv[7]);
    blob_sz = sqlite3_value_bytes (argv[7]);
    if (sqlite3_value_type (argv[8]) == SQLITE_INTEGER)
      {
	  int ival = sqlite3_value_int (argv[8]);
	  horz_res = ival;
      }
    else
	horz_res = sqlite3_value_double (argv[8]);
    if (argc > 9)
      {
	  if (sqlite3_value_type (argv[9]) == SQLITE_INTEGER)
	    {
		int ival = sqlite3_value_int (argv[9]);
		vert_res = ival;
	    }
	  else
	      vert_res = sqlite3_value_double (argv[9]);
      }
    else
	vert_res = horz_res;
    if (argc > 10)
	worldfile = sqlite3_value_int (argv[10]);
    if (argc > 11)
      {

	  const char *compr = (const char *) sqlite3_value_text (argv[11]);
	  compression = RL2_COMPRESSION_UNKNOWN;
	  if (strcasecmp (compr, "NONE") == 0)
	      compression = RL2_COMPRESSION_NONE;
	  if (strcasecmp (compr, "DEFLATE") == 0)
	      compression = RL2_COMPRESSION_DEFLATE;
	  if (strcasecmp (compr, "LZW") == 0)
	      compression = RL2_COMPRESSION_LZW;
	  if (strcasecmp (compr, "JPEG") == 0)
	      compression = RL2_COMPRESSION_JPEG;
	  if (strcasecmp (compr, "FAX3") == 0)
	      compression = RL2_COMPRESSION_CCITTFAX3;
	  if (strcasecmp (compr, "FAX4") == 0)
	      compression = RL2_COMPRESSION_CCITTFAX4;
      }
    if (argc > 12)
	tile_sz = sqlite3_value_int (argv[12]);


/* excluding any Mixed Resolution Coverage */
    sqlite = sqlite3_context_db_handle (context);
    if (rl2_is_mixed_resolutions_coverage (sqlite, cvg_name) > 0)
	goto error;

/* coarse args validation */
................................................................................
    coverage = rl2_create_coverage_from_dbms (sqlite, cvg_name);
    if (coverage == NULL)
      {
	  sqlite3_result_int (context, -1);
	  return;
      }




    ret =




















	rl2_export_triple_band_geotiff_from_dbms (sqlite, path, coverage,
						  horz_res, vert_res, minx,
						  miny, maxx, maxy, width,
						  height, red_band,
						  green_band, blue_band,
						  compression, tile_sz,
						  worldfile);

    if (ret != RL2_OK)
      {
	  errcode = 0;
	  goto error;
      }
    rl2_destroy_coverage (coverage);
    sqlite3_result_int (context, 1);
................................................................................
  error:
    if (coverage != NULL)
	rl2_destroy_coverage (coverage);
    sqlite3_result_int (context, errcode);
}

static void
fnct_WriteMonoBandGeoTiff (sqlite3_context * context, int argc,
			   sqlite3_value ** argv)
{
/* SQL function:
/ WriteMonoBandGeoTiff(text coverage, text geotiff_path, int width,

/              int height, int mono_band, BLOB geom, double resolution)
/ WriteMonoBandGeoTiff(text coverage, text geotiff_path, int width,

/              int height, int mono_band, BLOB geom, double horz_res,
/              double vert_res)
/ WriteMonoBandGeoTiff(text coverage, text geotiff_path, int width,

/              int height, int mono_band, BLOB geom, double horz_res,
/              double vert_res, int with_worldfile)
/ WriteMonoBandGeoTiff(text coverage, text geotiff_path, int width,

/              int height, int mono_band, BLOB geom, double horz_res,
/              double vert_res, int with_worldfile, text compression)

/ WriteMonoBandGeoTiff(text coverage, text geotiff_path, int width,

/              int height, int mono_band, BLOB geom, double horz_res,
/              double vert_res, int with_worldfile, text compression,


























/              int tile_sz)










/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/









    int err = 0;
    const char *cvg_name;

    const char *path;
    int width;
    int height;
    int mono_band;
    const unsigned char *blob;
    int blob_sz;
    double horz_res;
................................................................................
    gaiaGeomCollPtr geom;
    double minx;
    double maxx;
    double miny;
    double maxy;
    RL2_UNUSED ();		/* LCOV_EXCL_LINE */




    if (sqlite3_value_type (argv[0]) != SQLITE_TEXT)
	err = 1;






























    if (sqlite3_value_type (argv[1]) != SQLITE_TEXT)
	err = 1;
    if (sqlite3_value_type (argv[2]) != SQLITE_INTEGER)
	err = 1;
    if (sqlite3_value_type (argv[3]) != SQLITE_INTEGER)
	err = 1;
    if (sqlite3_value_type (argv[4]) != SQLITE_INTEGER)
	err = 1;
    if (sqlite3_value_type (argv[5]) != SQLITE_BLOB)
	err = 1;
    if (sqlite3_value_type (argv[6]) != SQLITE_INTEGER
	&& sqlite3_value_type (argv[6]) != SQLITE_FLOAT)
	err = 1;
    if (argc > 7 && sqlite3_value_type (argv[7]) != SQLITE_INTEGER
	&& sqlite3_value_type (argv[7]) != SQLITE_FLOAT)
	err = 1;
    if (argc > 8 && sqlite3_value_type (argv[8]) != SQLITE_INTEGER)
	err = 1;
    if (argc > 9 && sqlite3_value_type (argv[9]) != SQLITE_TEXT)
	err = 1;
    if (argc > 10 && sqlite3_value_type (argv[10]) != SQLITE_INTEGER)
	err = 1;

    if (err)
      {
	  sqlite3_result_int (context, -1);
	  return;
      }

/* retrieving all arguments */



    cvg_name = (const char *) sqlite3_value_text (argv[0]);





















































    path = (const char *) sqlite3_value_text (argv[1]);
    width = sqlite3_value_int (argv[2]);
    height = sqlite3_value_int (argv[3]);
    mono_band = sqlite3_value_int (argv[4]);
    blob = sqlite3_value_blob (argv[5]);
    blob_sz = sqlite3_value_bytes (argv[5]);
    if (sqlite3_value_type (argv[6]) == SQLITE_INTEGER)
      {
	  int ival = sqlite3_value_int (argv[6]);
	  horz_res = ival;
      }
    else
	horz_res = sqlite3_value_double (argv[6]);
    if (argc > 7)
      {
	  if (sqlite3_value_type (argv[7]) == SQLITE_INTEGER)
	    {
		int ival = sqlite3_value_int (argv[7]);
		vert_res = ival;
	    }
	  else
	      vert_res = sqlite3_value_double (argv[7]);
      }
    else
	vert_res = horz_res;
    if (argc > 8)
	worldfile = sqlite3_value_int (argv[8]);
    if (argc > 9)
      {
	  const char *compr = (const char *) sqlite3_value_text (argv[9]);
	  compression = RL2_COMPRESSION_UNKNOWN;
	  if (strcasecmp (compr, "NONE") == 0)
	      compression = RL2_COMPRESSION_NONE;
	  if (strcasecmp (compr, "DEFLATE") == 0)
	      compression = RL2_COMPRESSION_DEFLATE;
	  if (strcasecmp (compr, "LZW") == 0)
	      compression = RL2_COMPRESSION_LZW;
	  if (strcasecmp (compr, "JPEG") == 0)
	      compression = RL2_COMPRESSION_JPEG;
	  if (strcasecmp (compr, "FAX3") == 0)
	      compression = RL2_COMPRESSION_CCITTFAX3;
	  if (strcasecmp (compr, "FAX4") == 0)
	      compression = RL2_COMPRESSION_CCITTFAX4;
      }
    if (argc > 10)
	tile_sz = sqlite3_value_int (argv[10]);


/* excluding any Mixed Resolution Coverage */
    sqlite = sqlite3_context_db_handle (context);
    if (rl2_is_mixed_resolutions_coverage (sqlite, cvg_name) > 0)
	goto error;

/* coarse args validation */
................................................................................
    coverage = rl2_create_coverage_from_dbms (sqlite, cvg_name);
    if (coverage == NULL)
      {
	  sqlite3_result_int (context, -1);
	  return;
      }




    ret =
















	rl2_export_mono_band_geotiff_from_dbms (sqlite, path, coverage,
						horz_res, vert_res, minx,
						miny, maxx, maxy, width,
						height, mono_band,
						compression, tile_sz,
						worldfile);


    if (ret != RL2_OK)
      {
	  errcode = 0;
	  goto error;
      }
    rl2_destroy_coverage (coverage);
    sqlite3_result_int (context, 1);
................................................................................
    return;

  error:
    if (coverage != NULL)
	rl2_destroy_coverage (coverage);
    sqlite3_result_int (context, errcode);
}




























































static void
common_write_tiff (int by_section, int with_worldfile,
		   sqlite3_context * context, int argc, sqlite3_value ** argv)
{
/* common implementation Write TIFF */
    int err = 0;
    const char *cvg_name;
    const char *path;
    sqlite3_int64 section_id;
    int width;
    int height;
    const unsigned char *blob;
    int blob_sz;
    double horz_res;
    double vert_res;
    unsigned char compression = RL2_COMPRESSION_NONE;
................................................................................
common_write_jpeg (int with_worldfile, int by_section,
		   sqlite3_context * context, int argc, sqlite3_value ** argv)
{
/* common implementation for Write JPEG */
    int err = 0;
    const char *cvg_name;
    const char *path;
    sqlite3_int64 section_id;
    int width;
    int height;
    const unsigned char *blob;
    int blob_sz;
    double horz_res;
    double vert_res;
    int quality = 80;
................................................................................
/ or -1 (INVALID ARGS)
/
*/
    common_write_jpeg (0, 1, context, argc, argv);
}

static void
common_write_triple_band_tiff (int with_worldfile, sqlite3_context * context,

			       int argc, sqlite3_value ** argv)
{
/* SQL function:
/ WriteTripleBandTiff?(text coverage, text tiff_path, int width,
/            int height, int red_band, int green_band, int blue_band,
/            BLOB geom, double resolution)
/ WriteTripleBandTiff?(text coverage, text tiff_path, int width,
/            int height, int red_band, int green_band, int blue_band,
/            BLOB geom, double horz_res, double vert_res)
/ WriteTripleBandTiff?(text coverage, text tiff_path, int width,
/            int height, int red_band, int green_band, int blue_band,
/            BLOB geom, double horz_res, double vert_res,
/            text compression)
/ WriteTripleBandTiff?(text coverage, text tiff_path, int width,
/            int height, int red_band, int green_band, int blue_band, 
/            BLOB geom, double horz_res, double vert_res,
/            text compression, int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    int err = 0;
    const char *cvg_name;

    const char *path;
    int width;
    int height;
    int red_band;
    int green_band;
    int blue_band;
    const unsigned char *blob;
................................................................................
    gaiaGeomCollPtr geom;
    double minx;
    double maxx;
    double miny;
    double maxy;
    RL2_UNUSED ();		/* LCOV_EXCL_LINE */




    if (sqlite3_value_type (argv[0]) != SQLITE_TEXT)
	err = 1;
































    if (sqlite3_value_type (argv[1]) != SQLITE_TEXT)
	err = 1;
    if (sqlite3_value_type (argv[2]) != SQLITE_INTEGER)
	err = 1;
    if (sqlite3_value_type (argv[3]) != SQLITE_INTEGER)
	err = 1;
    if (sqlite3_value_type (argv[4]) != SQLITE_INTEGER)
	err = 1;
    if (sqlite3_value_type (argv[5]) != SQLITE_INTEGER)
	err = 1;
    if (sqlite3_value_type (argv[6]) != SQLITE_INTEGER)
	err = 1;
    if (sqlite3_value_type (argv[7]) != SQLITE_BLOB)
	err = 1;
    if (sqlite3_value_type (argv[8]) != SQLITE_INTEGER
	&& sqlite3_value_type (argv[8]) != SQLITE_FLOAT)
	err = 1;
    if (argc > 9 && sqlite3_value_type (argv[9]) != SQLITE_INTEGER
	&& sqlite3_value_type (argv[9]) != SQLITE_FLOAT)
	err = 1;
    if (argc > 10 && sqlite3_value_type (argv[10]) != SQLITE_TEXT)
	err = 1;
    if (argc > 11 && sqlite3_value_type (argv[11]) != SQLITE_INTEGER)
	err = 1;

    if (err)
      {
	  sqlite3_result_int (context, -1);
	  return;
      }

/* retrieving all arguments */



    cvg_name = (const char *) sqlite3_value_text (argv[0]);

    path = (const char *) sqlite3_value_text (argv[1]);
    width = sqlite3_value_int (argv[2]);
    height = sqlite3_value_int (argv[3]);
    red_band = sqlite3_value_int (argv[4]);
    green_band = sqlite3_value_int (argv[5]);
    blue_band = sqlite3_value_int (argv[6]);
    blob = sqlite3_value_blob (argv[7]);
    blob_sz = sqlite3_value_bytes (argv[7]);
    if (sqlite3_value_type (argv[8]) == SQLITE_INTEGER)
      {
	  int ival = sqlite3_value_int (argv[8]);
	  horz_res = ival;
      }
    else
	horz_res = sqlite3_value_double (argv[8]);
    if (argc > 9)
      {
	  if (sqlite3_value_type (argv[9]) == SQLITE_INTEGER)
	    {
		int ival = sqlite3_value_int (argv[9]);









		vert_res = ival;
	    }
	  else




















































	      vert_res = sqlite3_value_double (argv[9]);
      }
    else
	vert_res = horz_res;
    if (argc > 10)
      {

	  const char *compr = (const char *) sqlite3_value_text (argv[10]);
	  compression = RL2_COMPRESSION_UNKNOWN;
	  if (strcasecmp (compr, "NONE") == 0)
	      compression = RL2_COMPRESSION_NONE;
	  if (strcasecmp (compr, "DEFLATE") == 0)
	      compression = RL2_COMPRESSION_DEFLATE;
	  if (strcasecmp (compr, "LZW") == 0)
	      compression = RL2_COMPRESSION_LZW;
	  if (strcasecmp (compr, "JPEG") == 0)
	      compression = RL2_COMPRESSION_JPEG;
	  if (strcasecmp (compr, "FAX3") == 0)
	      compression = RL2_COMPRESSION_CCITTFAX3;
	  if (strcasecmp (compr, "FAX4") == 0)
	      compression = RL2_COMPRESSION_CCITTFAX4;
      }
    if (argc > 11)
	tile_sz = sqlite3_value_int (argv[11]);


/* coarse args validation */
    if (width < 0 || width > UINT16_MAX)
      {
	  errcode = -1;
	  goto error;
      }
................................................................................
    coverage = rl2_create_coverage_from_dbms (sqlite, cvg_name);
    if (coverage == NULL)
      {
	  sqlite3_result_int (context, -1);
	  return;
      }




    if (with_worldfile)
      {
	  /* TIFF + Worldfile */
	  ret =
































	      rl2_export_triple_band_tiff_worldfile_from_dbms (sqlite, path,

							       coverage,
							       horz_res,
							       vert_res, minx,
							       miny, maxx,

							       maxy, width,
							       height,
							       red_band,
							       green_band,
							       blue_band,
							       compression,
							       tile_sz);
      }
    else
      {
	  /* plain TIFF, no Worldfile */
	  ret =
	      rl2_export_triple_band_tiff_from_dbms (sqlite, path, coverage,

						     horz_res, vert_res, minx,
						     miny, maxx, maxy, width,
						     height, red_band,
						     green_band, blue_band,

						     compression, tile_sz);


      }
    if (ret != RL2_OK)
      {
	  errcode = 0;
	  goto error;
      }
    rl2_destroy_coverage (coverage);
................................................................................
/              BLOB geom, double horz_res, double vert_res, 
/              text compression, int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    common_write_triple_band_tiff (1, context, argc, argv);
}

static void
fnct_WriteTripleBandTiff (sqlite3_context * context, int argc,
			  sqlite3_value ** argv)
{
/* SQL function:


























































/ WriteTripleBandTiff(text coverage, text tiff_path, int width,
/           int height, int red_band, int green_band, int blue_band,
/           BLOB geom, double resolution)
/ WriteTripleBandTiff(text coverage, text tiff_path, int width,
/           int height, int red_band, int green_band, int blue_band,
/           BLOB geom, double horz_res, double vert_res)
/ WriteTripleBandTiff(text coverage, text tiff_path, int width,
/           int height, int red_band, int green_band, int blue_band,
/           BLOB geom, double horz_res, double vert_res,
/           text compression)
/ WriteTripleBandTiff(text coverage, text tiff_path, int width,
/           int height, int red_band, int green_band, int blue_band,
/           BLOB geom, double horz_res, double vert_res,
/           text compression, int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    common_write_triple_band_tiff (0, context, argc, argv);
}

static void
common_write_mono_band_tiff (int with_worldfile, sqlite3_context * context,

			     int argc, sqlite3_value ** argv)
{
/* SQL function:
/ WriteMonoBandTiff?(text coverage, text tiff_path, int width,
/            int height, int mono_band, BLOB geom, double resolution)
/ WriteMonoBandTiff?(text coverage, text tiff_path, int width,
/            int height, int mono_band, BLOB geom, double horz_res,
/            double vert_res)
/ WriteMonoBandTiff?(text coverage, text tiff_path, int width,
/            int height, int mono_band, BLOB geom, double horz_res,
/            double vert_res, text compression)
/ WriteMonoBandTiff?(text coverage, text tiff_path, int width,
/            int height, int mono_band, BLOB geom, double horz_res,
/            double vert_res, text compression, int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    int err = 0;
    const char *cvg_name;

    const char *path;
    int width;
    int height;
    int mono_band;
    const unsigned char *blob;
    int blob_sz;
    double horz_res;
................................................................................
    gaiaGeomCollPtr geom;
    double minx;
    double maxx;
    double miny;
    double maxy;
    RL2_UNUSED ();		/* LCOV_EXCL_LINE */




    if (sqlite3_value_type (argv[0]) != SQLITE_TEXT)
	err = 1;




























    if (sqlite3_value_type (argv[1]) != SQLITE_TEXT)
	err = 1;
    if (sqlite3_value_type (argv[2]) != SQLITE_INTEGER)
	err = 1;
    if (sqlite3_value_type (argv[3]) != SQLITE_INTEGER)
	err = 1;
    if (sqlite3_value_type (argv[4]) != SQLITE_INTEGER)
	err = 1;
    if (sqlite3_value_type (argv[5]) != SQLITE_BLOB)
	err = 1;
    if (sqlite3_value_type (argv[6]) != SQLITE_INTEGER
	&& sqlite3_value_type (argv[6]) != SQLITE_FLOAT)
	err = 1;
    if (argc > 7 && sqlite3_value_type (argv[7]) != SQLITE_INTEGER
	&& sqlite3_value_type (argv[7]) != SQLITE_FLOAT)
	err = 1;
    if (argc > 8 && sqlite3_value_type (argv[8]) != SQLITE_TEXT)
	err = 1;
    if (argc > 9 && sqlite3_value_type (argv[9]) != SQLITE_INTEGER)
	err = 1;

    if (err)
      {
	  sqlite3_result_int (context, -1);
	  return;
      }

/* retrieving all arguments */



    cvg_name = (const char *) sqlite3_value_text (argv[0]);


















































    path = (const char *) sqlite3_value_text (argv[1]);
    width = sqlite3_value_int (argv[2]);
    height = sqlite3_value_int (argv[3]);
    mono_band = sqlite3_value_int (argv[4]);
    blob = sqlite3_value_blob (argv[5]);
    blob_sz = sqlite3_value_bytes (argv[5]);
    if (sqlite3_value_type (argv[6]) == SQLITE_INTEGER)
      {
	  int ival = sqlite3_value_int (argv[6]);
	  horz_res = ival;
      }
    else
	horz_res = sqlite3_value_double (argv[6]);
    if (argc > 7)
      {
	  if (sqlite3_value_type (argv[7]) == SQLITE_INTEGER)
	    {
		int ival = sqlite3_value_int (argv[7]);
		vert_res = ival;
	    }
	  else
	      vert_res = sqlite3_value_double (argv[7]);
      }
    else
	vert_res = horz_res;
    if (argc > 8)
      {
	  const char *compr = (const char *) sqlite3_value_text (argv[8]);
	  compression = RL2_COMPRESSION_UNKNOWN;
	  if (strcasecmp (compr, "NONE") == 0)
	      compression = RL2_COMPRESSION_NONE;
	  if (strcasecmp (compr, "DEFLATE") == 0)
	      compression = RL2_COMPRESSION_DEFLATE;
	  if (strcasecmp (compr, "LZW") == 0)
	      compression = RL2_COMPRESSION_LZW;
	  if (strcasecmp (compr, "JPEG") == 0)
	      compression = RL2_COMPRESSION_JPEG;
	  if (strcasecmp (compr, "FAX3") == 0)
	      compression = RL2_COMPRESSION_CCITTFAX3;
	  if (strcasecmp (compr, "FAX4") == 0)
	      compression = RL2_COMPRESSION_CCITTFAX4;
      }
    if (argc > 9)
	tile_sz = sqlite3_value_int (argv[9]);


/* coarse args validation */
    if (width < 0 || width > UINT16_MAX)
      {
	  errcode = -1;
	  goto error;
      }
................................................................................
    coverage = rl2_create_coverage_from_dbms (sqlite, cvg_name);
    if (coverage == NULL)
      {
	  sqlite3_result_int (context, -1);
	  return;
      }




    if (with_worldfile)
      {
	  /* TIFF + Worldfile */
	  ret =
	      rl2_export_mono_band_tiff_worldfile_from_dbms (sqlite, path,









							     coverage,

							     horz_res,
							     vert_res, minx,
							     miny, maxx,
							     maxy, width,
							     height,
							     mono_band,
							     compression,
							     tile_sz);
      }

    else
      {



















	  /* plain TIFF, no Worldfile */
	  ret =
	      rl2_export_mono_band_tiff_from_dbms (sqlite, path, coverage,
						   horz_res, vert_res, minx,
						   miny, maxx, maxy, width,

						   height, mono_band,
						   compression, tile_sz);

      }
    if (ret != RL2_OK)
      {
	  errcode = 0;
	  goto error;
      }
    rl2_destroy_coverage (coverage);
................................................................................
/              int height, int mono_band, BLOB geom, double horz_res,
/              double vert_res, text compression, int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    common_write_mono_band_tiff (1, context, argc, argv);
}

static void
fnct_WriteMonoBandTiff (sqlite3_context * context, int argc,
			sqlite3_value ** argv)
{
/* SQL function:
................................................................................
/           int height, int mono_band, BLOB geom, double horz_res,
/           double vert_res, text compression, int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    common_write_mono_band_tiff (0, context, argc, argv);






















































}

static void
common_write_ascii_grid (int by_section, sqlite3_context * context, int argc,
			 sqlite3_value ** argv)
{
/* common export ASCII Grid implementation */
    int err = 0;
    const char *cvg_name;
    const char *path;
    sqlite3_int64 section_id;
    int width;
    int height;
    const unsigned char *blob;
    int blob_sz;
    double resolution;
    rl2CoveragePtr coverage = NULL;
    sqlite3 *sqlite;
................................................................................
    char *xtable_tile_data;
    char *table_tiles;
    char *xtable_tiles;
    char *sql;
    int ret;
    const unsigned char *blob_odd = NULL;
    const unsigned char *blob_even = NULL;
    int blob_odd_sz;
    int blob_even_sz;
    rl2RasterPtr raster = NULL;
    rl2PrivRasterPtr rst;
    rl2PalettePtr palette = NULL;
    unsigned char *buffer = NULL;
    unsigned char *mask = NULL;
    unsigned char *rgba = NULL;
    unsigned char *p_rgba;
................................................................................
    char *xtable_tile_data;
    char *table_tiles;
    char *xtable_tiles;
    char *sql;
    int ret;
    const unsigned char *blob_odd = NULL;
    const unsigned char *blob_even = NULL;
    int blob_odd_sz;
    int blob_even_sz;
    rl2RasterPtr raster = NULL;
    rl2PrivRasterPtr rst;
    unsigned char *buffer = NULL;
    unsigned char *mask = NULL;
    unsigned char *rgba = NULL;
    unsigned char *p_rgba;
    unsigned short row;
................................................................................
				   SQLITE_ANY, 0, fnct_WriteTripleBandGeoTiff,
				   0, 0);
	  sqlite3_create_function (db, "WriteTripleBandGeoTiff", 13, SQLITE_ANY,
				   0, fnct_WriteTripleBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteTripleBandGeoTiff", 13,
				   SQLITE_ANY, 0, fnct_WriteTripleBandGeoTiff,
				   0, 0);






























	  sqlite3_create_function (db, "WriteMonoBandGeoTiff", 7, SQLITE_ANY, 0,
				   fnct_WriteMonoBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteMonoBandGeoTiff", 7,
				   SQLITE_ANY, 0, fnct_WriteMonoBandGeoTiff, 0,
				   0);
	  sqlite3_create_function (db, "WriteMonoBandGeoTiff", 8, SQLITE_ANY, 0,
				   fnct_WriteMonoBandGeoTiff, 0, 0);
................................................................................
				   SQLITE_ANY, 0, fnct_WriteMonoBandGeoTiff, 0,
				   0);
	  sqlite3_create_function (db, "WriteMonoBandGeoTiff", 11, SQLITE_ANY,
				   0, fnct_WriteMonoBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteMonoBandGeoTiff", 11,
				   SQLITE_ANY, 0, fnct_WriteMonoBandGeoTiff, 0,
				   0);






























	  sqlite3_create_function (db, "WriteTripleBandTiffTfw", 9, SQLITE_ANY,
				   0, fnct_WriteTripleBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteTripleBandTiffTfw", 9,
				   SQLITE_ANY, 0, fnct_WriteTripleBandTiffTfw,
				   0, 0);
	  sqlite3_create_function (db, "WriteTripleBandTiffTfw", 10, SQLITE_ANY,
				   0, fnct_WriteTripleBandTiffTfw, 0, 0);
................................................................................
				   SQLITE_ANY, 0, fnct_WriteTripleBandTiffTfw,
				   0, 0);
	  sqlite3_create_function (db, "WriteTripleBandTiffTfw", 12, SQLITE_ANY,
				   0, fnct_WriteTripleBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteTripleBandTiffTfw", 12,
				   SQLITE_ANY, 0, fnct_WriteTripleBandTiffTfw,
				   0, 0);
















































	  sqlite3_create_function (db, "WriteMonoBandTiffTfw", 7, SQLITE_ANY, 0,

				   fnct_WriteMonoBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteMonoBandTiffTfw", 7,

				   SQLITE_ANY, 0, fnct_WriteMonoBandTiffTfw, 0,
				   0);
	  sqlite3_create_function (db, "WriteMonoBandTiffTfw", 8, SQLITE_ANY, 0,

				   fnct_WriteMonoBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteMonoBandTiffTfw", 8,
				   SQLITE_ANY, 0, fnct_WriteMonoBandTiffTfw, 0,
				   0);
	  sqlite3_create_function (db, "WriteMonoBandTiffTfw", 9, SQLITE_ANY, 0,
				   fnct_WriteMonoBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteMonoBandTiffTfw", 9,
................................................................................
				   SQLITE_ANY, 0, fnct_WriteTripleBandTiff, 0,
				   0);
	  sqlite3_create_function (db, "WriteTripleBandTiff", 12, SQLITE_ANY, 0,
				   fnct_WriteTripleBandTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteTripleBandTiff", 12,
				   SQLITE_ANY, 0, fnct_WriteTripleBandTiff, 0,
				   0);
























	  sqlite3_create_function (db, "WriteMonoBandTiff", 7, SQLITE_ANY, 0,
				   fnct_WriteMonoBandTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteMonoBandTiff", 7, SQLITE_ANY,
				   0, fnct_WriteMonoBandTiff, 0, 0);
	  sqlite3_create_function (db, "WriteMonoBandTiff", 8, SQLITE_ANY, 0,
				   fnct_WriteMonoBandTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteMonoBandTiff", 8, SQLITE_ANY,
................................................................................
				   fnct_WriteMonoBandTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteMonoBandTiff", 9, SQLITE_ANY,
				   0, fnct_WriteMonoBandTiff, 0, 0);
	  sqlite3_create_function (db, "WriteMonoBandTiff", 10, SQLITE_ANY, 0,
				   fnct_WriteMonoBandTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteMonoBandTiff", 10, SQLITE_ANY,
				   0, fnct_WriteMonoBandTiff, 0, 0);
























	  sqlite3_create_function (db, "WriteAsciiGrid", 6, SQLITE_ANY, 0,
				   fnct_WriteAsciiGrid, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteAsciiGrid", 6, SQLITE_ANY, 0,
				   fnct_WriteAsciiGrid, 0, 0);
	  sqlite3_create_function (db, "WriteAsciiGrid", 7, SQLITE_ANY, 0,
				   fnct_WriteAsciiGrid, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteAsciiGrid", 7, SQLITE_ANY, 0,







|
|







 







|







 







|







 







|







 







|
|







 







|







 







|







 







|
|

<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


>







 







>
>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>







>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>







 







>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
>







 







|
|


|
>
|
|
>
|
|
|
>
|
|
|
>
|
|
>
|
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>





>
>
>
>
>
>
>
>
>


>







 







>
>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>







>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>







 







>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>









|







 







|







 







|
>
|

<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


>







 







>
>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>







>
>
>
|
>
|
|
|
|
|
|
|
|
<
<
<
<
<
<
<
<
<



>
>
>
>
>
>
>
>
>
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>







 







>
>
>
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
>
|
>
>







 







|







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|


|


|



|








|



|
>
|

<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


>







 







>
>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>







>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>







 







>
>
>
|
|
|
|
|
>
>
>
>
>
>
>
>
>
|
>
|
|
|
|
|
|
|
|
|
>


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
>
|
|
>







 







|







 







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>










|







 







|
|







 







|
|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>


>
|
<
|
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
....
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
....
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
....
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
....
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
....
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
....
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
....
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733

3734






















3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
....
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
....
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
....
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
....
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
....
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
....
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
....
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
....
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247

5248


















5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
....
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356









5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
....
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
....
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728

5729















5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
....
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
....
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
....
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
....
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
....
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
....
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
....
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
....
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
....
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393

8394
8395
8396
8397
8398
8399
8400
8401
8402
....
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
....
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
*/
    unsigned char *blob = NULL;
    int blob_sz = 0;
    rl2PixelPtr pxl = NULL;
    rl2PrivPixelPtr pixel;
    rl2PrivSamplePtr sample;
    int band_id;
    int intval = 0;
    double dblval = 0.0;
    RL2_UNUSED ();		/* LCOV_EXCL_LINE */

    if (sqlite3_value_type (argv[0]) != SQLITE_BLOB)
	goto error;
    if (sqlite3_value_type (argv[1]) != SQLITE_INTEGER)
	goto error;
    if (sqlite3_value_type (argv[2]) != SQLITE_INTEGER
................................................................................
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    int err = 0;
    const char *cvg_name;
    const char *path;
    const char *file_ext = NULL;
    int worldfile = 0;
    int force_srid = -1;
    int transaction = 1;
    int pyramidize = 1;
    rl2CoveragePtr coverage = NULL;
    sqlite3 *sqlite;
    int ret;
................................................................................
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    int err = 0;
    const char *cvg_name;
    sqlite3_int64 section_id = 0;
    int null_id = 1;
    int forced_rebuild = 0;
    int transaction = 1;
    sqlite3 *sqlite;
    int ret;
    RL2_UNUSED ();		/* LCOV_EXCL_LINE */

................................................................................
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    int err = 0;
    const char *cvg_name;
    sqlite3_int64 section_id = 0;
    int null_id = 1;
    int transaction = 1;
    sqlite3 *sqlite;
    int ret;
    RL2_UNUSED ();		/* LCOV_EXCL_LINE */

    if (sqlite3_value_type (argv[0]) != SQLITE_TEXT)
................................................................................
    gaiaGeomCollPtr geom;
    rl2CoveragePtr coverage = NULL;
    rl2PrivCoveragePtr cvg;
    rl2RasterStatisticsPtr section_stats = NULL;
    sqlite3 *sqlite;
    int ret;
    int n;
    double x = 0.0;
    double y = 0.0;
    double tilew;
    double tileh;
    unsigned int tile_width;
    unsigned int tile_height;
    WmsRetryListPtr retry_list = NULL;
    char *table;
    char *xtable;
................................................................................
    sqlite3_stmt *stmt_levl = NULL;
    sqlite3_stmt *stmt_upd_sect = NULL;
    int first = 1;
    double ext_x;
    double ext_y;
    unsigned int width;
    unsigned int height;
    sqlite3_int64 section_id = 0;
    rl2PixelPtr no_data = NULL;
    unsigned char sample_type;
    unsigned char pixel_type;
    unsigned char num_bands;
    unsigned char compression;
    int quality;
    InsertWms params;
................................................................................
common_write_geotiff (int by_section, sqlite3_context * context, int argc,
		      sqlite3_value ** argv)
{
/* common implementation for Write GeoTIFF */
    int err = 0;
    const char *cvg_name;
    const char *path;
    sqlite3_int64 section_id = 0;
    int width;
    int height;
    const unsigned char *blob;
    int blob_sz;
    double horz_res;
    double vert_res;
    int worldfile = 0;
................................................................................
/ or -1 (INVALID ARGS)
/
*/
    common_write_geotiff (1, context, argc, argv);
}

static void
common_write_triple_band_geotiff (int by_section, sqlite3_context * context,
				  int argc, sqlite3_value ** argv)
{

/* common implementation WriteTripleBandGeoTiff */






















    int err = 0;
    const char *cvg_name;
    sqlite3_int64 section_id = 0;
    const char *path;
    int width;
    int height;
    int red_band;
    int green_band;
    int blue_band;
    const unsigned char *blob;
................................................................................
    gaiaGeomCollPtr geom;
    double minx;
    double maxx;
    double miny;
    double maxy;
    RL2_UNUSED ();		/* LCOV_EXCL_LINE */

    if (by_section)
      {
	  /* single Section */
	  if (sqlite3_value_type (argv[0]) != SQLITE_TEXT)
	      err = 1;
	  if (sqlite3_value_type (argv[1]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[2]) != SQLITE_TEXT)
	      err = 1;
	  if (sqlite3_value_type (argv[3]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[4]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[5]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[6]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[7]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[8]) != SQLITE_BLOB)
	      err = 1;
	  if (sqlite3_value_type (argv[9]) != SQLITE_INTEGER
	      && sqlite3_value_type (argv[9]) != SQLITE_FLOAT)
	      err = 1;
	  if (argc > 10 && sqlite3_value_type (argv[10]) != SQLITE_INTEGER
	      && sqlite3_value_type (argv[10]) != SQLITE_FLOAT)
	      err = 1;
	  if (argc > 11 && sqlite3_value_type (argv[11]) != SQLITE_INTEGER)
	      err = 1;
	  if (argc > 12 && sqlite3_value_type (argv[12]) != SQLITE_TEXT)
	      err = 1;
	  if (argc > 13 && sqlite3_value_type (argv[13]) != SQLITE_INTEGER)
	      err = 1;
      }
    else
      {
	  /* whole Coverage */
	  if (sqlite3_value_type (argv[0]) != SQLITE_TEXT)
	      err = 1;
	  if (sqlite3_value_type (argv[1]) != SQLITE_TEXT)
	      err = 1;
	  if (sqlite3_value_type (argv[2]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[3]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[4]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[5]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[6]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[7]) != SQLITE_BLOB)
	      err = 1;
	  if (sqlite3_value_type (argv[8]) != SQLITE_INTEGER
	      && sqlite3_value_type (argv[8]) != SQLITE_FLOAT)
	      err = 1;
	  if (argc > 9 && sqlite3_value_type (argv[9]) != SQLITE_INTEGER
	      && sqlite3_value_type (argv[9]) != SQLITE_FLOAT)
	      err = 1;
	  if (argc > 10 && sqlite3_value_type (argv[10]) != SQLITE_INTEGER)
	      err = 1;
	  if (argc > 11 && sqlite3_value_type (argv[11]) != SQLITE_TEXT)
	      err = 1;
	  if (argc > 12 && sqlite3_value_type (argv[12]) != SQLITE_INTEGER)
	      err = 1;
      }
    if (err)
      {
	  sqlite3_result_int (context, -1);
	  return;
      }

/* retrieving all arguments */
    if (by_section)
      {
	  /* single Section */
	  cvg_name = (const char *) sqlite3_value_text (argv[0]);
	  section_id = sqlite3_value_int64 (argv[1]);
	  path = (const char *) sqlite3_value_text (argv[2]);
	  width = sqlite3_value_int (argv[3]);
	  height = sqlite3_value_int (argv[4]);
	  red_band = sqlite3_value_int (argv[5]);
	  green_band = sqlite3_value_int (argv[6]);
	  blue_band = sqlite3_value_int (argv[7]);
	  blob = sqlite3_value_blob (argv[8]);
	  blob_sz = sqlite3_value_bytes (argv[8]);
	  if (sqlite3_value_type (argv[9]) == SQLITE_INTEGER)
	    {
		int ival = sqlite3_value_int (argv[9]);
		horz_res = ival;
	    }
	  else
	      horz_res = sqlite3_value_double (argv[9]);
	  if (argc > 10)
	    {
		if (sqlite3_value_type (argv[10]) == SQLITE_INTEGER)
		  {
		      int ival = sqlite3_value_int (argv[10]);
		      vert_res = ival;
		  }
		else
		    vert_res = sqlite3_value_double (argv[10]);
	    }
	  else
	      vert_res = horz_res;
	  if (argc > 11)
	      worldfile = sqlite3_value_int (argv[11]);
	  if (argc > 12)
	    {
		const char *compr =
		    (const char *) sqlite3_value_text (argv[12]);
		compression = RL2_COMPRESSION_UNKNOWN;
		if (strcasecmp (compr, "NONE") == 0)
		    compression = RL2_COMPRESSION_NONE;
		if (strcasecmp (compr, "DEFLATE") == 0)
		    compression = RL2_COMPRESSION_DEFLATE;
		if (strcasecmp (compr, "LZW") == 0)
		    compression = RL2_COMPRESSION_LZW;
		if (strcasecmp (compr, "JPEG") == 0)
		    compression = RL2_COMPRESSION_JPEG;
		if (strcasecmp (compr, "FAX3") == 0)
		    compression = RL2_COMPRESSION_CCITTFAX3;
		if (strcasecmp (compr, "FAX4") == 0)
		    compression = RL2_COMPRESSION_CCITTFAX4;
	    }
	  if (argc > 13)
	      tile_sz = sqlite3_value_int (argv[13]);
      }
    else
      {
	  /* whole Coverage */
	  cvg_name = (const char *) sqlite3_value_text (argv[0]);
	  path = (const char *) sqlite3_value_text (argv[1]);
	  width = sqlite3_value_int (argv[2]);
	  height = sqlite3_value_int (argv[3]);
	  red_band = sqlite3_value_int (argv[4]);
	  green_band = sqlite3_value_int (argv[5]);
	  blue_band = sqlite3_value_int (argv[6]);
	  blob = sqlite3_value_blob (argv[7]);
	  blob_sz = sqlite3_value_bytes (argv[7]);
	  if (sqlite3_value_type (argv[8]) == SQLITE_INTEGER)
	    {
		int ival = sqlite3_value_int (argv[8]);
		horz_res = ival;
	    }
	  else
	      horz_res = sqlite3_value_double (argv[8]);
	  if (argc > 9)
	    {
		if (sqlite3_value_type (argv[9]) == SQLITE_INTEGER)
		  {
		      int ival = sqlite3_value_int (argv[9]);
		      vert_res = ival;
		  }
		else
		    vert_res = sqlite3_value_double (argv[9]);
	    }
	  else
	      vert_res = horz_res;
	  if (argc > 10)
	      worldfile = sqlite3_value_int (argv[10]);
	  if (argc > 11)
	    {
		const char *compr =
		    (const char *) sqlite3_value_text (argv[11]);
		compression = RL2_COMPRESSION_UNKNOWN;
		if (strcasecmp (compr, "NONE") == 0)
		    compression = RL2_COMPRESSION_NONE;
		if (strcasecmp (compr, "DEFLATE") == 0)
		    compression = RL2_COMPRESSION_DEFLATE;
		if (strcasecmp (compr, "LZW") == 0)
		    compression = RL2_COMPRESSION_LZW;
		if (strcasecmp (compr, "JPEG") == 0)
		    compression = RL2_COMPRESSION_JPEG;
		if (strcasecmp (compr, "FAX3") == 0)
		    compression = RL2_COMPRESSION_CCITTFAX3;
		if (strcasecmp (compr, "FAX4") == 0)
		    compression = RL2_COMPRESSION_CCITTFAX4;
	    }
	  if (argc > 12)
	      tile_sz = sqlite3_value_int (argv[12]);
      }

/* excluding any Mixed Resolution Coverage */
    sqlite = sqlite3_context_db_handle (context);
    if (rl2_is_mixed_resolutions_coverage (sqlite, cvg_name) > 0)
	goto error;

/* coarse args validation */
................................................................................
    coverage = rl2_create_coverage_from_dbms (sqlite, cvg_name);
    if (coverage == NULL)
      {
	  sqlite3_result_int (context, -1);
	  return;
      }

    if (by_section)
      {
	  /* single Section */
	  ret =
	      rl2_export_section_triple_band_geotiff_from_dbms (sqlite, path,
								coverage,
								section_id,
								horz_res,
								vert_res, minx,
								miny, maxx,
								maxy, width,
								height,
								red_band,
								green_band,
								blue_band,
								compression,
								tile_sz,
								worldfile);
      }
    else
      {
	  /* whole Coverage */

	  ret =
	      rl2_export_triple_band_geotiff_from_dbms (sqlite, path, coverage,
							horz_res, vert_res,
							minx, miny, maxx, maxy,
							width, height, red_band,
							green_band, blue_band,
							compression, tile_sz,
							worldfile);
      }
    if (ret != RL2_OK)
      {
	  errcode = 0;
	  goto error;
      }
    rl2_destroy_coverage (coverage);
    sqlite3_result_int (context, 1);
................................................................................
  error:
    if (coverage != NULL)
	rl2_destroy_coverage (coverage);
    sqlite3_result_int (context, errcode);
}

static void
fnct_WriteTripleBandGeoTiff (sqlite3_context * context, int argc,
			     sqlite3_value ** argv)
{
/* SQL function:
/ WriteTripleBandGeoTiff(text coverage, text geotiff_path, int width,
/                        int height, int red_band, int green_band,
/                        int blue_band, BLOB geom, double resolution)
/ WriteTripleBandGeoTiff(text coverage, text geotiff_path, int width,
/                        int height, int red_band, int green_band,
/                        int blue_band, BLOB geom, double horz_res,
/                        double vert_res)
/ WriteTripleBandGeoTiff(text coverage, text geotiff_path, int width,
/                        int height, int red_band, int green_band,
/                        int blue_band, BLOB geom, double horz_res,
/                        double vert_res, int with_worldfile)
/ WriteTripleBandGeoTiff(text coverage, text geotiff_path, int width,
/                        int height, int red_band, int green_band, 
/                        int blue_band, BLOB geom, double horz_res,
/                        double vert_res, int with_worldfile, 
/                        text compression)
/ WriteTripleBandGeoTiff(text coverage, text geotiff_path, int width,
/                        int height, int red_band, int green_band,
/                        int blue_band, BLOB geom, double horz_res,
/                        double vert_res, int with_worldfile,
/                        text compression, int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    common_write_triple_band_geotiff (0, context, argc, argv);
}

static void
fnct_WriteSectionTripleBandGeoTiff (sqlite3_context * context, int argc,
				    sqlite3_value ** argv)
{
/* SQL function:
/ WriteSectionTripleBandGeoTiff(text coverage, int section_id, 
/                               text geotiff_path, int width, int height,
/                               int red_band, int green_band, int blue_band,
/                               BLOB geom, double resolution)
/ WriteSectionTripleBandGeoTiff(text coverage, int section_id, 
/                               text geotiff_path, int width, int height,
/                               int red_band, int green_band, int blue_band,
/                               BLOB geom, double horz_res, double vert_res)
/ WriteSectionTripleBandGeoTiff(text coverage, int section_id, 
/                               text geotiff_path, int width, int height,
/                               int red_band, int green_band, int blue_band,
/                               BLOB geom, double horz_res, double vert_res, 
/                               int with_worldfile)
/ WriteSectionTripleBandGeoTiff(text coverage, int section_id, 
/                               text geotiff_path, int width, int height,
/                               int red_band, int green_band, int blue_band, 
/                               BLOB geom, double horz_res, double vert_res, 
/                               int with_worldfile, text compression)
/ WriteSectionTripleBandGeoTiff(text coverage, int section_id,
/                               text geotiff_path, int width, int height,
/                               int red_band, int green_band, int blue_band, 
/                               BLOB geom, double horz_res, double vert_res, 
/                               int with_worldfile, text compression, int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    common_write_triple_band_geotiff (1, context, argc, argv);
}

static void
common_write_mono_band_geotiff (int by_section, sqlite3_context * context,
				int argc, sqlite3_value ** argv)
{
/* common implementation Write MonoBand GeoTiff
*/
    int err = 0;
    const char *cvg_name;
    sqlite3_int64 section_id = 0;
    const char *path;
    int width;
    int height;
    int mono_band;
    const unsigned char *blob;
    int blob_sz;
    double horz_res;
................................................................................
    gaiaGeomCollPtr geom;
    double minx;
    double maxx;
    double miny;
    double maxy;
    RL2_UNUSED ();		/* LCOV_EXCL_LINE */

    if (by_section)
      {
	  /* single Section */
	  if (sqlite3_value_type (argv[0]) != SQLITE_TEXT)
	      err = 1;
	  if (sqlite3_value_type (argv[1]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[2]) != SQLITE_TEXT)
	      err = 1;
	  if (sqlite3_value_type (argv[3]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[4]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[5]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[6]) != SQLITE_BLOB)
	      err = 1;
	  if (sqlite3_value_type (argv[7]) != SQLITE_INTEGER
	      && sqlite3_value_type (argv[7]) != SQLITE_FLOAT)
	      err = 1;
	  if (argc > 8 && sqlite3_value_type (argv[8]) != SQLITE_INTEGER
	      && sqlite3_value_type (argv[8]) != SQLITE_FLOAT)
	      err = 1;
	  if (argc > 9 && sqlite3_value_type (argv[9]) != SQLITE_INTEGER)
	      err = 1;
	  if (argc > 10 && sqlite3_value_type (argv[10]) != SQLITE_TEXT)
	      err = 1;
	  if (argc > 11 && sqlite3_value_type (argv[11]) != SQLITE_INTEGER)
	      err = 1;
      }
    else
      {
	  /* whole Coverage */
	  if (sqlite3_value_type (argv[0]) != SQLITE_TEXT)
	      err = 1;
	  if (sqlite3_value_type (argv[1]) != SQLITE_TEXT)
	      err = 1;
	  if (sqlite3_value_type (argv[2]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[3]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[4]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[5]) != SQLITE_BLOB)
	      err = 1;
	  if (sqlite3_value_type (argv[6]) != SQLITE_INTEGER
	      && sqlite3_value_type (argv[6]) != SQLITE_FLOAT)
	      err = 1;
	  if (argc > 7 && sqlite3_value_type (argv[7]) != SQLITE_INTEGER
	      && sqlite3_value_type (argv[7]) != SQLITE_FLOAT)
	      err = 1;
	  if (argc > 8 && sqlite3_value_type (argv[8]) != SQLITE_INTEGER)
	      err = 1;
	  if (argc > 9 && sqlite3_value_type (argv[9]) != SQLITE_TEXT)
	      err = 1;
	  if (argc > 10 && sqlite3_value_type (argv[10]) != SQLITE_INTEGER)
	      err = 1;
      }
    if (err)
      {
	  sqlite3_result_int (context, -1);
	  return;
      }

/* retrieving all arguments */
    if (by_section)
      {
	  /* single Section */
	  cvg_name = (const char *) sqlite3_value_text (argv[0]);
	  section_id = sqlite3_value_int64 (argv[1]);
	  path = (const char *) sqlite3_value_text (argv[2]);
	  width = sqlite3_value_int (argv[3]);
	  height = sqlite3_value_int (argv[4]);
	  mono_band = sqlite3_value_int (argv[5]);
	  blob = sqlite3_value_blob (argv[6]);
	  blob_sz = sqlite3_value_bytes (argv[6]);
	  if (sqlite3_value_type (argv[7]) == SQLITE_INTEGER)
	    {
		int ival = sqlite3_value_int (argv[7]);
		horz_res = ival;
	    }
	  else
	      horz_res = sqlite3_value_double (argv[7]);
	  if (argc > 8)
	    {
		if (sqlite3_value_type (argv[8]) == SQLITE_INTEGER)
		  {
		      int ival = sqlite3_value_int (argv[8]);
		      vert_res = ival;
		  }
		else
		    vert_res = sqlite3_value_double (argv[8]);
	    }
	  else
	      vert_res = horz_res;
	  if (argc > 9)
	      worldfile = sqlite3_value_int (argv[9]);
	  if (argc > 10)
	    {
		const char *compr =
		    (const char *) sqlite3_value_text (argv[10]);
		compression = RL2_COMPRESSION_UNKNOWN;
		if (strcasecmp (compr, "NONE") == 0)
		    compression = RL2_COMPRESSION_NONE;
		if (strcasecmp (compr, "DEFLATE") == 0)
		    compression = RL2_COMPRESSION_DEFLATE;
		if (strcasecmp (compr, "LZW") == 0)
		    compression = RL2_COMPRESSION_LZW;
		if (strcasecmp (compr, "JPEG") == 0)
		    compression = RL2_COMPRESSION_JPEG;
		if (strcasecmp (compr, "FAX3") == 0)
		    compression = RL2_COMPRESSION_CCITTFAX3;
		if (strcasecmp (compr, "FAX4") == 0)
		    compression = RL2_COMPRESSION_CCITTFAX4;
	    }
	  if (argc > 11)
	      tile_sz = sqlite3_value_int (argv[11]);
      }
    else
      {
	  /* whole Coverage */
	  cvg_name = (const char *) sqlite3_value_text (argv[0]);
	  path = (const char *) sqlite3_value_text (argv[1]);
	  width = sqlite3_value_int (argv[2]);
	  height = sqlite3_value_int (argv[3]);
	  mono_band = sqlite3_value_int (argv[4]);
	  blob = sqlite3_value_blob (argv[5]);
	  blob_sz = sqlite3_value_bytes (argv[5]);
	  if (sqlite3_value_type (argv[6]) == SQLITE_INTEGER)
	    {
		int ival = sqlite3_value_int (argv[6]);
		horz_res = ival;
	    }
	  else
	      horz_res = sqlite3_value_double (argv[6]);
	  if (argc > 7)
	    {
		if (sqlite3_value_type (argv[7]) == SQLITE_INTEGER)
		  {
		      int ival = sqlite3_value_int (argv[7]);
		      vert_res = ival;
		  }
		else
		    vert_res = sqlite3_value_double (argv[7]);
	    }
	  else
	      vert_res = horz_res;
	  if (argc > 8)
	      worldfile = sqlite3_value_int (argv[8]);
	  if (argc > 9)
	    {
		const char *compr = (const char *) sqlite3_value_text (argv[9]);
		compression = RL2_COMPRESSION_UNKNOWN;
		if (strcasecmp (compr, "NONE") == 0)
		    compression = RL2_COMPRESSION_NONE;
		if (strcasecmp (compr, "DEFLATE") == 0)
		    compression = RL2_COMPRESSION_DEFLATE;
		if (strcasecmp (compr, "LZW") == 0)
		    compression = RL2_COMPRESSION_LZW;
		if (strcasecmp (compr, "JPEG") == 0)
		    compression = RL2_COMPRESSION_JPEG;
		if (strcasecmp (compr, "FAX3") == 0)
		    compression = RL2_COMPRESSION_CCITTFAX3;
		if (strcasecmp (compr, "FAX4") == 0)
		    compression = RL2_COMPRESSION_CCITTFAX4;
	    }
	  if (argc > 10)
	      tile_sz = sqlite3_value_int (argv[10]);
      }

/* excluding any Mixed Resolution Coverage */
    sqlite = sqlite3_context_db_handle (context);
    if (rl2_is_mixed_resolutions_coverage (sqlite, cvg_name) > 0)
	goto error;

/* coarse args validation */
................................................................................
    coverage = rl2_create_coverage_from_dbms (sqlite, cvg_name);
    if (coverage == NULL)
      {
	  sqlite3_result_int (context, -1);
	  return;
      }

    if (by_section)
      {
	  /* single Section */
	  ret =
	      rl2_export_section_mono_band_geotiff_from_dbms (sqlite, path,
							      coverage,
							      section_id,
							      horz_res,
							      vert_res, minx,
							      miny, maxx, maxy,
							      width, height,
							      mono_band,
							      compression,
							      tile_sz,
							      worldfile);
      }
    else
      {
	  /* whole Coverage */
	  ret =
	      rl2_export_mono_band_geotiff_from_dbms (sqlite, path, coverage,
						      horz_res, vert_res, minx,
						      miny, maxx, maxy, width,
						      height, mono_band,
						      compression, tile_sz,
						      worldfile);
      }

    if (ret != RL2_OK)
      {
	  errcode = 0;
	  goto error;
      }
    rl2_destroy_coverage (coverage);
    sqlite3_result_int (context, 1);
................................................................................
    return;

  error:
    if (coverage != NULL)
	rl2_destroy_coverage (coverage);
    sqlite3_result_int (context, errcode);
}

static void
fnct_WriteMonoBandGeoTiff (sqlite3_context * context, int argc,
			   sqlite3_value ** argv)
{
/* SQL function:
/ WriteMonoBandGeoTiff(text coverage, text geotiff_path, int width,
/              int height, int mono_band, BLOB geom, double resolution)
/ WriteMonoBandGeoTiff(text coverage, text geotiff_path, int width,
/              int height, int mono_band, BLOB geom, double horz_res,
/              double vert_res)
/ WriteMonoBandGeoTiff(text coverage, text geotiff_path, int width,
/              int height, int mono_band, BLOB geom, double horz_res,
/              double vert_res, int with_worldfile)
/ WriteMonoBandGeoTiff(text coverage, text geotiff_path, int width,
/              int height, int mono_band, BLOB geom, double horz_res,
/              double vert_res, int with_worldfile, text compression)
/ WriteMonoBandGeoTiff(text coverage, text geotiff_path, int width,
/              int height, int mono_band, BLOB geom, double horz_res,
/              double vert_res, int with_worldfile, text compression,
/              int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    common_write_mono_band_geotiff (0, context, argc, argv);
}

static void
fnct_WriteSectionMonoBandGeoTiff (sqlite3_context * context, int argc,
				  sqlite3_value ** argv)
{
/* SQL function:
/ WriteSectionMonoBandGeoTiff(text coverage, int section_id,
/              text geotiff_path, int width, int height, int mono_band,
/              BLOB geom, double resolution)
/ WriteSectionMonoBandGeoTiff(text coverage, int section_id,
/              text geotiff_path, int width, int height, int mono_band,
/              BLOB geom, double horz_res, double vert_res)
/ WriteSectionMonoBandGeoTiff(text coverage, int section_id,
/              text geotiff_path, int width, int height, int mono_band,
/              BLOB geom, double horz_res, double vert_res,
/              int with_worldfile)
/ WriteSectionMonoBandGeoTiff(text coverage, int section_id,
/              text geotiff_path, int width, int height, int mono_band,
/              BLOB geom, double horz_res, double vert_res,
/              int with_worldfile, text compression)
/ WriteSectionMonoBandGeoTiff(text coverage, int section_id,
/              text geotiff_path, int width, int height, int mono_band,
/              BLOB geom, double horz_res, double vert_res,
/              int with_worldfile, text compression, int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    common_write_mono_band_geotiff (1, context, argc, argv);
}

static void
common_write_tiff (int by_section, int with_worldfile,
		   sqlite3_context * context, int argc, sqlite3_value ** argv)
{
/* common implementation Write TIFF */
    int err = 0;
    const char *cvg_name;
    const char *path;
    sqlite3_int64 section_id = 0;
    int width;
    int height;
    const unsigned char *blob;
    int blob_sz;
    double horz_res;
    double vert_res;
    unsigned char compression = RL2_COMPRESSION_NONE;
................................................................................
common_write_jpeg (int with_worldfile, int by_section,
		   sqlite3_context * context, int argc, sqlite3_value ** argv)
{
/* common implementation for Write JPEG */
    int err = 0;
    const char *cvg_name;
    const char *path;
    sqlite3_int64 section_id = 0;
    int width;
    int height;
    const unsigned char *blob;
    int blob_sz;
    double horz_res;
    double vert_res;
    int quality = 80;
................................................................................
/ or -1 (INVALID ARGS)
/
*/
    common_write_jpeg (0, 1, context, argc, argv);
}

static void
common_write_triple_band_tiff (int with_worldfile, int by_section,
			       sqlite3_context * context, int argc,
			       sqlite3_value ** argv)
{

/* common implementation Write TripleBand TIFF */


















    int err = 0;
    const char *cvg_name;
    sqlite3_int64 section_id = 0;
    const char *path;
    int width;
    int height;
    int red_band;
    int green_band;
    int blue_band;
    const unsigned char *blob;
................................................................................
    gaiaGeomCollPtr geom;
    double minx;
    double maxx;
    double miny;
    double maxy;
    RL2_UNUSED ();		/* LCOV_EXCL_LINE */

    if (by_section)
      {
	  /* single Section */
	  if (sqlite3_value_type (argv[0]) != SQLITE_TEXT)
	      err = 1;
	  if (sqlite3_value_type (argv[1]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[2]) != SQLITE_TEXT)
	      err = 1;
	  if (sqlite3_value_type (argv[3]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[4]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[5]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[6]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[7]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[8]) != SQLITE_BLOB)
	      err = 1;
	  if (sqlite3_value_type (argv[9]) != SQLITE_INTEGER
	      && sqlite3_value_type (argv[9]) != SQLITE_FLOAT)
	      err = 1;
	  if (argc > 10 && sqlite3_value_type (argv[10]) != SQLITE_INTEGER
	      && sqlite3_value_type (argv[10]) != SQLITE_FLOAT)
	      err = 1;
	  if (argc > 11 && sqlite3_value_type (argv[11]) != SQLITE_TEXT)
	      err = 1;
	  if (argc > 12 && sqlite3_value_type (argv[12]) != SQLITE_INTEGER)
	      err = 1;
      }
    else
      {
	  /* whole Coverage */
	  if (sqlite3_value_type (argv[0]) != SQLITE_TEXT)
	      err = 1;
	  if (sqlite3_value_type (argv[1]) != SQLITE_TEXT)
	      err = 1;
	  if (sqlite3_value_type (argv[2]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[3]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[4]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[5]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[6]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[7]) != SQLITE_BLOB)
	      err = 1;
	  if (sqlite3_value_type (argv[8]) != SQLITE_INTEGER
	      && sqlite3_value_type (argv[8]) != SQLITE_FLOAT)
	      err = 1;
	  if (argc > 9 && sqlite3_value_type (argv[9]) != SQLITE_INTEGER
	      && sqlite3_value_type (argv[9]) != SQLITE_FLOAT)
	      err = 1;
	  if (argc > 10 && sqlite3_value_type (argv[10]) != SQLITE_TEXT)
	      err = 1;
	  if (argc > 11 && sqlite3_value_type (argv[11]) != SQLITE_INTEGER)
	      err = 1;
      }
    if (err)
      {
	  sqlite3_result_int (context, -1);
	  return;
      }

/* retrieving all arguments */
    if (by_section)
      {
	  /* single Section */
	  cvg_name = (const char *) sqlite3_value_text (argv[0]);
	  section_id = sqlite3_value_int64 (argv[1]);
	  path = (const char *) sqlite3_value_text (argv[2]);
	  width = sqlite3_value_int (argv[3]);
	  height = sqlite3_value_int (argv[4]);
	  red_band = sqlite3_value_int (argv[5]);
	  green_band = sqlite3_value_int (argv[6]);
	  blue_band = sqlite3_value_int (argv[7]);
	  blob = sqlite3_value_blob (argv[8]);
	  blob_sz = sqlite3_value_bytes (argv[8]);









	  if (sqlite3_value_type (argv[9]) == SQLITE_INTEGER)
	    {
		int ival = sqlite3_value_int (argv[9]);
		horz_res = ival;
	    }
	  else
	      horz_res = sqlite3_value_double (argv[9]);
	  if (argc > 10)
	    {
		if (sqlite3_value_type (argv[10]) == SQLITE_INTEGER)
		  {
		      int ival = sqlite3_value_int (argv[10]);
		      vert_res = ival;
		  }
		else
		    vert_res = sqlite3_value_double (argv[10]);
	    }
	  else
	      vert_res = horz_res;
	  if (argc > 11)
	    {
		const char *compr =
		    (const char *) sqlite3_value_text (argv[11]);
		compression = RL2_COMPRESSION_UNKNOWN;
		if (strcasecmp (compr, "NONE") == 0)
		    compression = RL2_COMPRESSION_NONE;
		if (strcasecmp (compr, "DEFLATE") == 0)
		    compression = RL2_COMPRESSION_DEFLATE;
		if (strcasecmp (compr, "LZW") == 0)
		    compression = RL2_COMPRESSION_LZW;
		if (strcasecmp (compr, "JPEG") == 0)
		    compression = RL2_COMPRESSION_JPEG;
		if (strcasecmp (compr, "FAX3") == 0)
		    compression = RL2_COMPRESSION_CCITTFAX3;
		if (strcasecmp (compr, "FAX4") == 0)
		    compression = RL2_COMPRESSION_CCITTFAX4;
	    }
	  if (argc > 12)
	      tile_sz = sqlite3_value_int (argv[12]);
      }
    else
      {
	  /* whole Coverage */
	  cvg_name = (const char *) sqlite3_value_text (argv[0]);
	  path = (const char *) sqlite3_value_text (argv[1]);
	  width = sqlite3_value_int (argv[2]);
	  height = sqlite3_value_int (argv[3]);
	  red_band = sqlite3_value_int (argv[4]);
	  green_band = sqlite3_value_int (argv[5]);
	  blue_band = sqlite3_value_int (argv[6]);
	  blob = sqlite3_value_blob (argv[7]);
	  blob_sz = sqlite3_value_bytes (argv[7]);
	  if (sqlite3_value_type (argv[8]) == SQLITE_INTEGER)
	    {
		int ival = sqlite3_value_int (argv[8]);
		horz_res = ival;
	    }
	  else
	      horz_res = sqlite3_value_double (argv[8]);
	  if (argc > 9)
	    {
		if (sqlite3_value_type (argv[9]) == SQLITE_INTEGER)
		  {
		      int ival = sqlite3_value_int (argv[9]);
		      vert_res = ival;
		  }
		else
		    vert_res = sqlite3_value_double (argv[9]);
	    }
	  else
	      vert_res = horz_res;
	  if (argc > 10)
	    {
		const char *compr =
		    (const char *) sqlite3_value_text (argv[10]);
		compression = RL2_COMPRESSION_UNKNOWN;
		if (strcasecmp (compr, "NONE") == 0)
		    compression = RL2_COMPRESSION_NONE;
		if (strcasecmp (compr, "DEFLATE") == 0)
		    compression = RL2_COMPRESSION_DEFLATE;
		if (strcasecmp (compr, "LZW") == 0)
		    compression = RL2_COMPRESSION_LZW;
		if (strcasecmp (compr, "JPEG") == 0)
		    compression = RL2_COMPRESSION_JPEG;
		if (strcasecmp (compr, "FAX3") == 0)
		    compression = RL2_COMPRESSION_CCITTFAX3;
		if (strcasecmp (compr, "FAX4") == 0)
		    compression = RL2_COMPRESSION_CCITTFAX4;
	    }
	  if (argc > 11)
	      tile_sz = sqlite3_value_int (argv[11]);
      }

/* coarse args validation */
    if (width < 0 || width > UINT16_MAX)
      {
	  errcode = -1;
	  goto error;
      }
................................................................................
    coverage = rl2_create_coverage_from_dbms (sqlite, cvg_name);
    if (coverage == NULL)
      {
	  sqlite3_result_int (context, -1);
	  return;
      }

    if (by_section)
      {
	  /* single Section */
	  if (with_worldfile)
	    {
		/* TIFF + Worldfile */
		ret =
		    rl2_export_section_triple_band_tiff_worldfile_from_dbms
		    (sqlite, path, coverage, section_id, horz_res, vert_res,
		     minx, miny, maxx, maxy, width, height, red_band,
		     green_band, blue_band, compression, tile_sz);
	    }
	  else
	    {
		/* plain TIFF, no Worldfile */
		ret =
		    rl2_export_section_triple_band_tiff_from_dbms (sqlite, path,
								   coverage,
								   section_id,
								   horz_res,
								   vert_res,
								   minx, miny,
								   maxx, maxy,
								   width,
								   height,
								   red_band,
								   green_band,
								   blue_band,
								   compression,
								   tile_sz);
	    }
      }
    else
      {
	  /* whole Coverage */
	  if (with_worldfile)
	    {
		/* TIFF + Worldfile */
		ret =
		    rl2_export_triple_band_tiff_worldfile_from_dbms (sqlite,
								     path,
								     coverage,
								     horz_res,
								     vert_res,
								     minx, miny,
								     maxx, maxy,
								     width,
								     height,
								     red_band,
								     green_band,
								     blue_band,
								     compression,
								     tile_sz);
	    }
	  else
	    {
		/* plain TIFF, no Worldfile */
		ret =
		    rl2_export_triple_band_tiff_from_dbms (sqlite, path,
							   coverage, horz_res,
							   vert_res, minx, miny,
							   maxx, maxy, width,
							   height, red_band,
							   green_band,
							   blue_band,
							   compression,
							   tile_sz);
	    }
      }
    if (ret != RL2_OK)
      {
	  errcode = 0;
	  goto error;
      }
    rl2_destroy_coverage (coverage);
................................................................................
/              BLOB geom, double horz_res, double vert_res, 
/              text compression, int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    common_write_triple_band_tiff (1, 0, context, argc, argv);
}

static void
fnct_WriteTripleBandTiff (sqlite3_context * context, int argc,
			  sqlite3_value ** argv)
{
/* SQL function:
/ WriteTripleBandTiff(text coverage, int section_id,
/           text tiff_path, int width, int height, int red_band,
/           int green_band, int blue_band,
/           BLOB geom, double resolution)
/ WriteTripleBandTiff(text coverage, int section_id,
/           text tiff_path, int width, int height, int red_band,
/           int green_band, int blue_band, BLOB geom, double horz_res,
/           double vert_res)
/ WriteTripleBandTiff(text coverage, int section_id,
/           text tiff_path, int width, int height, int red_band,
/           int green_band, int blue_band, BLOB geom, double horz_res,
/           double vert_res, text compression)
/ WriteTripleBandTiff(text coverage, int section_id,
/           text tiff_path, int width, int height, int red_band,
/           int green_band, int blue_band, BLOB geom, double horz_res,
/           double vert_res, text compression, int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    common_write_triple_band_tiff (0, 0, context, argc, argv);
}

static void
fnct_WriteSectionTripleBandTiffTfw (sqlite3_context * context, int argc,
				    sqlite3_value ** argv)
{
/* SQL function:
/ WriteSectionTripleBandTiffTfw(text coverage, int section_id,
/              text tiff_path, int width, int height, int red_band,
/              int green_band, int blue_band, BLOB geom, 
/              double resolution)
/ WriteSectionTripleBandTiffTfw(text coverage, int section_id,
/              text tiff_path, int width, int height, int red_band,
/              int green_band, int blue_band, BLOB geom, double horz_res,
/              double vert_res)
/ WriteSectionTripleBandTiffTfw(text coverage, int section_id,
/              text tiff_path, int width, int height, int red_band, 
/              int green_band, int blue_band, BLOB geom, double horz_res,
/              double vert_res, text compression)
/ WriteSectionTripleBandTiffTfw(text coverage, int section_id, 
/              text tiff_path, int width, int height, int red_band,
/              int green_band, int blue_band, BLOB geom, double horz_res,
/              double vert_res, text compression, int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    common_write_triple_band_tiff (1, 1, context, argc, argv);
}

static void
fnct_WriteSectionTripleBandTiff (sqlite3_context * context, int argc,
				 sqlite3_value ** argv)
{
/* SQL function:
/ WriteSectionTripleBandTiff(text coverage, text tiff_path, int width,
/           int height, int red_band, int green_band, int blue_band,
/           BLOB geom, double resolution)
/ WriteSectionTripleBandTiff(text coverage, text tiff_path, int width,
/           int height, int red_band, int green_band, int blue_band,
/           BLOB geom, double horz_res, double vert_res)
/ WriteSectionTripleBandTiff(text coverage, text tiff_path, int width,
/           int height, int red_band, int green_band, int blue_band,
/           BLOB geom, double horz_res, double vert_res,
/           text compression)
/ WriteSectionTripleBandTiff(text coverage, text tiff_path, int width,
/           int height, int red_band, int green_band, int blue_band,
/           BLOB geom, double horz_res, double vert_res,
/           text compression, int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    common_write_triple_band_tiff (0, 1, context, argc, argv);
}

static void
common_write_mono_band_tiff (int with_worldfile, int by_section,
			     sqlite3_context * context, int argc,
			     sqlite3_value ** argv)
{

/* common implementation Write Mono Band TIFF */















    int err = 0;
    const char *cvg_name;
    sqlite3_int64 section_id = 0;
    const char *path;
    int width;
    int height;
    int mono_band;
    const unsigned char *blob;
    int blob_sz;
    double horz_res;
................................................................................
    gaiaGeomCollPtr geom;
    double minx;
    double maxx;
    double miny;
    double maxy;
    RL2_UNUSED ();		/* LCOV_EXCL_LINE */

    if (by_section)
      {
	  /* single Section */
	  if (sqlite3_value_type (argv[0]) != SQLITE_TEXT)
	      err = 1;
	  if (sqlite3_value_type (argv[1]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[2]) != SQLITE_TEXT)
	      err = 1;
	  if (sqlite3_value_type (argv[3]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[4]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[5]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[6]) != SQLITE_BLOB)
	      err = 1;
	  if (sqlite3_value_type (argv[7]) != SQLITE_INTEGER
	      && sqlite3_value_type (argv[7]) != SQLITE_FLOAT)
	      err = 1;
	  if (argc > 8 && sqlite3_value_type (argv[8]) != SQLITE_INTEGER
	      && sqlite3_value_type (argv[8]) != SQLITE_FLOAT)
	      err = 1;
	  if (argc > 9 && sqlite3_value_type (argv[9]) != SQLITE_TEXT)
	      err = 1;
	  if (argc > 10 && sqlite3_value_type (argv[10]) != SQLITE_INTEGER)
	      err = 1;
      }
    else
      {
	  /* whole Coverage */
	  if (sqlite3_value_type (argv[0]) != SQLITE_TEXT)
	      err = 1;
	  if (sqlite3_value_type (argv[1]) != SQLITE_TEXT)
	      err = 1;
	  if (sqlite3_value_type (argv[2]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[3]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[4]) != SQLITE_INTEGER)
	      err = 1;
	  if (sqlite3_value_type (argv[5]) != SQLITE_BLOB)
	      err = 1;
	  if (sqlite3_value_type (argv[6]) != SQLITE_INTEGER
	      && sqlite3_value_type (argv[6]) != SQLITE_FLOAT)
	      err = 1;
	  if (argc > 7 && sqlite3_value_type (argv[7]) != SQLITE_INTEGER
	      && sqlite3_value_type (argv[7]) != SQLITE_FLOAT)
	      err = 1;
	  if (argc > 8 && sqlite3_value_type (argv[8]) != SQLITE_TEXT)
	      err = 1;
	  if (argc > 9 && sqlite3_value_type (argv[9]) != SQLITE_INTEGER)
	      err = 1;
      }
    if (err)
      {
	  sqlite3_result_int (context, -1);
	  return;
      }

/* retrieving all arguments */
    if (by_section)
      {
	  /* single Section */
	  cvg_name = (const char *) sqlite3_value_text (argv[0]);
	  section_id = sqlite3_value_int64 (argv[1]);
	  path = (const char *) sqlite3_value_text (argv[2]);
	  width = sqlite3_value_int (argv[3]);
	  height = sqlite3_value_int (argv[4]);
	  mono_band = sqlite3_value_int (argv[5]);
	  blob = sqlite3_value_blob (argv[6]);
	  blob_sz = sqlite3_value_bytes (argv[6]);
	  if (sqlite3_value_type (argv[7]) == SQLITE_INTEGER)
	    {
		int ival = sqlite3_value_int (argv[7]);
		horz_res = ival;
	    }
	  else
	      horz_res = sqlite3_value_double (argv[7]);
	  if (argc > 8)
	    {
		if (sqlite3_value_type (argv[8]) == SQLITE_INTEGER)
		  {
		      int ival = sqlite3_value_int (argv[8]);
		      vert_res = ival;
		  }
		else
		    vert_res = sqlite3_value_double (argv[8]);
	    }
	  else
	      vert_res = horz_res;
	  if (argc > 9)
	    {
		const char *compr = (const char *) sqlite3_value_text (argv[9]);
		compression = RL2_COMPRESSION_UNKNOWN;
		if (strcasecmp (compr, "NONE") == 0)
		    compression = RL2_COMPRESSION_NONE;
		if (strcasecmp (compr, "DEFLATE") == 0)
		    compression = RL2_COMPRESSION_DEFLATE;
		if (strcasecmp (compr, "LZW") == 0)
		    compression = RL2_COMPRESSION_LZW;
		if (strcasecmp (compr, "JPEG") == 0)
		    compression = RL2_COMPRESSION_JPEG;
		if (strcasecmp (compr, "FAX3") == 0)
		    compression = RL2_COMPRESSION_CCITTFAX3;
		if (strcasecmp (compr, "FAX4") == 0)
		    compression = RL2_COMPRESSION_CCITTFAX4;
	    }
	  if (argc > 10)
	      tile_sz = sqlite3_value_int (argv[10]);
      }
    else
      {
	  /* whole Coverage */
	  cvg_name = (const char *) sqlite3_value_text (argv[0]);
	  path = (const char *) sqlite3_value_text (argv[1]);
	  width = sqlite3_value_int (argv[2]);
	  height = sqlite3_value_int (argv[3]);
	  mono_band = sqlite3_value_int (argv[4]);
	  blob = sqlite3_value_blob (argv[5]);
	  blob_sz = sqlite3_value_bytes (argv[5]);
	  if (sqlite3_value_type (argv[6]) == SQLITE_INTEGER)
	    {
		int ival = sqlite3_value_int (argv[6]);
		horz_res = ival;
	    }
	  else
	      horz_res = sqlite3_value_double (argv[6]);
	  if (argc > 7)
	    {
		if (sqlite3_value_type (argv[7]) == SQLITE_INTEGER)
		  {
		      int ival = sqlite3_value_int (argv[7]);
		      vert_res = ival;
		  }
		else
		    vert_res = sqlite3_value_double (argv[7]);
	    }
	  else
	      vert_res = horz_res;
	  if (argc > 8)
	    {
		const char *compr = (const char *) sqlite3_value_text (argv[8]);
		compression = RL2_COMPRESSION_UNKNOWN;
		if (strcasecmp (compr, "NONE") == 0)
		    compression = RL2_COMPRESSION_NONE;
		if (strcasecmp (compr, "DEFLATE") == 0)
		    compression = RL2_COMPRESSION_DEFLATE;
		if (strcasecmp (compr, "LZW") == 0)
		    compression = RL2_COMPRESSION_LZW;
		if (strcasecmp (compr, "JPEG") == 0)
		    compression = RL2_COMPRESSION_JPEG;
		if (strcasecmp (compr, "FAX3") == 0)
		    compression = RL2_COMPRESSION_CCITTFAX3;
		if (strcasecmp (compr, "FAX4") == 0)
		    compression = RL2_COMPRESSION_CCITTFAX4;
	    }
	  if (argc > 9)
	      tile_sz = sqlite3_value_int (argv[9]);
      }

/* coarse args validation */
    if (width < 0 || width > UINT16_MAX)
      {
	  errcode = -1;
	  goto error;
      }
................................................................................
    coverage = rl2_create_coverage_from_dbms (sqlite, cvg_name);
    if (coverage == NULL)
      {
	  sqlite3_result_int (context, -1);
	  return;
      }

    if (by_section)
      {
	  /* single Section */
	  if (with_worldfile)
	    {
		/* TIFF + Worldfile */
		ret =
		    rl2_export_section_mono_band_tiff_worldfile_from_dbms
		    (sqlite, path, coverage, section_id, horz_res, vert_res,
		     minx, miny, maxx, maxy, width, height, mono_band,
		     compression, tile_sz);
	    }
	  else
	    {
		/* plain TIFF, no Worldfile */
		ret =
		    rl2_export_section_mono_band_tiff_from_dbms (sqlite, path,
								 coverage,
								 section_id,
								 horz_res,
								 vert_res, minx,
								 miny, maxx,
								 maxy, width,
								 height,
								 mono_band,
								 compression,
								 tile_sz);
	    }
      }
    else
      {
	  /* whole Coverage */
	  if (with_worldfile)
	    {
		/* TIFF + Worldfile */
		ret =
		    rl2_export_mono_band_tiff_worldfile_from_dbms (sqlite, path,
								   coverage,
								   horz_res,
								   vert_res,
								   minx, miny,
								   maxx, maxy,
								   width,
								   height,
								   mono_band,
								   compression,
								   tile_sz);
	    }
	  else
	    {
		/* plain TIFF, no Worldfile */
		ret =
		    rl2_export_mono_band_tiff_from_dbms (sqlite, path, coverage,
							 horz_res, vert_res,
							 minx, miny, maxx, maxy,
							 width, height,
							 mono_band, compression,
							 tile_sz);
	    }
      }
    if (ret != RL2_OK)
      {
	  errcode = 0;
	  goto error;
      }
    rl2_destroy_coverage (coverage);
................................................................................
/              int height, int mono_band, BLOB geom, double horz_res,
/              double vert_res, text compression, int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    common_write_mono_band_tiff (1, 0, context, argc, argv);
}

static void
fnct_WriteMonoBandTiff (sqlite3_context * context, int argc,
			sqlite3_value ** argv)
{
/* SQL function:
................................................................................
/           int height, int mono_band, BLOB geom, double horz_res,
/           double vert_res, text compression, int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    common_write_mono_band_tiff (0, 0, context, argc, argv);
}

static void
fnct_WriteSectionMonoBandTiffTfw (sqlite3_context * context, int argc,
				  sqlite3_value ** argv)
{
/* SQL function:
/ WriteSectionMonoBandTiffTfw(text coverage, int section_id,
/              text tiff_path, int width, int height, int mono_band,
/              BLOB geom, double resolution)
/ WriteSectionMonoBandTiffTfw(text coverage, int section_id,
/              text tiff_path, int width, int height, int mono_band,
/              BLOB geom, double horz_res, double vert_res)
/ WriteSectionMonoBandTiffTfw(text coverage, int section_id,
/              text tiff_path, int width, int height, int mono_band,
/              BLOB geom, double horz_res, double vert_res,
/              text compression)
/ WriteSectionMonoBandTiffTfw(text coverage, int section_id,
/              text tiff_path, int width, int height, int mono_band,
/              BLOB geom, double horz_res, double vert_res,
/              text compression, int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    common_write_mono_band_tiff (1, 1, context, argc, argv);
}

static void
fnct_WriteSectionMonoBandTiff (sqlite3_context * context, int argc,
			       sqlite3_value ** argv)
{
/* SQL function:
/ WriteSectionMonoBandTiff(text coverage, int section_id, 
/           text tiff_path, int width, int height, int mono_band,
/           BLOB geom, double resolution)
/ WriteSectionMonoBandTiff(text coverage, int section_id,
/           text tiff_path, int width, int height, int mono_band,
/           BLOB geom, double horz_res, double vert_res)
/ WriteSectionMonoBandTiff(text coverage, int section_id,
/           text tiff_path, int width, int height, int mono_band,
/           BLOB geom, double horz_res, double vert_res,
/           text compression)
/ WriteSectionMonoBandTiff(text coverage, int section_id,
/           text tiff_path, int width, int height, int mono_band,
/           BLOB geom, double horz_res, double vert_res,
/           text compression, int tile_sz)
/
/ will return 1 (TRUE, success) or 0 (FALSE, failure)
/ or -1 (INVALID ARGS)
/
*/
    common_write_mono_band_tiff (0, 1, context, argc, argv);
}

static void
common_write_ascii_grid (int by_section, sqlite3_context * context, int argc,
			 sqlite3_value ** argv)
{
/* common export ASCII Grid implementation */
    int err = 0;
    const char *cvg_name;
    const char *path;
    sqlite3_int64 section_id = 0;
    int width;
    int height;
    const unsigned char *blob;
    int blob_sz;
    double resolution;
    rl2CoveragePtr coverage = NULL;
    sqlite3 *sqlite;
................................................................................
    char *xtable_tile_data;
    char *table_tiles;
    char *xtable_tiles;
    char *sql;
    int ret;
    const unsigned char *blob_odd = NULL;
    const unsigned char *blob_even = NULL;
    int blob_odd_sz = 0;
    int blob_even_sz = 0;
    rl2RasterPtr raster = NULL;
    rl2PrivRasterPtr rst;
    rl2PalettePtr palette = NULL;
    unsigned char *buffer = NULL;
    unsigned char *mask = NULL;
    unsigned char *rgba = NULL;
    unsigned char *p_rgba;
................................................................................
    char *xtable_tile_data;
    char *table_tiles;
    char *xtable_tiles;
    char *sql;
    int ret;
    const unsigned char *blob_odd = NULL;
    const unsigned char *blob_even = NULL;
    int blob_odd_sz = 0;
    int blob_even_sz = 0;
    rl2RasterPtr raster = NULL;
    rl2PrivRasterPtr rst;
    unsigned char *buffer = NULL;
    unsigned char *mask = NULL;
    unsigned char *rgba = NULL;
    unsigned char *p_rgba;
    unsigned short row;
................................................................................
				   SQLITE_ANY, 0, fnct_WriteTripleBandGeoTiff,
				   0, 0);
	  sqlite3_create_function (db, "WriteTripleBandGeoTiff", 13, SQLITE_ANY,
				   0, fnct_WriteTripleBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteTripleBandGeoTiff", 13,
				   SQLITE_ANY, 0, fnct_WriteTripleBandGeoTiff,
				   0, 0);
	  sqlite3_create_function (db, "WriteSectionTripleBandGeoTiff", 10,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionTripleBandGeoTiff", 10,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "WriteSectionTripleBandGeoTiff", 11,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionTripleBandGeoTiff", 11,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "WriteSectionTripleBandGeoTiff", 12,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionTripleBandGeoTiff", 12,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "WriteSectionTripleBandGeoTiff", 13,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionTripleBandGeoTiff", 13,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "WriteSectionTripleBandGeoTiff", 14,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionTripleBandGeoTiff", 14,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "WriteMonoBandGeoTiff", 7, SQLITE_ANY, 0,
				   fnct_WriteMonoBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteMonoBandGeoTiff", 7,
				   SQLITE_ANY, 0, fnct_WriteMonoBandGeoTiff, 0,
				   0);
	  sqlite3_create_function (db, "WriteMonoBandGeoTiff", 8, SQLITE_ANY, 0,
				   fnct_WriteMonoBandGeoTiff, 0, 0);
................................................................................
				   SQLITE_ANY, 0, fnct_WriteMonoBandGeoTiff, 0,
				   0);
	  sqlite3_create_function (db, "WriteMonoBandGeoTiff", 11, SQLITE_ANY,
				   0, fnct_WriteMonoBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteMonoBandGeoTiff", 11,
				   SQLITE_ANY, 0, fnct_WriteMonoBandGeoTiff, 0,
				   0);
	  sqlite3_create_function (db, "WriteSectionMonoBandGeoTiff", 8,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionMonoBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionMonoBandGeoTiff", 8,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionMonoBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "WriteSectionMonoBandGeoTiff", 9,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionMonoBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionMonoBandGeoTiff", 9,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionMonoBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "WriteSectionMonoBandGeoTiff", 10,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionMonoBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionMonoBandGeoTiff", 10,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionMonoBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "WriteSectionMonoBandGeoTiff", 11,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionMonoBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionMonoBandGeoTiff", 11,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionMonoBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "WriteSectionMonoBandGeoTiff", 12,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionMonoBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionMonoBandGeoTiff", 12,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionMonoBandGeoTiff, 0, 0);
	  sqlite3_create_function (db, "WriteTripleBandTiffTfw", 9, SQLITE_ANY,
				   0, fnct_WriteTripleBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteTripleBandTiffTfw", 9,
				   SQLITE_ANY, 0, fnct_WriteTripleBandTiffTfw,
				   0, 0);
	  sqlite3_create_function (db, "WriteTripleBandTiffTfw", 10, SQLITE_ANY,
				   0, fnct_WriteTripleBandTiffTfw, 0, 0);
................................................................................
				   SQLITE_ANY, 0, fnct_WriteTripleBandTiffTfw,
				   0, 0);
	  sqlite3_create_function (db, "WriteTripleBandTiffTfw", 12, SQLITE_ANY,
				   0, fnct_WriteTripleBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteTripleBandTiffTfw", 12,
				   SQLITE_ANY, 0, fnct_WriteTripleBandTiffTfw,
				   0, 0);
	  sqlite3_create_function (db, "WriteSectionTripleBandTiffTfw", 10,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionTripleBandTiffTfw", 10,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "WriteSectionTripleBandTiffTfw", 11,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionTripleBandTiffTfw", 11,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "WriteSectionTripleBandTiffTfw", 12,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionTripleBandTiffTfw", 12,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "WriteSectionTripleBandTiffTfw", 13,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionTripleBandTiffTfw", 13,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "WriteSectionMonoBandTiffTfw", 8,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionMonoBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionMonoBandTiffTfw", 8,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionMonoBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "WriteSectionMonoBandTiffTfw", 9,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionMonoBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionMonoBandTiffTfw", 9,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionMonoBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "WriteSectionMonoBandTiffTfw", 10,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionMonoBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionMonoBandTiffTfw", 10,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionMonoBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "WriteSectionMonoBandTiffTfw", 11,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionMonoBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionMonoBandTiffTfw", 11,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionMonoBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "WriteMonoBandTiffTfw", 7,
				   SQLITE_ANY, 0,
				   fnct_WriteMonoBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteMonoBandTiffTfw", 7,
				   SQLITE_ANY, 0,
				   fnct_WriteMonoBandTiffTfw, 0, 0);

	  sqlite3_create_function (db, "WriteMonoBandTiffTfw", 8,
				   SQLITE_ANY, 0,
				   fnct_WriteMonoBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteMonoBandTiffTfw", 8,
				   SQLITE_ANY, 0, fnct_WriteMonoBandTiffTfw, 0,
				   0);
	  sqlite3_create_function (db, "WriteMonoBandTiffTfw", 9, SQLITE_ANY, 0,
				   fnct_WriteMonoBandTiffTfw, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteMonoBandTiffTfw", 9,
................................................................................
				   SQLITE_ANY, 0, fnct_WriteTripleBandTiff, 0,
				   0);
	  sqlite3_create_function (db, "WriteTripleBandTiff", 12, SQLITE_ANY, 0,
				   fnct_WriteTripleBandTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteTripleBandTiff", 12,
				   SQLITE_ANY, 0, fnct_WriteTripleBandTiff, 0,
				   0);
	  sqlite3_create_function (db, "WriteSectionTripleBandTiff", 10,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionTripleBandTiff", 10,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandTiff, 0, 0);
	  sqlite3_create_function (db, "WriteSectionTripleBandTiff", 11,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionTripleBandTiff", 11,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandTiff, 0, 0);
	  sqlite3_create_function (db, "WriteSectionTripleBandTiff", 12,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionTripleBandTiff", 12,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandTiff, 0, 0);
	  sqlite3_create_function (db, "WriteSectionTripleBandTiff", 13,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionTripleBandTiff", 13,
				   SQLITE_ANY, 0,
				   fnct_WriteSectionTripleBandTiff, 0, 0);
	  sqlite3_create_function (db, "WriteMonoBandTiff", 7, SQLITE_ANY, 0,
				   fnct_WriteMonoBandTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteMonoBandTiff", 7, SQLITE_ANY,
				   0, fnct_WriteMonoBandTiff, 0, 0);
	  sqlite3_create_function (db, "WriteMonoBandTiff", 8, SQLITE_ANY, 0,
				   fnct_WriteMonoBandTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteMonoBandTiff", 8, SQLITE_ANY,
................................................................................
				   fnct_WriteMonoBandTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteMonoBandTiff", 9, SQLITE_ANY,
				   0, fnct_WriteMonoBandTiff, 0, 0);
	  sqlite3_create_function (db, "WriteMonoBandTiff", 10, SQLITE_ANY, 0,
				   fnct_WriteMonoBandTiff, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteMonoBandTiff", 10, SQLITE_ANY,
				   0, fnct_WriteMonoBandTiff, 0, 0);
	  sqlite3_create_function (db, "WriteSectionMonoBandTiff", 8,
				   SQLITE_ANY, 0, fnct_WriteSectionMonoBandTiff,
				   0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionMonoBandTiff", 8,
				   SQLITE_ANY, 0, fnct_WriteSectionMonoBandTiff,
				   0, 0);
	  sqlite3_create_function (db, "WriteSectionMonoBandTiff", 9,
				   SQLITE_ANY, 0, fnct_WriteSectionMonoBandTiff,
				   0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionMonoBandTiff", 9,
				   SQLITE_ANY, 0, fnct_WriteSectionMonoBandTiff,
				   0, 0);
	  sqlite3_create_function (db, "WriteSectionMonoBandTiff", 10,
				   SQLITE_ANY, 0, fnct_WriteSectionMonoBandTiff,
				   0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionMonoBandTiff", 10,
				   SQLITE_ANY, 0, fnct_WriteSectionMonoBandTiff,
				   0, 0);
	  sqlite3_create_function (db, "WriteSectionMonoBandTiff", 11,
				   SQLITE_ANY, 0, fnct_WriteSectionMonoBandTiff,
				   0, 0);
	  sqlite3_create_function (db, "RL2_WriteSectionMonoBandTiff", 11,
				   SQLITE_ANY, 0, fnct_WriteSectionMonoBandTiff,
				   0, 0);
	  sqlite3_create_function (db, "WriteAsciiGrid", 6, SQLITE_ANY, 0,
				   fnct_WriteAsciiGrid, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteAsciiGrid", 6, SQLITE_ANY, 0,
				   fnct_WriteAsciiGrid, 0, 0);
	  sqlite3_create_function (db, "WriteAsciiGrid", 7, SQLITE_ANY, 0,
				   fnct_WriteAsciiGrid, 0, 0);
	  sqlite3_create_function (db, "RL2_WriteAsciiGrid", 7, SQLITE_ANY, 0,

Changes to src/rl2sqlaux.c.

2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
....
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
....
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
....
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
....
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
....
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
....
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
    short *p_in;
    unsigned char *p_out;
    unsigned char *p_msk;
    unsigned int row;
    unsigned int col;
    short min = SHRT_MAX;
    short max = SHRT_MIN;
    double min2;
    double max2;
    double tic;
    double tic2;
    int transparent;
    int i;
    int sum;
    int total;
    double percentile2;
................................................................................
    unsigned short *p_in;
    unsigned char *p_out;
    unsigned char *p_msk;
    unsigned int row;
    unsigned int col;
    unsigned short min = USHRT_MAX;
    unsigned short max = 0;
    double min2;
    double max2;
    double tic;
    double tic2;
    int transparent;
    int i;
    int sum;
    int total;
    double percentile2;
................................................................................
    int *p_in;
    unsigned char *p_out;
    unsigned char *p_msk;
    unsigned int row;
    unsigned int col;
    int min = INT_MAX;
    int max = INT_MIN;
    double min2;
    double max2;
    double tic;
    double tic2;
    int transparent;
    int i;
    int sum;
    int total;
    double percentile2;
................................................................................
    unsigned int *p_in;
    unsigned char *p_out;
    unsigned char *p_msk;
    unsigned int row;
    unsigned int col;
    unsigned int min = UINT_MAX;
    unsigned int max = 0;
    double min2;
    double max2;
    double tic;
    double tic2;
    int transparent;
    int i;
    int sum;
    int total;
    double percentile2;
................................................................................
    float *p_in;
    unsigned char *p_out;
    unsigned char *p_msk;
    unsigned int row;
    unsigned int col;
    float min = FLT_MAX;
    float max = 0.0 - FLT_MAX;
    double min2;
    double max2;
    double tic;
    double tic2;
    int transparent;
    int i;
    int sum;
    int total;
    double percentile2;
................................................................................
    double *p_in;
    unsigned char *p_out;
    unsigned char *p_msk;
    unsigned int row;
    unsigned int col;
    double min = DBL_MAX;
    double max = 0.0 - DBL_MAX;
    double min2;
    double max2;
    double tic;
    double tic2;
    int transparent;
    int i;
    int sum;
    int total;
    double percentile2;
................................................................................
    unsigned char *p_msk;
    unsigned int row;
    unsigned int col;
    int transparent;
    unsigned short min = USHRT_MAX;
    unsigned short max = 0;
    double tic;
    double red_min;
    double red_max;
    double red_tic;
    double green_min;
    double green_max;
    double green_tic;
    double blue_min;
    double blue_max;
    double blue_tic;
    int i;
    int sum;
    int total;
    int band;
    double percentile2;
    int histogram[1024];







|
|







 







|
|







 







|
|







 







|
|







 







|
|







 







|
|







 







|
|

|
|

|
|







2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
....
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
....
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
....
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
....
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
....
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
....
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
    short *p_in;
    unsigned char *p_out;
    unsigned char *p_msk;
    unsigned int row;
    unsigned int col;
    short min = SHRT_MAX;
    short max = SHRT_MIN;
    double min2 = 0.0;
    double max2 = 0.0;
    double tic;
    double tic2;
    int transparent;
    int i;
    int sum;
    int total;
    double percentile2;
................................................................................
    unsigned short *p_in;
    unsigned char *p_out;
    unsigned char *p_msk;
    unsigned int row;
    unsigned int col;
    unsigned short min = USHRT_MAX;
    unsigned short max = 0;
    double min2 = 0.0;
    double max2 = 0.0;
    double tic;
    double tic2;
    int transparent;
    int i;
    int sum;
    int total;
    double percentile2;
................................................................................
    int *p_in;
    unsigned char *p_out;
    unsigned char *p_msk;
    unsigned int row;
    unsigned int col;
    int min = INT_MAX;
    int max = INT_MIN;
    double min2 = 0.0;
    double max2 = 0.0;
    double tic;
    double tic2;
    int transparent;
    int i;
    int sum;
    int total;
    double percentile2;
................................................................................
    unsigned int *p_in;
    unsigned char *p_out;
    unsigned char *p_msk;
    unsigned int row;
    unsigned int col;
    unsigned int min = UINT_MAX;
    unsigned int max = 0;
    double min2 = 0.0;
    double max2 = 0.0;
    double tic;
    double tic2;
    int transparent;
    int i;
    int sum;
    int total;
    double percentile2;
................................................................................
    float *p_in;
    unsigned char *p_out;
    unsigned char *p_msk;
    unsigned int row;
    unsigned int col;
    float min = FLT_MAX;
    float max = 0.0 - FLT_MAX;
    double min2 = 0.0;
    double max2 = 0.0;
    double tic;
    double tic2;
    int transparent;
    int i;
    int sum;
    int total;
    double percentile2;
................................................................................
    double *p_in;
    unsigned char *p_out;
    unsigned char *p_msk;
    unsigned int row;
    unsigned int col;
    double min = DBL_MAX;
    double max = 0.0 - DBL_MAX;
    double min2 = 0.0;
    double max2 = 0.0;
    double tic;
    double tic2;
    int transparent;
    int i;
    int sum;
    int total;
    double percentile2;
................................................................................
    unsigned char *p_msk;
    unsigned int row;
    unsigned int col;
    int transparent;
    unsigned short min = USHRT_MAX;
    unsigned short max = 0;
    double tic;
    double red_min = DBL_MAX;
    double red_max = 0.0 - DBL_MAX;
    double red_tic;
    double green_min = DBL_MAX;
    double green_max = 0.0 - DBL_MAX;
    double green_tic;
    double blue_min = DBL_MAX;
    double blue_max = 0.0 - DBL_MAX;
    double blue_tic;
    int i;
    int sum;
    int total;
    int band;
    double percentile2;
    int histogram[1024];

Changes to src/rl2svg.c.

1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
}

static void
svg_resolve_gradients_xlink_href (rl2PrivSvgDocumentPtr svg_doc)
{
/* resolving any indirect reference: Gradient xlink:href */
    rl2PrivSvgGradientPtr grad = svg_doc->first_grad;
    rl2PrivSvgGradientPtr ret;

    while (grad)
      {
	  /* looping on Gradients */
	  if (grad->xlink_href != NULL)
	    {
		svg_find_gradient_href (svg_doc, grad->xlink_href, &ret);







|







1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
}

static void
svg_resolve_gradients_xlink_href (rl2PrivSvgDocumentPtr svg_doc)
{
/* resolving any indirect reference: Gradient xlink:href */
    rl2PrivSvgGradientPtr grad = svg_doc->first_grad;
    rl2PrivSvgGradientPtr ret = NULL;

    while (grad)
      {
	  /* looping on Gradients */
	  if (grad->xlink_href != NULL)
	    {
		svg_find_gradient_href (svg_doc, grad->xlink_href, &ret);

Changes to src/rl2svgxml.c.

465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
    const char *p_in = value;
    double coord;
    double coord_array[7];
    double first_x = DBL_MAX;
    double first_y = DBL_MAX;
    double last_x = DBL_MAX;
    double last_y = DBL_MAX;
    double bezier_reflect_x;
    double bezier_reflect_y;
    double x;
    double y;
    double x1;
    double y1;
    double x2;
    double y2;
    void *data;







|
|







465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
    const char *p_in = value;
    double coord;
    double coord_array[7];
    double first_x = DBL_MAX;
    double first_y = DBL_MAX;
    double last_x = DBL_MAX;
    double last_y = DBL_MAX;
    double bezier_reflect_x = DBL_MAX;
    double bezier_reflect_y = DBL_MAX;
    double x;
    double y;
    double x1;
    double y1;
    double x2;
    double y2;
    void *data;

Changes to src/rl2symbolizer.c.

720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
....
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
....
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
    return 0;
}

static int
parse_sld_se_interpolation_point (xmlNodePtr node, rl2PrivRasterStylePtr style)
{
/* parsing RasterSymbolizer ColorMap InterpolationPoint */
    double value;
    unsigned char red;
    unsigned char green;
    unsigned char blue;
    int has_data = 0;
    int has_value = 0;

    while (node)
      {
	  if (node->type == XML_ELEMENT_NODE)
	    {
................................................................................
}

RL2_DECLARE const char *
rl2_get_group_named_layer (rl2GroupStylePtr style, int index)
{
/* return the Nth NamedLayer from a Group Style */
    int cnt = 0;
    const char *str;
    rl2PrivChildStylePtr child;
    rl2PrivGroupStylePtr stl = (rl2PrivGroupStylePtr) style;
    if (stl == NULL)
	return NULL;
    if (index < 0)
	return NULL;
    child = stl->first;
................................................................................
}

RL2_DECLARE const char *
rl2_get_group_named_style (rl2GroupStylePtr style, int index)
{
/* return the Nth NamedStyle from a Group Style */
    int cnt = 0;
    const char *str;
    rl2PrivChildStylePtr child;
    rl2PrivGroupStylePtr stl = (rl2PrivGroupStylePtr) style;
    if (stl == NULL)
	return NULL;
    if (index < 0)
	return NULL;
    child = stl->first;







|
|
|
|







 







|







 







|







720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
....
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
....
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
    return 0;
}

static int
parse_sld_se_interpolation_point (xmlNodePtr node, rl2PrivRasterStylePtr style)
{
/* parsing RasterSymbolizer ColorMap InterpolationPoint */
    double value = 0.0;
    unsigned char red = 0;
    unsigned char green = 0;
    unsigned char blue = 0;
    int has_data = 0;
    int has_value = 0;

    while (node)
      {
	  if (node->type == XML_ELEMENT_NODE)
	    {
................................................................................
}

RL2_DECLARE const char *
rl2_get_group_named_layer (rl2GroupStylePtr style, int index)
{
/* return the Nth NamedLayer from a Group Style */
    int cnt = 0;
    const char *str = NULL;
    rl2PrivChildStylePtr child;
    rl2PrivGroupStylePtr stl = (rl2PrivGroupStylePtr) style;
    if (stl == NULL)
	return NULL;
    if (index < 0)
	return NULL;
    child = stl->first;
................................................................................
}

RL2_DECLARE const char *
rl2_get_group_named_style (rl2GroupStylePtr style, int index)
{
/* return the Nth NamedStyle from a Group Style */
    int cnt = 0;
    const char *str = NULL;
    rl2PrivChildStylePtr child;
    rl2PrivGroupStylePtr stl = (rl2PrivGroupStylePtr) style;
    if (stl == NULL)
	return NULL;
    if (index < 0)
	return NULL;
    child = stl->first;

Changes to src/rl2tiff.c.

374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
....
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
....
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
....
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
....
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
....
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
....
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
    int line_no = 0;
    int ok_res_x = 0;
    int ok_res_y = 0;
    int ok_x = 0;
    int ok_y = 0;
    char buf[1024];
    char *p = buf;
    double x;
    double y;
    double res_x;
    double res_y;

    if (in == NULL)
	return 0;

    while (1)
      {
	  int c = getc (in);
................................................................................
static void
copy_convert_tile (rl2PrivTiffOriginPtr origin, void *in, void *out,
		   unsigned int startRow, unsigned int startCol,
		   unsigned short width, unsigned short height, uint32 tile_y,
		   uint32 tile_x, unsigned char convert)
{
/* copying pixels by applying a format conversion */
    char *p_in_8;
    char *p_out_8;
    unsigned char *p_in_u8;
    unsigned char *p_out_u8;
    short *p_in_16;
    short *p_out_16;
    unsigned short *p_in_u16;
    unsigned short *p_out_u16;
    int *p_in_32;
    int *p_out_32;
    unsigned int *p_in_u32;
    unsigned int *p_out_u32;
    float *p_in_flt;
    float *p_out_flt;
    double *p_in_dbl;
    double *p_out_dbl;
    uint32 x;
    uint32 y;
    unsigned int dest_x;
    unsigned int dest_y;

    for (y = 0; y < origin->tileHeight; y++)
      {
................................................................................
{
/* reading TIFF raw tiles */
    uint32 tile_x;
    uint32 tile_y;
    uint32 x;
    uint32 y;
    uint32 *tiff_tile = NULL;
    char *p_in_8;
    char *p_out_8;
    unsigned char *p_in_u8;
    unsigned char *p_out_u8;
    short *p_in_16;
    short *p_out_16;
    unsigned short *p_in_u16;
    unsigned short *p_out_u16;
    int *p_in_32;
    int *p_out_32;
    unsigned int *p_in_u32;
    unsigned int *p_out_u32;
    float *p_in_flt;
    float *p_out_flt;
    double *p_in_dbl;
    double *p_out_dbl;
    unsigned int dest_x;
    unsigned int dest_y;
    int skip;
    unsigned char bnd;
    unsigned char convert = origin->forced_conversion;

    tiff_tile = malloc (TIFFTileSize (origin->in));
................................................................................

static void
copy_convert_scanline (rl2PrivTiffOriginPtr origin, void *in, void *out,
		       unsigned int lineNo, unsigned int startCol,
		       unsigned int width, unsigned char convert)
{
/* copying pixels by applying a format conversion */
    char *p_in_8;
    char *p_out_8;
    unsigned char *p_in_u8;
    unsigned char *p_out_u8;
    short *p_in_16;
    short *p_out_16;
    unsigned short *p_in_u16;
    unsigned short *p_out_u16;
    int *p_in_32;
    int *p_out_32;
    unsigned int *p_in_u32;
    unsigned int *p_out_u32;
    float *p_in_flt;
    float *p_out_flt;
    double *p_in_dbl;
    double *p_out_dbl;
    uint32 x;

    switch (convert)
      {
      case RL2_CONVERT_GRID_INT8_TO_UINT8:
      case RL2_CONVERT_GRID_INT8_TO_INT16:
      case RL2_CONVERT_GRID_INT8_TO_UINT16:
................................................................................
		    unsigned int startCol, unsigned char *pixels)
{
/* reading TIFF raw strips */
    uint32 line_no;
    uint32 x;
    uint32 y;
    uint32 *tiff_scanline = NULL;
    char *p_in_8;
    char *p_out_8;
    unsigned char *p_in_u8;
    unsigned char *p_out_u8;
    short *p_in_16;
    short *p_out_16;
    unsigned short *p_in_u16;
    unsigned short *p_out_u16;
    int *p_in_32;
    int *p_out_32;
    unsigned int *p_in_u32;
    unsigned int *p_out_u32;
    float *p_in_flt;
    float *p_out_flt;
    double *p_in_dbl;
    double *p_out_dbl;
    unsigned char bnd;
    unsigned char convert = origin->forced_conversion;
    TIFF *in = (TIFF *) 0;

    tiff_scanline = malloc (TIFFScanlineSize (origin->in));
    if (tiff_scanline == NULL)
	goto error;
................................................................................
			     unsigned int startCol, void *pixels)
{
/* reading TIFF raw strips - separate planes */
    uint32 line_no;
    uint32 x;
    uint32 y;
    uint32 *tiff_scanline = NULL;
    unsigned char *p_in_u8;
    unsigned char *p_out_u8;
    unsigned char *p_out_u8_base;
    unsigned short *p_in_u16;
    unsigned short *p_out_u16;
    unsigned short *p_out_u16_base;
    unsigned char band;
    TIFF *in = (TIFF *) 0;

    if (sample_type != RL2_SAMPLE_UINT8 && sample_type != RL2_SAMPLE_UINT16)
	goto error;

    tiff_scanline = malloc (TIFFScanlineSize (origin->in));
................................................................................
    uint32 width = 0;
    uint32 height = 0;
    TIFF *in = (TIFF *) 0;
    unsigned int x;
    unsigned int y;
    unsigned int row;
    uint32 *rgba;
    unsigned char *rgb;
    unsigned char *mask;
    int rgb_size;
    int mask_size;
    uint32 *p_in;
    unsigned char *p_rgb;
    unsigned char *p_mask;
    int valid_mask = 0;








|
|
|
|







 







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







 







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







 







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







 







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







 







|
|
|
|
|
|







 







|
|







374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
....
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
....
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
....
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
....
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
....
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
....
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
    int line_no = 0;
    int ok_res_x = 0;
    int ok_res_y = 0;
    int ok_x = 0;
    int ok_y = 0;
    char buf[1024];
    char *p = buf;
    double x = 0.0;
    double y = 0.0;
    double res_x = 0.0;
    double res_y = 0.0;

    if (in == NULL)
	return 0;

    while (1)
      {
	  int c = getc (in);
................................................................................
static void
copy_convert_tile (rl2PrivTiffOriginPtr origin, void *in, void *out,
		   unsigned int startRow, unsigned int startCol,
		   unsigned short width, unsigned short height, uint32 tile_y,
		   uint32 tile_x, unsigned char convert)
{
/* copying pixels by applying a format conversion */
    char *p_in_8 = NULL;
    char *p_out_8 = NULL;
    unsigned char *p_in_u8 = NULL;
    unsigned char *p_out_u8 = NULL;
    short *p_in_16 = NULL;
    short *p_out_16 = NULL;
    unsigned short *p_in_u16 = NULL;
    unsigned short *p_out_u16 = NULL;
    int *p_in_32 = NULL;
    int *p_out_32 = NULL;
    unsigned int *p_in_u32 = NULL;
    unsigned int *p_out_u32 = NULL;
    float *p_in_flt = NULL;
    float *p_out_flt = NULL;
    double *p_in_dbl = NULL;
    double *p_out_dbl = NULL;
    uint32 x;
    uint32 y;
    unsigned int dest_x;
    unsigned int dest_y;

    for (y = 0; y < origin->tileHeight; y++)
      {
................................................................................
{
/* reading TIFF raw tiles */
    uint32 tile_x;
    uint32 tile_y;
    uint32 x;
    uint32 y;
    uint32 *tiff_tile = NULL;
    char *p_in_8 = NULL;
    char *p_out_8 = NULL;
    unsigned char *p_in_u8 = NULL;
    unsigned char *p_out_u8 = NULL;
    short *p_in_16 = NULL;
    short *p_out_16 = NULL;
    unsigned short *p_in_u16 = NULL;
    unsigned short *p_out_u16 = NULL;
    int *p_in_32 = NULL;
    int *p_out_32 = NULL;
    unsigned int *p_in_u32 = NULL;
    unsigned int *p_out_u32 = NULL;
    float *p_in_flt = NULL;
    float *p_out_flt = NULL;
    double *p_in_dbl = NULL;
    double *p_out_dbl = NULL;
    unsigned int dest_x;
    unsigned int dest_y;
    int skip;
    unsigned char bnd;
    unsigned char convert = origin->forced_conversion;

    tiff_tile = malloc (TIFFTileSize (origin->in));
................................................................................

static void
copy_convert_scanline (rl2PrivTiffOriginPtr origin, void *in, void *out,
		       unsigned int lineNo, unsigned int startCol,
		       unsigned int width, unsigned char convert)
{
/* copying pixels by applying a format conversion */
    char *p_in_8 = NULL;
    char *p_out_8 = NULL;
    unsigned char *p_in_u8 = NULL;
    unsigned char *p_out_u8 = NULL;
    short *p_in_16 = NULL;
    short *p_out_16 = NULL;
    unsigned short *p_in_u16 = NULL;
    unsigned short *p_out_u16 = NULL;
    int *p_in_32 = NULL;
    int *p_out_32 = NULL;
    unsigned int *p_in_u32 = NULL;
    unsigned int *p_out_u32 = NULL;
    float *p_in_flt = NULL;
    float *p_out_flt = NULL;
    double *p_in_dbl = NULL;
    double *p_out_dbl = NULL;
    uint32 x;

    switch (convert)
      {
      case RL2_CONVERT_GRID_INT8_TO_UINT8:
      case RL2_CONVERT_GRID_INT8_TO_INT16:
      case RL2_CONVERT_GRID_INT8_TO_UINT16:
................................................................................
		    unsigned int startCol, unsigned char *pixels)
{
/* reading TIFF raw strips */
    uint32 line_no;
    uint32 x;
    uint32 y;
    uint32 *tiff_scanline = NULL;
    char *p_in_8 = NULL;
    char *p_out_8 = NULL;
    unsigned char *p_in_u8 = NULL;
    unsigned char *p_out_u8 = NULL;
    short *p_in_16 = NULL;
    short *p_out_16 = NULL;
    unsigned short *p_in_u16 = NULL;
    unsigned short *p_out_u16 = NULL;
    int *p_in_32 = NULL;
    int *p_out_32 = NULL;
    unsigned int *p_in_u32 = NULL;
    unsigned int *p_out_u32 = NULL;
    float *p_in_flt = NULL;
    float *p_out_flt = NULL;
    double *p_in_dbl = NULL;
    double *p_out_dbl = NULL;
    unsigned char bnd;
    unsigned char convert = origin->forced_conversion;
    TIFF *in = (TIFF *) 0;

    tiff_scanline = malloc (TIFFScanlineSize (origin->in));
    if (tiff_scanline == NULL)
	goto error;
................................................................................
			     unsigned int startCol, void *pixels)
{
/* reading TIFF raw strips - separate planes */
    uint32 line_no;
    uint32 x;
    uint32 y;
    uint32 *tiff_scanline = NULL;
    unsigned char *p_in_u8 = NULL;
    unsigned char *p_out_u8 = NULL;
    unsigned char *p_out_u8_base = NULL;
    unsigned short *p_in_u16 = NULL;
    unsigned short *p_out_u16 = NULL;
    unsigned short *p_out_u16_base = NULL;
    unsigned char band;
    TIFF *in = (TIFF *) 0;

    if (sample_type != RL2_SAMPLE_UINT8 && sample_type != RL2_SAMPLE_UINT16)
	goto error;

    tiff_scanline = malloc (TIFFScanlineSize (origin->in));
................................................................................
    uint32 width = 0;
    uint32 height = 0;
    TIFF *in = (TIFF *) 0;
    unsigned int x;
    unsigned int y;
    unsigned int row;
    uint32 *rgba;
    unsigned char *rgb = NULL;
    unsigned char *mask = NULL;
    int rgb_size;
    int mask_size;
    uint32 *p_in;
    unsigned char *p_rgb;
    unsigned char *p_mask;
    int valid_mask = 0;

Changes to src/rl2wms.c.

4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288

    for (; cur_node; cur_node = cur_node->next)
      {
	  if (cur_node->type == XML_ELEMENT_NODE)
	    {
		int len;
		xmlNodePtr child_node;
		const char *value;
		if (strcmp ((const char *) (cur_node->name), "Name") == 0)
		  {
		      if (cap->TileServiceName != NULL)
			  free (cap->TileServiceName);
		      cap->TileServiceName = NULL;
		      child_node = cur_node->children;
		      if (child_node != NULL)







|







4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288

    for (; cur_node; cur_node = cur_node->next)
      {
	  if (cur_node->type == XML_ELEMENT_NODE)
	    {
		int len;
		xmlNodePtr child_node;
		const char *value = NULL;
		if (strcmp ((const char *) (cur_node->name), "Name") == 0)
		  {
		      if (cap->TileServiceName != NULL)
			  free (cap->TileServiceName);
		      cap->TileServiceName = NULL;
		      child_node = cur_node->children;
		      if (child_node != NULL)

Changes to test/sql_stmt_security_tests/Makefile.am.

128
129
130
131
132
133
134



















































































135
136
137
138
139
140
141
...
156
157
158
159
160
161
162





























163
164
165
166
167
168
169
...
177
178
179
180
181
182
183

































































184
185
186
187
188
189
190
...
199
200
201
202
203
204
205























206
207
208
209
210
211
212
	writebandtiff21.testcase \
	writebandtiff22.testcase \
	writebandtiff23.testcase \
	writebandtiff24.testcase \
	writebandtiff25.testcase \
	writebandtiff26.testcase \
	writebandtiff27.testcase \



















































































	writebandgeotiff1.testcase \
	writebandgeotiff2.testcase \
	writebandgeotiff3.testcase \
	writebandgeotiff4.testcase \
	writebandgeotiff5.testcase \
	writebandgeotiff6.testcase \
	writebandgeotiff7.testcase \
................................................................................
	writebandgeotiff22.testcase \
	writebandgeotiff23.testcase \
	writebandgeotiff24.testcase \
	writebandgeotiff25.testcase \
	writebandgeotiff26.testcase \
	writebandgeotiff27.testcase \
	writebandgeotiff28.testcase \





























	writemonotiff1.testcase \
	writemonotiff2.testcase \
	writemonotiff3.testcase \
	writemonotiff4.testcase \
	writemonotiff5.testcase \
	writemonotiff6.testcase \
	writemonotiff7.testcase \
................................................................................
	writemonotiff15.testcase \
	writemonotiff16.testcase \
	writemonotiff17.testcase \
	writemonotiff18.testcase \
	writemonotiff19.testcase \
	writemonotiff20.testcase \
	writemonotiff21.testcase \

































































	writemonogeotiff1.testcase \
	writemonogeotiff2.testcase \
	writemonogeotiff3.testcase \
	writemonogeotiff4.testcase \
	writemonogeotiff5.testcase \
	writemonogeotiff6.testcase \
	writemonogeotiff7.testcase \
................................................................................
	writemonogeotiff16.testcase \
	writemonogeotiff17.testcase \
	writemonogeotiff18.testcase \
	writemonogeotiff19.testcase \
	writemonogeotiff20.testcase \
	writemonogeotiff21.testcase \
	writemonogeotiff22.testcase \























	writegeotiff1.testcase \
	writegeotiff2.testcase \
	writegeotiff3.testcase \
	writegeotiff4.testcase \
	writegeotiff5.testcase \
	writegeotiff6.testcase \
	writegeotiff7.testcase \







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
...
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
...
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
...
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
	writebandtiff21.testcase \
	writebandtiff22.testcase \
	writebandtiff23.testcase \
	writebandtiff24.testcase \
	writebandtiff25.testcase \
	writebandtiff26.testcase \
	writebandtiff27.testcase \
	writebandtifftfw1.testcase \
	writebandtifftfw2.testcase \
	writebandtifftfw3.testcase \
	writebandtifftfw4.testcase \
	writebandtifftfw5.testcase \
	writebandtifftfw6.testcase \
	writebandtifftfw7.testcase \
	writebandtifftfw8.testcase \
	writebandtifftfw9.testcase \
	writebandtifftfw10.testcase \
	writebandtifftfw11.testcase \
	writebandtifftfw12.testcase \
	writebandtifftfw13.testcase \
	writebandtifftfw14.testcase \
	writebandtifftfw15.testcase \
	writebandtifftfw16.testcase \
	writebandtifftfw17.testcase \
	writebandtifftfw18.testcase \
	writebandtifftfw19.testcase \
	writebandtifftfw20.testcase \
	writebandtifftfw21.testcase \
	writebandtifftfw22.testcase \
	writebandtifftfw23.testcase \
	writebandtifftfw24.testcase \
	writebandtifftfw25.testcase \
	writebandtifftfw26.testcase \
	writebandtifftfw27.testcase \
	writesectionbandtiff1.testcase \
	writesectionbandtiff2.testcase \
	writesectionbandtiff3.testcase \
	writesectionbandtiff4.testcase \
	writesectionbandtiff5.testcase \
	writesectionbandtiff6.testcase \
	writesectionbandtiff7.testcase \
	writesectionbandtiff8.testcase \
	writesectionbandtiff9.testcase \
	writesectionbandtiff10.testcase \
	writesectionbandtiff11.testcase \
	writesectionbandtiff12.testcase \
	writesectionbandtiff13.testcase \
	writesectionbandtiff14.testcase \
	writesectionbandtiff15.testcase \
	writesectionbandtiff16.testcase \
	writesectionbandtiff17.testcase \
	writesectionbandtiff18.testcase \
	writesectionbandtiff19.testcase \
	writesectionbandtiff20.testcase \
	writesectionbandtiff21.testcase \
	writesectionbandtiff22.testcase \
	writesectionbandtiff23.testcase \
	writesectionbandtiff24.testcase \
	writesectionbandtiff25.testcase \
	writesectionbandtiff26.testcase \
	writesectionbandtiff27.testcase \
	writesectionbandtiff28.testcase \
	writesectionbandtifftfw1.testcase \
	writesectionbandtifftfw2.testcase \
	writesectionbandtifftfw3.testcase \
	writesectionbandtifftfw4.testcase \
	writesectionbandtifftfw5.testcase \
	writesectionbandtifftfw6.testcase \
	writesectionbandtifftfw7.testcase \
	writesectionbandtifftfw8.testcase \
	writesectionbandtifftfw9.testcase \
	writesectionbandtifftfw10.testcase \
	writesectionbandtifftfw11.testcase \
	writesectionbandtifftfw12.testcase \
	writesectionbandtifftfw13.testcase \
	writesectionbandtifftfw14.testcase \
	writesectionbandtifftfw15.testcase \
	writesectionbandtifftfw16.testcase \
	writesectionbandtifftfw17.testcase \
	writesectionbandtifftfw18.testcase \
	writesectionbandtifftfw19.testcase \
	writesectionbandtifftfw20.testcase \
	writesectionbandtifftfw21.testcase \
	writesectionbandtifftfw22.testcase \
	writesectionbandtifftfw23.testcase \
	writesectionbandtifftfw24.testcase \
	writesectionbandtifftfw25.testcase \
	writesectionbandtifftfw26.testcase \
	writesectionbandtifftfw27.testcase \
	writesectionbandtifftfw28.testcase \
	writebandgeotiff1.testcase \
	writebandgeotiff2.testcase \
	writebandgeotiff3.testcase \
	writebandgeotiff4.testcase \
	writebandgeotiff5.testcase \
	writebandgeotiff6.testcase \
	writebandgeotiff7.testcase \
................................................................................
	writebandgeotiff22.testcase \
	writebandgeotiff23.testcase \
	writebandgeotiff24.testcase \
	writebandgeotiff25.testcase \
	writebandgeotiff26.testcase \
	writebandgeotiff27.testcase \
	writebandgeotiff28.testcase \
	writesectionbandgeotiff1.testcase \
	writesectionbandgeotiff2.testcase \
	writesectionbandgeotiff3.testcase \
	writesectionbandgeotiff4.testcase \
	writesectionbandgeotiff5.testcase \
	writesectionbandgeotiff6.testcase \
	writesectionbandgeotiff7.testcase \
	writesectionbandgeotiff8.testcase \
	writesectionbandgeotiff9.testcase \
	writesectionbandgeotiff10.testcase \
	writesectionbandgeotiff11.testcase \
	writesectionbandgeotiff12.testcase \
	writesectionbandgeotiff13.testcase \
	writesectionbandgeotiff14.testcase \
	writesectionbandgeotiff15.testcase \
	writesectionbandgeotiff16.testcase \
	writesectionbandgeotiff17.testcase \
	writesectionbandgeotiff18.testcase \
	writesectionbandgeotiff19.testcase \
	writesectionbandgeotiff20.testcase \
	writesectionbandgeotiff21.testcase \
	writesectionbandgeotiff22.testcase \
	writesectionbandgeotiff23.testcase \
	writesectionbandgeotiff24.testcase \
	writesectionbandgeotiff25.testcase \
	writesectionbandgeotiff26.testcase \
	writesectionbandgeotiff27.testcase \
	writesectionbandgeotiff28.testcase \
	writesectionbandgeotiff29.testcase \
	writemonotiff1.testcase \
	writemonotiff2.testcase \
	writemonotiff3.testcase \
	writemonotiff4.testcase \
	writemonotiff5.testcase \
	writemonotiff6.testcase \
	writemonotiff7.testcase \
................................................................................
	writemonotiff15.testcase \
	writemonotiff16.testcase \
	writemonotiff17.testcase \
	writemonotiff18.testcase \
	writemonotiff19.testcase \
	writemonotiff20.testcase \
	writemonotiff21.testcase \
	writemonotifftfw1.testcase \
	writemonotifftfw2.testcase \
	writemonotifftfw3.testcase \
	writemonotifftfw4.testcase \
	writemonotifftfw5.testcase \
	writemonotifftfw6.testcase \
	writemonotifftfw7.testcase \
	writemonotifftfw8.testcase \
	writemonotifftfw9.testcase \
	writemonotifftfw10.testcase \
	writemonotifftfw11.testcase \
	writemonotifftfw12.testcase \
	writemonotifftfw13.testcase \
	writemonotifftfw14.testcase \
	writemonotifftfw15.testcase \
	writemonotifftfw16.testcase \
	writemonotifftfw17.testcase \
	writemonotifftfw18.testcase \
	writemonotifftfw19.testcase \
	writemonotifftfw20.testcase \
	writemonotifftfw21.testcase \
	writesectionmonotiff1.testcase \
	writesectionmonotiff2.testcase \
	writesectionmonotiff3.testcase \
	writesectionmonotiff4.testcase \
	writesectionmonotiff5.testcase \
	writesectionmonotiff6.testcase \
	writesectionmonotiff7.testcase \
	writesectionmonotiff8.testcase \
	writesectionmonotiff9.testcase \
	writesectionmonotiff10.testcase \
	writesectionmonotiff11.testcase \
	writesectionmonotiff12.testcase \
	writesectionmonotiff13.testcase \
	writesectionmonotiff14.testcase \
	writesectionmonotiff15.testcase \
	writesectionmonotiff16.testcase \
	writesectionmonotiff17.testcase \
	writesectionmonotiff18.testcase \
	writesectionmonotiff19.testcase \
	writesectionmonotiff20.testcase \
	writesectionmonotiff21.testcase \
	writesectionmonotiff22.testcase \
	writesectionmonotifftfw1.testcase \
	writesectionmonotifftfw2.testcase \
	writesectionmonotifftfw3.testcase \
	writesectionmonotifftfw4.testcase \
	writesectionmonotifftfw5.testcase \
	writesectionmonotifftfw6.testcase \
	writesectionmonotifftfw7.testcase \
	writesectionmonotifftfw8.testcase \
	writesectionmonotifftfw9.testcase \
	writesectionmonotifftfw10.testcase \
	writesectionmonotifftfw11.testcase \
	writesectionmonotifftfw12.testcase \
	writesectionmonotifftfw13.testcase \
	writesectionmonotifftfw14.testcase \
	writesectionmonotifftfw15.testcase \
	writesectionmonotifftfw16.testcase \
	writesectionmonotifftfw17.testcase \
	writesectionmonotifftfw18.testcase \
	writesectionmonotifftfw19.testcase \
	writesectionmonotifftfw20.testcase \
	writesectionmonotifftfw21.testcase \
	writesectionmonotifftfw22.testcase \
	writemonogeotiff1.testcase \
	writemonogeotiff2.testcase \
	writemonogeotiff3.testcase \
	writemonogeotiff4.testcase \
	writemonogeotiff5.testcase \
	writemonogeotiff6.testcase \
	writemonogeotiff7.testcase \
................................................................................
	writemonogeotiff16.testcase \
	writemonogeotiff17.testcase \
	writemonogeotiff18.testcase \
	writemonogeotiff19.testcase \
	writemonogeotiff20.testcase \
	writemonogeotiff21.testcase \
	writemonogeotiff22.testcase \
	writesectionmonogeotiff1.testcase \
	writesectionmonogeotiff2.testcase \
	writesectionmonogeotiff3.testcase \
	writesectionmonogeotiff4.testcase \
	writesectionmonogeotiff5.testcase \
	writesectionmonogeotiff6.testcase \
	writesectionmonogeotiff7.testcase \
	writesectionmonogeotiff8.testcase \
	writesectionmonogeotiff9.testcase \
	writesectionmonogeotiff10.testcase \
	writesectionmonogeotiff11.testcase \
	writesectionmonogeotiff12.testcase \
	writesectionmonogeotiff13.testcase \
	writesectionmonogeotiff14.testcase \
	writesectionmonogeotiff15.testcase \
	writesectionmonogeotiff16.testcase \
	writesectionmonogeotiff17.testcase \
	writesectionmonogeotiff18.testcase \
	writesectionmonogeotiff19.testcase \
	writesectionmonogeotiff20.testcase \
	writesectionmonogeotiff21.testcase \
	writesectionmonogeotiff22.testcase \
	writesectionmonogeotiff23.testcase \
	writegeotiff1.testcase \
	writegeotiff2.testcase \
	writegeotiff3.testcase \
	writegeotiff4.testcase \
	writegeotiff5.testcase \
	writegeotiff6.testcase \
	writegeotiff7.testcase \

Added test/sql_stmt_security_tests/writemonotifftfw1.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - NULL Coverage
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw(NULL, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw(NULL, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writemonotifftfw10.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - NULL tile-size
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'JPEG', NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'JPEG', NULL)
-1

Added test/sql_stmt_security_tests/writemonotifftfw11.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - invalid width (too small)
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 4, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'PNG', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 4, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'PNG', 512)
-1

Added test/sql_stmt_security_tests/writemonotifftfw12.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - invalid width (too big)
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1000004, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'FAX4', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1000004, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'FAX4', 512)
-1

Added test/sql_stmt_security_tests/writemonotifftfw13.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - invalid height (too small)
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 4, 0, MakePoint(1, 1), 0.5, 0.5, 'FAX3', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 4, 0, MakePoint(1, 1), 0.5, 0.5, 'FAX3', 512)
-1

Added test/sql_stmt_security_tests/writemonotifftfw14.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - invalid height (too big)
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1000004, 0, MakePoint(1, 1), 0.5, 0.5, 'DEFLATE', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1000004, 0, MakePoint(1, 1), 0.5, 0.5, 'DEFLATE', 512)
-1

Added test/sql_stmt_security_tests/writemonotifftfw15.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - invalid tile-size (too small)
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'LZW', 2);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'LZW', 2)
-1

Added test/sql_stmt_security_tests/writemonotifftfw16.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - invalid tile-size (too big)
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'LZMA', 2000000);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'LZMA', 2000000)
-1

Added test/sql_stmt_security_tests/writemonotifftfw17.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - not existing coverage (1)
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writemonotifftfw18.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - not existing coverage (2)
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writemonotifftfw19.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - NULL mono band
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, NULL, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, NULL, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writemonotifftfw2.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - NULL Path
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', NULL, 1024, 1024, 0, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', NULL, 1024, 1024, 0, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writemonotifftfw20.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - invalid mono band (too small)
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, -1, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, -1, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writemonotifftfw21.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - invalid mono band (too big)
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 500, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 500, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writemonotifftfw3.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - NULL Width
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', NULL, 1024, 0, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', NULL, 1024, 0, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writemonotifftfw4.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandiffTfw - NULL Height
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, NULL, 0, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, NULL, 0, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writemonotifftfw5.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - NULL Geometry
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, NULL, 0.5);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, NULL, 0.5)
-1

Added test/sql_stmt_security_tests/writemonotifftfw6.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - Invalid BLOB Geometry
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, zeroblob(100), 0.5);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, zeroblob(100), 0.5)
-1

Added test/sql_stmt_security_tests/writemonotifftfw7.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - NULL resolution
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, MakePoint(1, 1), NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, MakePoint(1, 1), NULL)
-1

Added test/sql_stmt_security_tests/writemonotifftfw8.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - NULL vertical resolution
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, NULL)
-1

Added test/sql_stmt_security_tests/writemonotifftfw9.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteMonoBandTiffTfw - NULL compression
:memory: #use in-memory database
SELECT RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteMonoBandTiffTfw('alpha', './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, NULL)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff1.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - NULL Coverage
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff(NULL, 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff(NULL, 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff10.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - NULL compression
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, NULL)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff11.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - NULL tile-size
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'JPEG', NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'JPEG', NULL)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff12.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - invalid width (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 4, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'PNG', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 4, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'PNG', 512)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff13.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - invalid width (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1000004, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'FAX4', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1000004, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'FAX4', 512)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff14.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - invalid height (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 4, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'FAX3', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 4, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'FAX3', 512)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff15.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - invalid height (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1000004, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'DEFLATE', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1000004, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'DEFLATE', 512)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff16.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - invalid tile-size (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'LZW', 2);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'LZW', 2)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff17.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - invalid tile-size (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'LZMA', 2000000);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'LZMA', 2000000)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff18.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - not existing coverage (1)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff19.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - not existing coverage (2)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 1, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 1, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff2.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - NULL Path
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, NULL, 1024, 1024, 0, 1, 2, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, NULL, 1024, 1024, 0, 1, 2, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff20.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - NULL red band
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, NULL, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, NULL, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff21.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - invalid red band (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, -1, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, -1, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff22.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - invalid red band (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 500, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 500, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff23.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - NULL green band
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, NULL, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, NULL, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff24.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - invalid green band (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, -1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, -1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff25.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - invalid green band (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 500, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 500, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff26.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - NULL blue band 
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, NULL, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, NULL, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff27.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - invalid blue band (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, -1, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, -1, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff28.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - invalid blue band (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 500, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 500, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff29.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - NULL Section
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', NULL, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', NULL, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff3.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - NULL Width
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', NULL, 1024, 0, 1, 2, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', NULL, 1024, 0, 1, 2, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff4.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - NULL Height
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, NULL, 0, 1, 2, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, NULL, 0, 1, 2, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff5.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - NULL Geometry
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, NULL, 0.5);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, NULL, 0.5)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff6.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - Invalid BLOB Geometry
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, zeroblob(100), 0.5);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, zeroblob(100), 0.5)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff7.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - NULL resolution
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), NULL)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff8.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - NULL vertical resolution
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, NULL)
-1

Added test/sql_stmt_security_tests/writesectionbandgeotiff9.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandGeoTiff - NULL with-worldfile
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 1, NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 1, NULL)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff1.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - NULL Coverage
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff(NULL, 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff(NULL, 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff10.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - NULL tile-size
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'JPEG', NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'JPEG', NULL)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff11.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - invalid width (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 4, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'PNG', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 4, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'PNG', 512)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff12.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - invalid width (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1000004, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'FAX4', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1000004, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'FAX4', 512)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff13.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - invalid height (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 4, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'FAX3', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 4, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'FAX3', 512)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff14.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - invalid height (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1000004, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'DEFLATE', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1000004, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'DEFLATE', 512)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff15.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - invalid tile-size (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'LZW', 2);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'LZW', 2)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff16.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - invalid tile-size (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'LZMA', 2000000);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'LZMA', 2000000)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff17.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - not existing coverage (1)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff18.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - not existing coverage (2)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff19.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - NULL red band
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, NULL, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, NULL, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff2.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - NULL Path
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, NULL, 1024, 1024, 0, 1, 2, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, NULL, 1024, 1024, 0, 1, 2, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff20.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - invalid red band (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, -1, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, -1, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff21.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - invalid red band (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 500, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 500, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff22.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - NULL green band
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, NULL, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, NULL, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff23.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - invalid green band (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, -1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, -1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff24.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - invalid green band (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 500, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 500, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff25.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - NULL blue band 
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, NULL, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, NULL, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff26.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - invalid blue band (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, -1, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, -1, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff27.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - invalid blue band (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 500, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 500, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff28.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - NULL Section
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', NULL, './test.tif', 1024, 1024, 0, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', NULL, './test.tif', 1024, 1024, 0, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff3.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - NULL Width
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', NULL, 1024, 0, 1, 2, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', NULL, 1024, 0, 1, 2, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff4.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandiff - NULL Height
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, NULL, 0, 1, 2, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, NULL, 0, 1, 2, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff5.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - NULL Geometry
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, NULL, 0.5);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, NULL, 0.5)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff6.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - Invalid BLOB Geometry
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, zeroblob(100), 0.5);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, zeroblob(100), 0.5)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff7.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - NULL resolution
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), NULL)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff8.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - NULL vertical resolution
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, NULL)
-1

Added test/sql_stmt_security_tests/writesectionbandtiff9.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiff - NULL compression
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, NULL)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw1.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - NULL Coverage
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw(NULL, 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw(NULL, 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw10.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - NULL tile-size
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'JPEG', NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'JPEG', NULL)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw11.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - invalid width (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 4, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'PNG', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 4, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'PNG', 512)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw12.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - invalid width (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1000004, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'FAX4', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1000004, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'FAX4', 512)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw13.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - invalid height (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 4, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'FAX3', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 4, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'FAX3', 512)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw14.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - invalid height (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1000004, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'DEFLATE', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1000004, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'DEFLATE', 512)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw15.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - invalid tile-size (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'LZW', 2);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'LZW', 2)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw16.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - invalid tile-size (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'LZMA', 2000000);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'LZMA', 2000000)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw17.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - not existing coverage (1)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw18.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - not existing coverage (2)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw19.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - NULL red band
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, NULL, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, NULL, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw2.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - NULL Path
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, NULL, 1024, 1024, 0, 1, 2, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, NULL, 1024, 1024, 0, 1, 2, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw20.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - invalid red band (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, -1, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, -1, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw21.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - invalid red band (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 500, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 500, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw22.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - NULL green band
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, NULL, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, NULL, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw23.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - invalid green band (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, -1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, -1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw24.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - invalid green band (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 500, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 500, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw25.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - NULL blue band 
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, NULL, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, NULL, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw26.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - invalid blue band (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, -1, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, -1, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw27.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - invalid blue band (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 500, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 500, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw28.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - NULL Section
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', NULL, './test.tif', 1024, 1024, 0, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', NULL, './test.tif', 1024, 1024, 0, 1, 2, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw3.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - NULL Width
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', NULL, 1024, 0, 1, 2, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', NULL, 1024, 0, 1, 2, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw4.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - NULL Height
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, NULL, 0, 1, 2, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, NULL, 0, 1, 2, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw5.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - NULL Geometry
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, NULL, 0.5);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, NULL, 0.5)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw6.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - Invalid BLOB Geometry
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, zeroblob(100), 0.5);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, zeroblob(100), 0.5)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw7.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - NULL resolution
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), NULL)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw8.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - NULL vertical resolution
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, NULL)
-1

Added test/sql_stmt_security_tests/writesectionbandtifftfw9.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionTripleBandTiffTfw - NULL compression
:memory: #use in-memory database
SELECT RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionTripleBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, 1, 2, MakePoint(1, 1), 0.5, 0.5, NULL)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff1.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - NULL Coverage
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff(NULL, 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff(NULL, 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff10.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - NULL compression
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 1, NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 1, NULL)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff11.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - NULL tile-size
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 1, 'JPEG', NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 1, 'JPEG', NULL)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff12.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - invalid width (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 4, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 1, 'PNG', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 4, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 1, 'PNG', 512)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff13.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - invalid width (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1000004, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 1, 'FAX4', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1000004, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 1, 'FAX4', 512)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff14.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - invalid height (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 4, 0, MakePoint(1, 1), 0.5, 0.5, 1, 'FAX3', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 4, 0, MakePoint(1, 1), 0.5, 0.5, 1, 'FAX3', 512)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff15.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - invalid height (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1000004, 0, MakePoint(1, 1), 0.5, 0.5, 1, 'DEFLATE', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1000004, 0, MakePoint(1, 1), 0.5, 0.5, 1, 'DEFLATE', 512)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff16.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - invalid tile-size (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 1, 'LZW', 2);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 1, 'LZW', 2)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff17.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - invalid tile-size (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 1, 'LZMA', 2000000);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 1, 'LZMA', 2000000)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff18.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - not existing coverage (1)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff19.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - not existing coverage (2)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, BuildMbr(1, 1, 10, 10), 1, 1, 1, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, BuildMbr(1, 1, 10, 10), 1, 1, 1, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff2.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - NULL Path
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, NULL, 1024, 1024, 0, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, NULL, 1024, 1024, 0, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff20.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - NULL mono band
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, NULL, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, NULL, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff21.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - invalid mono band (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, -1, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, -1, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff22.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - invalid mono band (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 500, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 500, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff23.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - NULL Section
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', NULL, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', NULL, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 1, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff3.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - NULL Width
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', NULL, 1024, 0, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', NULL, 1024, 0, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff4.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - NULL Height
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, NULL, 0, 1, 2, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, NULL, 0, 1, 2, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff5.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - NULL Geometry
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, NULL, 0.5);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, NULL, 0.5)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff6.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - Invalid BLOB Geometry
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, zeroblob(100), 0.5);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, zeroblob(100), 0.5)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff7.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - NULL resolution
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), NULL)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff8.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - NULL vertical resolution
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, NULL)
-1

Added test/sql_stmt_security_tests/writesectionmonogeotiff9.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandGeoTiff - NULL with-worldfile
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 1, NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandGeoTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 1, NULL)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff1.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - NULL Coverage
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff(NULL, 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff(NULL, 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff10.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - NULL tile-size
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'JPEG', NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'JPEG', NULL)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff11.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - invalid width (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 4, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'PNG', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 4, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'PNG', 512)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff12.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - invalid width (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1000004, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'FAX4', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1000004, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'FAX4', 512)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff13.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - invalid height (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 4, 0, MakePoint(1, 1), 0.5, 0.5, 'FAX3', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 4, 0, MakePoint(1, 1), 0.5, 0.5, 'FAX3', 512)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff14.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - invalid height (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1000004, 0, MakePoint(1, 1), 0.5, 0.5, 'DEFLATE', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1000004, 0, MakePoint(1, 1), 0.5, 0.5, 'DEFLATE', 512)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff15.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - invalid tile-size (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'LZW', 2);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'LZW', 2)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff16.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - invalid tile-size (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'LZMA', 2000000);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'LZMA', 2000000)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff17.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - not existing coverage (1)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff18.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - not existing coverage (2)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff19.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - NULL mono band
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, NULL, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, NULL, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff2.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - NULL Path
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, NULL, 1024, 1024, 0, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, NULL, 1024, 1024, 0, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff20.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - invalid mono band (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, -1, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, -1, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff21.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - invalid mono band (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 500, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 500, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff22.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - NULL Section
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', NULL, './test.tif', 1024, 1024, 0, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', NULL, './test.tif', 1024, 1024, 0, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff3.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - NULL Width
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', NULL, 1024, 0, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', NULL, 1024, 0, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff4.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandiff - NULL Height
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, NULL, 0, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, NULL, 0, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff5.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - NULL Geometry
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, NULL, 0.5);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, NULL, 0.5)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff6.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - Invalid BLOB Geometry
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, zeroblob(100), 0.5);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, zeroblob(100), 0.5)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff7.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - NULL resolution
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), NULL)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff8.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - NULL vertical resolution
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, NULL)
-1

Added test/sql_stmt_security_tests/writesectionmonotiff9.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiff - NULL compression
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiff('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, NULL)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw1.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - NULL Coverage
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw(NULL, 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw(NULL, 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw10.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - NULL tile-size
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'JPEG', NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'JPEG', NULL)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw11.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - invalid width (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 4, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'PNG', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 4, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'PNG', 512)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw12.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - invalid width (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1000004, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'FAX4', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1000004, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'FAX4', 512)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw13.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - invalid height (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 4, 0, MakePoint(1, 1), 0.5, 0.5, 'FAX3', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 4, 0, MakePoint(1, 1), 0.5, 0.5, 'FAX3', 512)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw14.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - invalid height (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1000004, 0, MakePoint(1, 1), 0.5, 0.5, 'DEFLATE', 512);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1000004, 0, MakePoint(1, 1), 0.5, 0.5, 'DEFLATE', 512)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw15.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - invalid tile-size (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'LZW', 2);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'LZW', 2)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw16.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - invalid tile-size (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'LZMA', 2000000);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'LZMA', 2000000)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw17.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - not existing coverage (1)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'NONE', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, 'NONE', 256)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw18.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - not existing coverage (2)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw19.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - NULL mono band
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, NULL, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, NULL, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw2.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - NULL Path
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, NULL, 1024, 1024, 0, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, NULL, 1024, 1024, 0, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw20.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - invalid mono band (too small)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, -1, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, -1, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw21.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - invalid mono band (too big)
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 500, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 500, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw22.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - NULL Section
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', NULL, './test.tif', 1024, 1024, 0, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', NULL, './test.tif', 1024, 1024, 0, BuildMbr(1, 1, 10, 10), 1, 1, 'JPEG', 256)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw3.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - NULL Width
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', NULL, 1024, 0, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', NULL, 1024, 0, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw4.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandiffTfw - NULL Height
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, NULL, 0, MakePoint(1, 1), 1);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, NULL, 0, MakePoint(1, 1), 1)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw5.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - NULL Geometry
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, NULL, 0.5);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, NULL, 0.5)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw6.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - Invalid BLOB Geometry
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, zeroblob(100), 0.5);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, zeroblob(100), 0.5)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw7.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - NULL resolution
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), NULL)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw8.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - NULL vertical resolution
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, NULL)
-1

Added test/sql_stmt_security_tests/writesectionmonotifftfw9.testcase.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
RL2_WriteSectionMonoBandTiffTfw - NULL compression
:memory: #use in-memory database
SELECT RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, NULL);
1 # rows (not including the header row)
1 # columns
RL2_WriteSectionMonoBandTiffTfw('alpha', 1, './test.tif', 1024, 1024, 0, MakePoint(1, 1), 0.5, 0.5, NULL)
-1

Changes to test/test_map_ascii.c.

395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
static int
test_coverage (sqlite3 * sqlite, unsigned char sample,
	       unsigned char compression, int tile_sz, int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    const char *sample_name;
    const char *pixel_name;
    unsigned char num_bands;
    const char *compression_name;
    int qlty;
    char *sql;
    int tile_size;
    gaiaGeomCollPtr geom;

/* setting the coverage name */
    switch (sample)
      {
      case RL2_SAMPLE_INT8:
	  switch (compression)







|
|
|
|
|


|







395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
static int
test_coverage (sqlite3 * sqlite, unsigned char sample,
	       unsigned char compression, int tile_sz, int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    const char *sample_name = NULL;
    const char *pixel_name = NULL;
    unsigned char num_bands = 1;
    const char *compression_name = NULL;
    int qlty;
    char *sql;
    int tile_size = 256;
    gaiaGeomCollPtr geom;

/* setting the coverage name */
    switch (sample)
      {
      case RL2_SAMPLE_INT8:
	  switch (compression)

Changes to test/test_map_gray.c.

494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
...
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
static int
test_coverage (sqlite3 * sqlite, unsigned char pixel, unsigned char compression,
	       int tile_sz, int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    const char *sample_name;
    const char *pixel_name;
    unsigned char num_bands;
    const char *compression_name;
    int qlty;
    char *sql;
    int tile_size;
    gaiaGeomCollPtr geom;

/* setting the coverage name */
    switch (pixel)
      {
      case RL2_PIXEL_GRAYSCALE:
	  switch (compression)
................................................................................
static int
drop_coverage (sqlite3 * sqlite, unsigned char pixel, unsigned char compression,
	       int tile_sz, int *retcode)
{
/* dropping some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    char *sql;

/* setting the coverage name */
    switch (pixel)
      {
      case RL2_PIXEL_GRAYSCALE:
	  switch (compression)







|
|
|
|
|
|

|







 







|







494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
...
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
static int
test_coverage (sqlite3 * sqlite, unsigned char pixel, unsigned char compression,
	       int tile_sz, int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    const char *sample_name = NULL;
    const char *pixel_name = NULL;
    unsigned char num_bands = 1;
    const char *compression_name = NULL;
    int qlty = 100;
    char *sql;
    int tile_size = 256;
    gaiaGeomCollPtr geom;

/* setting the coverage name */
    switch (pixel)
      {
      case RL2_PIXEL_GRAYSCALE:
	  switch (compression)
................................................................................
static int
drop_coverage (sqlite3 * sqlite, unsigned char pixel, unsigned char compression,
	       int tile_sz, int *retcode)
{
/* dropping some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    char *sql;

/* setting the coverage name */
    switch (pixel)
      {
      case RL2_PIXEL_GRAYSCALE:
	  switch (compression)

Changes to test/test_map_indiana.c.

448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
...
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
static int
test_coverage (sqlite3 * sqlite, unsigned char pixel, unsigned char compression,
	       int tile_sz, int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    const char *sample_name;
    const char *pixel_name;
    unsigned char num_bands;
    const char *compression_name;
    int qlty;
    char *sql;
    int tile_size;
    gaiaGeomCollPtr geom;
    sqlite3_int64 section_id;
    int duplicate;
    double x_res;
    double y_res;
    double minx;
    double miny;
................................................................................
static int
drop_coverage (sqlite3 * sqlite, unsigned char pixel, unsigned char compression,
	       int tile_sz, int *retcode)
{
/* dropping some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    char *sql;

/* setting the coverage name */
    switch (pixel)
      {
      case RL2_PIXEL_PALETTE:
	  switch (compression)







|
|
|
|
|
|

|







 







|







448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
...
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
static int
test_coverage (sqlite3 * sqlite, unsigned char pixel, unsigned char compression,
	       int tile_sz, int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    const char *sample_name = NULL;
    const char *pixel_name = NULL;
    unsigned char num_bands = 1;
    const char *compression_name = NULL;
    int qlty = 100;
    char *sql;
    int tile_size = 256;
    gaiaGeomCollPtr geom;
    sqlite3_int64 section_id;
    int duplicate;
    double x_res;
    double y_res;
    double minx;
    double miny;
................................................................................
static int
drop_coverage (sqlite3 * sqlite, unsigned char pixel, unsigned char compression,
	       int tile_sz, int *retcode)
{
/* dropping some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    char *sql;

/* setting the coverage name */
    switch (pixel)
      {
      case RL2_PIXEL_PALETTE:
	  switch (compression)

Changes to test/test_map_infrared.c.

701
702
703
704
705
706
707






































































































































































































































































































































































708
709
710
711
712
713
714
...
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
....
1416
1417
1418
1419
1420
1421
1422
1423










































































































































1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
    sqlite3_free (path);
    path =
	sqlite3_mprintf ("./%s_mono_tfw_%d_%d.tfw", coverage, scale, band_mix);
    unlink (path);
    sqlite3_free (path);
    return retcode;
}







































































































































































































































































































































































static int
do_export_map_image (sqlite3 * sqlite, const char *coverage,
		     gaiaGeomCollPtr geom, const char *style,
		     const char *suffix, int monolithic)
{
/* exporting a Map Image (full rendered) */
................................................................................
static int
test_coverage (sqlite3 * sqlite, unsigned char compression, int tile_sz,
	       int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    const char *sample_name;
    const char *pixel_name;
    unsigned char num_bands;
    const char *compression_name;
    int qlty;
    int tile_size;
    char *sql;
    gaiaGeomCollPtr geom;
    int test_map_image = 0;

/* setting the coverage name */
    switch (compression)
      {
................................................................................
	      (sqlite, coverage, geom, "ir_gray_gamma", "jpg", 1))
	    {
		*retcode += 74;
		return 0;
	    }
	  gaiaFreeGeomColl (geom);
      }











































































































































    return 1;
}

static int
drop_coverage (sqlite3 * sqlite, unsigned char compression, int tile_sz,
	       int *retcode)
{
/* dropping some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    char *sql;

/* setting the coverage name */
    switch (compression)
      {
      case RL2_COMPRESSION_NONE:
	  switch (tile_sz)







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
|
|
|
|
|
|







 








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>










|







701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
....
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
....
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
    sqlite3_free (path);
    path =
	sqlite3_mprintf ("./%s_mono_tfw_%d_%d.tfw", coverage, scale, band_mix);
    unlink (path);
    sqlite3_free (path);
    return retcode;
}

static int
do_export_section_triple_geotiff (sqlite3 * sqlite, const char *coverage,
				  gaiaGeomCollPtr geom, int scale)
{
/* exporting a Section TripleBand GeoTiff */
    char *sql;
    char *path;
    sqlite3_stmt *stmt;
    int ret;
    double x_res;
    double y_res;
    double xx_res;
    double yy_res;
    unsigned char *blob;
    int blob_size;
    int retcode = 0;
    unsigned char red_band = 0;
    unsigned char green_band = 1;
    unsigned char blue_band = 2;

    path = sqlite3_mprintf ("./%s_sect1_triple_gt_%d.tif", coverage, scale);

    if (!get_base_resolution (sqlite, coverage, &x_res, &y_res))
	return 0;
    xx_res = x_res * (double) scale;
    yy_res = y_res * (double) scale;

    sql =
	"SELECT RL2_WriteSectionTripleBandGeoTiff(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
    ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL);
    if (ret != SQLITE_OK)
	return 0;
    sqlite3_reset (stmt);
    sqlite3_clear_bindings (stmt);
    sqlite3_bind_text (stmt, 1, coverage, strlen (coverage), SQLITE_STATIC);
    sqlite3_bind_int64 (stmt, 2, 1);
    sqlite3_bind_text (stmt, 3, path, strlen (path), SQLITE_STATIC);
    sqlite3_bind_int (stmt, 4, 1024);
    sqlite3_bind_int (stmt, 5, 1024);
    sqlite3_bind_int (stmt, 6, red_band);
    sqlite3_bind_int (stmt, 7, green_band);
    sqlite3_bind_int (stmt, 8, blue_band);
    gaiaToSpatiaLiteBlobWkb (geom, &blob, &blob_size);
    sqlite3_bind_blob (stmt, 9, blob, blob_size, free);
    sqlite3_bind_double (stmt, 10, xx_res);
    sqlite3_bind_double (stmt, 11, yy_res);
    sqlite3_bind_int (stmt, 12, 0);
    sqlite3_bind_text (stmt, 13, "NONE", 4, SQLITE_TRANSIENT);
    ret = sqlite3_step (stmt);
    if (ret == SQLITE_DONE || ret == SQLITE_ROW)
      {
	  if (sqlite3_column_int (stmt, 0) == 1)
	      retcode = 1;
      }
    sqlite3_finalize (stmt);
    unlink (path);
    if (!retcode)
	fprintf (stderr, "ERROR: unable to export \"%s\"\n", path);
    sqlite3_free (path);
    return retcode;
}

static int
do_export_section_triple_tiff (sqlite3 * sqlite, const char *coverage,
			       gaiaGeomCollPtr geom, int scale)
{
/* exporting a Section TripleBand Tiff */
    char *sql;
    char *path;
    sqlite3_stmt *stmt;
    int ret;
    double x_res;
    double y_res;
    double xx_res;
    double yy_res;
    unsigned char *blob;
    int blob_size;
    int retcode = 0;
    unsigned char red_band = 0;
    unsigned char green_band = 1;
    unsigned char blue_band = 2;

    path = sqlite3_mprintf ("./%s_sect1_triple_tif_%d.tif", coverage, scale);

    if (!get_base_resolution (sqlite, coverage, &x_res, &y_res))
	return 0;
    xx_res = x_res * (double) scale;
    yy_res = y_res * (double) scale;

    sql =
	"SELECT RL2_WriteSectionTripleBandTiff(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
    ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL);
    if (ret != SQLITE_OK)
	return 0;
    sqlite3_reset (stmt);
    sqlite3_clear_bindings (stmt);
    sqlite3_bind_text (stmt, 1, coverage, strlen (coverage), SQLITE_STATIC);
    sqlite3_bind_int64 (stmt, 2, 1);
    sqlite3_bind_text (stmt, 3, path, strlen (path), SQLITE_STATIC);
    sqlite3_bind_int (stmt, 4, 1024);
    sqlite3_bind_int (stmt, 5, 1024);
    sqlite3_bind_int (stmt, 6, red_band);
    sqlite3_bind_int (stmt, 7, green_band);
    sqlite3_bind_int (stmt, 8, blue_band);
    gaiaToSpatiaLiteBlobWkb (geom, &blob, &blob_size);
    sqlite3_bind_blob (stmt, 9, blob, blob_size, free);
    sqlite3_bind_double (stmt, 10, xx_res);
    sqlite3_bind_double (stmt, 11, yy_res);
    sqlite3_bind_text (stmt, 12, "NONE", 4, SQLITE_TRANSIENT);
    ret = sqlite3_step (stmt);
    if (ret == SQLITE_DONE || ret == SQLITE_ROW)
      {
	  if (sqlite3_column_int (stmt, 0) == 1)
	      retcode = 1;
      }
    sqlite3_finalize (stmt);
    unlink (path);
    if (!retcode)
	fprintf (stderr, "ERROR: unable to export \"%s\"\n", path);
    sqlite3_free (path);
    return retcode;
}

static int
do_export_section_triple_tiff_tfw (sqlite3 * sqlite, const char *coverage,
				   gaiaGeomCollPtr geom, int scale)
{
/* exporting a Section TripleBand TiffTfw */
    char *sql;
    char *path;
    sqlite3_stmt *stmt;
    int ret;
    double x_res;
    double y_res;
    double xx_res;
    double yy_res;
    unsigned char *blob;
    int blob_size;
    int retcode = 0;
    unsigned char red_band = 0;
    unsigned char green_band = 1;
    unsigned char blue_band = 2;

    path = sqlite3_mprintf ("./%s_sect1_triple_tfw_%d.tif", coverage, scale);

    if (!get_base_resolution (sqlite, coverage, &x_res, &y_res))
	return 0;
    xx_res = x_res * (double) scale;
    yy_res = y_res * (double) scale;

    sql =
	"SELECT RL2_WriteSectionTripleBandTiffTfw(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
    ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL);
    if (ret != SQLITE_OK)
	return 0;
    sqlite3_reset (stmt);
    sqlite3_clear_bindings (stmt);
    sqlite3_bind_text (stmt, 1, coverage, strlen (coverage), SQLITE_STATIC);
    sqlite3_bind_int64 (stmt, 2, 1);
    sqlite3_bind_text (stmt, 3, path, strlen (path), SQLITE_STATIC);
    sqlite3_bind_int (stmt, 4, 1024);
    sqlite3_bind_int (stmt, 5, 1024);
    sqlite3_bind_int (stmt, 6, red_band);
    sqlite3_bind_int (stmt, 7, green_band);
    sqlite3_bind_int (stmt, 8, blue_band);
    gaiaToSpatiaLiteBlobWkb (geom, &blob, &blob_size);
    sqlite3_bind_blob (stmt, 9, blob, blob_size, free);
    sqlite3_bind_double (stmt, 10, xx_res);
    sqlite3_bind_double (stmt, 11, yy_res);
    sqlite3_bind_text (stmt, 12, "NONE", 4, SQLITE_TRANSIENT);
    ret = sqlite3_step (stmt);
    if (ret == SQLITE_DONE || ret == SQLITE_ROW)
      {
	  if (sqlite3_column_int (stmt, 0) == 1)
	      retcode = 1;
      }
    sqlite3_finalize (stmt);
    unlink (path);
    if (!retcode)
	fprintf (stderr, "ERROR: unable to export \"%s\"\n", path);
    sqlite3_free (path);
    path = sqlite3_mprintf ("./%s_sect1_triple_tfw_%d.tfw", coverage, scale);
    unlink (path);
    sqlite3_free (path);
    return retcode;
}

static int
do_export_section_mono_geotiff (sqlite3 * sqlite, const char *coverage,
				gaiaGeomCollPtr geom, int scale)
{
/* exporting a Section MonoBand GeoTiff */
    char *sql;
    char *path;
    sqlite3_stmt *stmt;
    int ret;
    double x_res;
    double y_res;
    double xx_res;
    double yy_res;
    unsigned char *blob;
    int blob_size;
    int retcode = 0;

    path = sqlite3_mprintf ("./%s_sect1_mono_gt_%d.tif", coverage, scale);

    if (!get_base_resolution (sqlite, coverage, &x_res, &y_res))
	return 0;
    xx_res = x_res * (double) scale;
    yy_res = y_res * (double) scale;

    sql =
	"SELECT RL2_WriteSectionMonoBandGeoTiff(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
    ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL);
    if (ret != SQLITE_OK)
	return 0;
    sqlite3_reset (stmt);
    sqlite3_clear_bindings (stmt);
    sqlite3_bind_text (stmt, 1, coverage, strlen (coverage), SQLITE_STATIC);
    sqlite3_bind_int64 (stmt, 2, 1);
    sqlite3_bind_text (stmt, 3, path, strlen (path), SQLITE_STATIC);
    sqlite3_bind_int (stmt, 4, 1024);
    sqlite3_bind_int (stmt, 5, 1024);
    sqlite3_bind_int (stmt, 6, 0);
    gaiaToSpatiaLiteBlobWkb (geom, &blob, &blob_size);
    sqlite3_bind_blob (stmt, 7, blob, blob_size, free);
    sqlite3_bind_double (stmt, 8, xx_res);
    sqlite3_bind_double (stmt, 9, yy_res);
    sqlite3_bind_int (stmt, 10, 0);
    sqlite3_bind_text (stmt, 11, "NONE", 4, SQLITE_TRANSIENT);
    ret = sqlite3_step (stmt);
    if (ret == SQLITE_DONE || ret == SQLITE_ROW)
      {
	  if (sqlite3_column_int (stmt, 0) == 1)
	      retcode = 1;
      }
    sqlite3_finalize (stmt);
    unlink (path);
    if (!retcode)
	fprintf (stderr, "ERROR: unable to export \"%s\"\n", path);
    sqlite3_free (path);
    return retcode;
}

static int
do_export_section_mono_tiff (sqlite3 * sqlite, const char *coverage,
			     gaiaGeomCollPtr geom, int scale)
{
/* exporting a Section MonoBand Tiff */
    char *sql;
    char *path;
    sqlite3_stmt *stmt;
    int ret;
    double x_res;
    double y_res;
    double xx_res;
    double yy_res;
    unsigned char *blob;
    int blob_size;
    int retcode = 0;

    path = sqlite3_mprintf ("./%s_sect1_mono_tif_%d.tif", coverage, scale);

    if (!get_base_resolution (sqlite, coverage, &x_res, &y_res))
	return 0;
    xx_res = x_res * (double) scale;
    yy_res = y_res * (double) scale;

    sql = "SELECT RL2_WriteSectionMonoBandTiff(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
    ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL);
    if (ret != SQLITE_OK)
	return 0;
    sqlite3_reset (stmt);
    sqlite3_clear_bindings (stmt);
    sqlite3_bind_text (stmt, 1, coverage, strlen (coverage), SQLITE_STATIC);
    sqlite3_bind_int64 (stmt, 2, 1);
    sqlite3_bind_text (stmt, 3, path, strlen (path), SQLITE_STATIC);
    sqlite3_bind_int (stmt, 4, 1024);
    sqlite3_bind_int (stmt, 5, 1024);
    sqlite3_bind_int (stmt, 6, 0);
    gaiaToSpatiaLiteBlobWkb (geom, &blob, &blob_size);
    sqlite3_bind_blob (stmt, 7, blob, blob_size, free);
    sqlite3_bind_double (stmt, 8, xx_res);
    sqlite3_bind_double (stmt, 9, yy_res);
    sqlite3_bind_text (stmt, 10, "NONE", 4, SQLITE_TRANSIENT);
    ret = sqlite3_step (stmt);
    if (ret == SQLITE_DONE || ret == SQLITE_ROW)
      {
	  if (sqlite3_column_int (stmt, 0) == 1)
	      retcode = 1;
      }
    sqlite3_finalize (stmt);
    unlink (path);
    if (!retcode)
	fprintf (stderr, "ERROR: unable to export \"%s\"\n", path);
    sqlite3_free (path);
    return retcode;
}

static int
do_export_section_mono_tiff_tfw (sqlite3 * sqlite, const char *coverage,
				 gaiaGeomCollPtr geom, int scale)
{
/* exporting a Section MonoBand Tiff */
    char *sql;
    char *path;
    sqlite3_stmt *stmt;
    int ret;
    double x_res;
    double y_res;
    double xx_res;
    double yy_res;
    unsigned char *blob;
    int blob_size;
    int retcode = 0;

    path = sqlite3_mprintf ("./%s_sect1_mono_tfw_%d.tif", coverage, scale);

    if (!get_base_resolution (sqlite, coverage, &x_res, &y_res))
	return 0;
    xx_res = x_res * (double) scale;
    yy_res = y_res * (double) scale;

    sql =
	"SELECT RL2_WriteSectionMonoBandTiffTfw(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
    ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL);
    if (ret != SQLITE_OK)
	return 0;
    sqlite3_reset (stmt);
    sqlite3_clear_bindings (stmt);
    sqlite3_bind_text (stmt, 1, coverage, strlen (coverage), SQLITE_STATIC);
    sqlite3_bind_int64 (stmt, 2, 1);
    sqlite3_bind_text (stmt, 3, path, strlen (path), SQLITE_STATIC);
    sqlite3_bind_int (stmt, 4, 1024);
    sqlite3_bind_int (stmt, 5, 1024);
    sqlite3_bind_int (stmt, 6, 0);
    gaiaToSpatiaLiteBlobWkb (geom, &blob, &blob_size);
    sqlite3_bind_blob (stmt, 7, blob, blob_size, free);
    sqlite3_bind_double (stmt, 8, xx_res);
    sqlite3_bind_double (stmt, 9, yy_res);
    sqlite3_bind_text (stmt, 10, "NONE", 4, SQLITE_TRANSIENT);
    ret = sqlite3_step (stmt);
    if (ret == SQLITE_DONE || ret == SQLITE_ROW)
      {
	  if (sqlite3_column_int (stmt, 0) == 1)
	      retcode = 1;
      }
    sqlite3_finalize (stmt);
    unlink (path);
    if (!retcode)
	fprintf (stderr, "ERROR: unable to export \"%s\"\n", path);
    sqlite3_free (path);
    path = sqlite3_mprintf ("./%s_sect1_mono_tfw_%d.tfw", coverage, scale);
    unlink (path);
    sqlite3_free (path);
    return retcode;
}

static int
do_export_map_image (sqlite3 * sqlite, const char *coverage,
		     gaiaGeomCollPtr geom, const char *style,
		     const char *suffix, int monolithic)
{
/* exporting a Map Image (full rendered) */
................................................................................
static int
test_coverage (sqlite3 * sqlite, unsigned char compression, int tile_sz,
	       int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    const char *sample_name = NULL;
    const char *pixel_name = NULL;
    unsigned char num_bands = 1;
    const char *compression_name = NULL;
    int qlty = 100;
    int tile_size = 256;
    char *sql;
    gaiaGeomCollPtr geom;
    int test_map_image = 0;

/* setting the coverage name */
    switch (compression)
      {
................................................................................
	      (sqlite, coverage, geom, "ir_gray_gamma", "jpg", 1))
	    {
		*retcode += 74;
		return 0;
	    }
	  gaiaFreeGeomColl (geom);
      }

    if (strcmp (coverage, "infrared_zip_1024") == 0)
      {
	  /* testing Band Composed Section */
	  geom = get_center_point (sqlite, coverage);
	  if (geom == NULL)
	    {
		*retcode += -75;
		return 0;
	    }
	  /* GeoTiff TripleBand */
	  if (!do_export_section_triple_geotiff (sqlite, coverage, geom, 1))
	    {
		*retcode += -76;
		return 0;
	    }
	  if (!do_export_section_triple_geotiff (sqlite, coverage, geom, 2))
	    {
		*retcode += -77;
		return 0;
	    }
	  if (!do_export_section_triple_geotiff (sqlite, coverage, geom, 4))
	    {
		*retcode += -78;
		return 0;
	    }
	  if (!do_export_section_triple_geotiff (sqlite, coverage, geom, 8))
	    {
		*retcode += -79;
		return 0;
	    }
	  /* Tiff TripleBand */
	  if (!do_export_section_triple_tiff (sqlite, coverage, geom, 1))
	    {
		*retcode += -80;
		return 0;
	    }
	  if (!do_export_section_triple_tiff (sqlite, coverage, geom, 2))
	    {
		*retcode += -81;
		return 0;
	    }
	  if (!do_export_section_triple_tiff (sqlite, coverage, geom, 4))
	    {
		*retcode += -82;
		return 0;
	    }
	  if (!do_export_section_triple_tiff (sqlite, coverage, geom, 8))
	    {
		*retcode += -83;
		return 0;
	    }
	  /* TiffTfw TripleBand */
	  if (!do_export_section_triple_tiff_tfw (sqlite, coverage, geom, 1))
	    {
		*retcode += -84;
		return 0;
	    }
	  if (!do_export_section_triple_tiff_tfw (sqlite, coverage, geom, 2))
	    {
		*retcode += -85;
		return 0;
	    }
	  if (!do_export_section_triple_tiff_tfw (sqlite, coverage, geom, 4))
	    {
		*retcode += -86;
		return 0;
	    }
	  if (!do_export_section_triple_tiff_tfw (sqlite, coverage, geom, 8))
	    {
		*retcode += -87;
		return 0;
	    }
	  /* GeoTiff MonoBand */
	  if (!do_export_section_mono_geotiff (sqlite, coverage, geom, 1))
	    {
		*retcode += -88;
		return 0;
	    }
	  if (!do_export_section_mono_geotiff (sqlite, coverage, geom, 2))
	    {
		*retcode += -89;
		return 0;
	    }
	  if (!do_export_section_mono_geotiff (sqlite, coverage, geom, 4))
	    {
		*retcode += -90;
		return 0;
	    }
	  if (!do_export_section_mono_geotiff (sqlite, coverage, geom, 8))
	    {
		*retcode += -91;
		return 0;
	    }
	  /* Tiff MonoBand */
	  if (!do_export_section_mono_tiff (sqlite, coverage, geom, 1))
	    {
		*retcode += -92;
		return 0;
	    }
	  if (!do_export_section_mono_tiff (sqlite, coverage, geom, 2))
	    {
		*retcode += -93;
		return 0;
	    }
	  if (!do_export_section_mono_tiff (sqlite, coverage, geom, 4))
	    {
		*retcode += -94;
		return 0;
	    }
	  if (!do_export_section_mono_tiff (sqlite, coverage, geom, 8))
	    {
		*retcode += -95;
		return 0;
	    }
	  /* TiffTfw MonoBand */
	  if (!do_export_section_mono_tiff_tfw (sqlite, coverage, geom, 1))
	    {
		*retcode += -97;
		return 0;
	    }
	  if (!do_export_section_mono_tiff_tfw (sqlite, coverage, geom, 2))
	    {
		*retcode += -98;
		return 0;
	    }
	  if (!do_export_section_mono_tiff_tfw (sqlite, coverage, geom, 4))
	    {
		*retcode += -99;
		return 0;
	    }
	  if (!do_export_section_mono_tiff_tfw (sqlite, coverage, geom, 8))
	    {
		*retcode += -100;
		return 0;
	    }
	  gaiaFreeGeomColl (geom);
      }

    return 1;
}

static int
drop_coverage (sqlite3 * sqlite, unsigned char compression, int tile_sz,
	       int *retcode)
{
/* dropping some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    char *sql;

/* setting the coverage name */
    switch (compression)
      {
      case RL2_COMPRESSION_NONE:
	  switch (tile_sz)

Changes to test/test_map_mono.c.

452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
...
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
static int
test_coverage (sqlite3 * sqlite, unsigned char pixel,
	       unsigned char compression, int tile_sz, int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    const char *sample_name;
    const char *pixel_name;
    unsigned char num_bands;
    const char *compression_name;
    const char *alt_compression_name = "NONE";
    int qlty;
    char *sql;
    int tile_size;
    gaiaGeomCollPtr geom;

/* setting the coverage name */
    switch (pixel)
      {
      case RL2_PIXEL_MONOCHROME:
	  switch (compression)
................................................................................
static int
drop_coverage (sqlite3 * sqlite, unsigned char pixel,
	       unsigned char compression, int tile_sz, int *retcode)
{
/* dropping some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    char *sql;

/* setting the coverage name */
    switch (pixel)
      {
      case RL2_PIXEL_MONOCHROME:
	  switch (compression)







|
|
|
|
|

|

|







 







|







452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
...
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
static int
test_coverage (sqlite3 * sqlite, unsigned char pixel,
	       unsigned char compression, int tile_sz, int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    const char *sample_name = NULL;
    const char *pixel_name = NULL;
    unsigned char num_bands = 1;
    const char *compression_name = NULL;
    const char *alt_compression_name = "NONE";
    int qlty = 100;
    char *sql;
    int tile_size = 256;
    gaiaGeomCollPtr geom;

/* setting the coverage name */
    switch (pixel)
      {
      case RL2_PIXEL_MONOCHROME:
	  switch (compression)
................................................................................
static int
drop_coverage (sqlite3 * sqlite, unsigned char pixel,
	       unsigned char compression, int tile_sz, int *retcode)
{
/* dropping some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    char *sql;

/* setting the coverage name */
    switch (pixel)
      {
      case RL2_PIXEL_MONOCHROME:
	  switch (compression)

Changes to test/test_map_nile_32.c.

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
static int
test_coverage (sqlite3 * sqlite, unsigned char sample, int tile_sz,
	       int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    const char *sample_name;
    const char *pixel_name;
    unsigned char num_bands;
    const char *compression_name;
    int qlty = 100;
    char *sql;
    int tile_size;

/* setting the coverage name */
    switch (sample)
      {
      case RL2_SAMPLE_INT8:
	  switch (tile_sz)
	    {







|
|
|
|
|


|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
static int
test_coverage (sqlite3 * sqlite, unsigned char sample, int tile_sz,
	       int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    const char *sample_name = NULL;
    const char *pixel_name = NULL;
    unsigned char num_bands = NULL;
    const char *compression_name = NULL;
    int qlty = 100;
    char *sql;
    int tile_size = 256;

/* setting the coverage name */
    switch (sample)
      {
      case RL2_SAMPLE_INT8:
	  switch (tile_sz)
	    {

Changes to test/test_map_nile_8.c.

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
static int
test_coverage (sqlite3 * sqlite, unsigned char sample, int tile_sz,
	       int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    const char *sample_name;
    const char *pixel_name;
    unsigned char num_bands;
    const char *compression_name;
    int qlty = 100;
    char *sql;
    int tile_size;

/* setting the coverage name */
    switch (sample)
      {
      case RL2_SAMPLE_INT8:
	  switch (tile_sz)
	    {







|
|
|
|
|


|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
static int
test_coverage (sqlite3 * sqlite, unsigned char sample, int tile_sz,
	       int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    const char *sample_name = NULL;
    const char *pixel_name = NULL;
    unsigned char num_bands = 1;
    const char *compression_name = NULL;
    int qlty = 100;
    char *sql;
    int tile_size = 256;

/* setting the coverage name */
    switch (sample)
      {
      case RL2_SAMPLE_INT8:
	  switch (tile_sz)
	    {

Changes to test/test_map_nile_dbl.c.

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
static int
test_coverage (sqlite3 * sqlite, unsigned char sample, int tile_sz,
	       int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    const char *sample_name;
    const char *pixel_name;
    unsigned char num_bands;
    const char *compression_name;
    int qlty = 100;
    char *sql;
    int tile_size;

/* setting the coverage name */
    switch (sample)
      {
      case RL2_SAMPLE_INT8:
	  switch (tile_sz)
	    {







|
|
|
|
|


|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
static int
test_coverage (sqlite3 * sqlite, unsigned char sample, int tile_sz,
	       int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    const char *sample_name = NULL;
    const char *pixel_name = NULL;
    unsigned char num_bands = 1;
    const char *compression_name = NULL;
    int qlty = 100;
    char *sql;
    int tile_size = 256;

/* setting the coverage name */
    switch (sample)
      {
      case RL2_SAMPLE_INT8:
	  switch (tile_sz)
	    {

Changes to test/test_map_nile_flt.c.

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
static int
test_coverage (sqlite3 * sqlite, unsigned char sample, int tile_sz,
	       int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    const char *sample_name;
    const char *pixel_name;
    unsigned char num_bands;
    const char *compression_name;
    int qlty = 100;
    char *sql;
    int tile_size;

/* setting the coverage name */
    switch (sample)
      {
      case RL2_SAMPLE_INT8:
	  switch (tile_sz)
	    {







|
|
|
|
|


|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
static int
test_coverage (sqlite3 * sqlite, unsigned char sample, int tile_sz,
	       int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    const char *sample_name = NULL;
    const char *pixel_name = NULL;
    unsigned char num_bands = 1;
    const char *compression_name = NULL;
    int qlty = 100;
    char *sql;
    int tile_size = 256;

/* setting the coverage name */
    switch (sample)
      {
      case RL2_SAMPLE_INT8:
	  switch (tile_sz)
	    {

Changes to test/test_map_nile_u16.c.

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
static int
test_coverage (sqlite3 * sqlite, unsigned char sample, int tile_sz,
	       int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    const char *sample_name;
    const char *pixel_name;
    unsigned char num_bands;
    const char *compression_name;
    int qlty = 100;
    char *sql;
    int tile_size;

/* setting the coverage name */
    switch (sample)
      {
      case RL2_SAMPLE_INT8:
	  switch (tile_sz)
	    {







|
|
|
|
|


|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
static int
test_coverage (sqlite3 * sqlite, unsigned char sample, int tile_sz,
	       int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    const char *sample_name = NULL;
    const char *pixel_name = NULL;
    unsigned char num_bands = 1; 
    const char *compression_name = NULL;
    int qlty = 100;
    char *sql;
    int tile_size = 256;

/* setting the coverage name */
    switch (sample)
      {
      case RL2_SAMPLE_INT8:
	  switch (tile_sz)
	    {

Changes to test/test_map_nile_u32.c.

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
static int
test_coverage (sqlite3 * sqlite, unsigned char sample, int tile_sz,
	       int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    const char *sample_name;
    const char *pixel_name;
    unsigned char num_bands;
    const char *compression_name;
    int qlty = 100;
    char *sql;
    int tile_size;

/* setting the coverage name */
    switch (sample)
      {
      case RL2_SAMPLE_INT8:
	  switch (tile_sz)
	    {







|
|
|
|
|


|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
static int
test_coverage (sqlite3 * sqlite, unsigned char sample, int tile_sz,
	       int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    const char *sample_name = NULL;
    const char *pixel_name = NULL;
    unsigned char num_bands = 0;
    const char *compression_name = NULL;
    int qlty = 100;
    char *sql;
    int tile_size = 256;

/* setting the coverage name */
    switch (sample)
      {
      case RL2_SAMPLE_INT8:
	  switch (tile_sz)
	    {

Changes to test/test_map_nile_u8.c.

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
static int
test_coverage (sqlite3 * sqlite, unsigned char sample, int tile_sz,
	       int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    const char *sample_name;
    const char *pixel_name;
    unsigned char num_bands;
    const char *compression_name;
    int qlty = 100;
    char *sql;
    int tile_size;

/* setting the coverage name */
    switch (sample)
      {
      case RL2_SAMPLE_INT8:
	  switch (tile_sz)
	    {







|
|
|
|
|


|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
static int
test_coverage (sqlite3 * sqlite, unsigned char sample, int tile_sz,
	       int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    const char *sample_name = NULL;
    const char *pixel_name = NULL;
    unsigned char num_bands = 1;
    const char *compression_name = NULL;
    int qlty = 100;
    char *sql;
    int tile_size = 256;

/* setting the coverage name */
    switch (sample)
      {
      case RL2_SAMPLE_INT8:
	  switch (tile_sz)
	    {

Changes to test/test_map_noref.c.

264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
...
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
static int
test_coverage (sqlite3 * sqlite, const char *prefix, unsigned char pixel,
	       unsigned char compression, int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    const char *sample_name;
    const char *pixel_name;
    unsigned char num_bands;
    const char *compression_name;
    int qlty;
    char *sql;
    int tile_size;
    gaiaGeomCollPtr geom;
    char *cov_name;
    const char *file_path;

/* setting the file path */
    if (strcmp (prefix, "noref-rgb") == 0)
	file_path = "./rgb-striped.tif";
................................................................................
static int
drop_coverage (sqlite3 * sqlite, const char *prefix, unsigned char pixel,
	       unsigned char compression, int *retcode)
{
/* dropping some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    char *cov_name;
    char *sql;

/* setting the coverage name */
    switch (pixel)
      {
      case RL2_PIXEL_RGB:







|
|
|
|
|
|

|







 







|







264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
...
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
static int
test_coverage (sqlite3 * sqlite, const char *prefix, unsigned char pixel,
	       unsigned char compression, int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    const char *sample_name = NULL;
    const char *pixel_name = NULL;
    unsigned char num_bands = 1;
    const char *compression_name = NULL;
    int qlty = 100;
    char *sql;
    int tile_size = 256;
    gaiaGeomCollPtr geom;
    char *cov_name;
    const char *file_path;

/* setting the file path */
    if (strcmp (prefix, "noref-rgb") == 0)
	file_path = "./rgb-striped.tif";
................................................................................
static int
drop_coverage (sqlite3 * sqlite, const char *prefix, unsigned char pixel,
	       unsigned char compression, int *retcode)
{
/* dropping some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    char *cov_name;
    char *sql;

/* setting the coverage name */
    switch (pixel)
      {
      case RL2_PIXEL_RGB:

Changes to test/test_map_orbetello.c.

842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
....
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
static int
test_coverage (sqlite3 * sqlite, unsigned char compression, int tile_sz,
	       int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    const char *sample_name;
    const char *pixel_name;
    unsigned char num_bands;
    const char *compression_name;
    int qlty;
    int tile_size;
    char *sql;
    gaiaGeomCollPtr geom;
    int test_map_image = 0;

/* setting the coverage name */
    switch (compression)
      {
................................................................................
static int
drop_coverage (sqlite3 * sqlite, unsigned char compression, int tile_sz,
	       int *retcode)
{
/* dropping some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    char *sql;

/* setting the coverage name */
    switch (compression)
      {
      case RL2_COMPRESSION_NONE:
	  switch (tile_sz)







|
|
|
|
|
|
|







 







|







842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
....
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
static int
test_coverage (sqlite3 * sqlite, unsigned char compression, int tile_sz,
	       int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    const char *sample_name = NULL;
    const char *pixel_name = NULL;
    unsigned char num_bands = 1;
    const char *compression_name = NULL;
    int qlty = 100;
    int tile_size = 256;
    char *sql;
    gaiaGeomCollPtr geom;
    int test_map_image = 0;

/* setting the coverage name */
    switch (compression)
      {
................................................................................
static int
drop_coverage (sqlite3 * sqlite, unsigned char compression, int tile_sz,
	       int *retcode)
{
/* dropping some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    char *sql;

/* setting the coverage name */
    switch (compression)
      {
      case RL2_COMPRESSION_NONE:
	  switch (tile_sz)

Changes to test/test_map_rgb.c.

391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
static int
test_coverage (sqlite3 * sqlite, unsigned char pixel,
	       unsigned char compression, int tile_sz, int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    const char *sample_name;
    const char *pixel_name;
    unsigned char num_bands;
    const char *compression_name;
    int qlty;
    char *sql;
    int tile_size;
    gaiaGeomCollPtr geom;

/* setting the coverage name */
    switch (pixel)
      {
      case RL2_PIXEL_RGB:
	  switch (compression)







|
|
|
|
|
|

|







391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
static int
test_coverage (sqlite3 * sqlite, unsigned char pixel,
	       unsigned char compression, int tile_sz, int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    const char *sample_name = NULL;
    const char *pixel_name = NULL;
    unsigned char num_bands = 1;
    const char *compression_name = NULL;
    int qlty = 100;
    char *sql;
    int tile_size = 256;
    gaiaGeomCollPtr geom;

/* setting the coverage name */
    switch (pixel)
      {
      case RL2_PIXEL_RGB:
	  switch (compression)

Changes to test/test_map_srtm.c.

384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
static int
test_coverage (sqlite3 * sqlite, unsigned char sample,
	       unsigned char compression, int tile_sz, int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    const char *sample_name;
    const char *pixel_name;
    unsigned char num_bands;
    const char *compression_name;
    int qlty;
    char *sql;
    int tile_size;
    gaiaGeomCollPtr geom;
    int test_map_image = 0;

/* setting the coverage name */
    switch (sample)
      {
      case RL2_SAMPLE_INT8:







|
|
|
|
|
|

|







384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
static int
test_coverage (sqlite3 * sqlite, unsigned char sample,
	       unsigned char compression, int tile_sz, int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    const char *sample_name = NULL;
    const char *pixel_name = NULL;
    unsigned char num_bands = 1;
    const char *compression_name = NULL;
    int qlty = 100;
    char *sql;
    int tile_size = 256;
    gaiaGeomCollPtr geom;
    int test_map_image = 0;

/* setting the coverage name */
    switch (sample)
      {
      case RL2_SAMPLE_INT8:

Changes to test/test_map_trento.c.

555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
...
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
static int
test_coverage (sqlite3 * sqlite, unsigned char pixel, unsigned char compression,
	       int type, int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    const char *sample_name;
    const char *pixel_name;
    unsigned char num_bands;
    const char *compression_name;
    const char *indir;
    const char *reload;
    int qlty;
    char *sql;
    int tile_size;
    gaiaGeomCollPtr geom;

    if (!type)
      {
	  indir = "map_samples/trento-gray";
	  reload = "map_samples/trento-gray/trento-gray1.jpg";
      }
................................................................................
static int
drop_coverage (sqlite3 * sqlite, unsigned char pixel, unsigned char compression,
	       int type, int *retcode)
{
/* dropping some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    char *sql;

/* setting the coverage name */
    switch (type)
      {
      case 0:
	  switch (pixel)







|
|
|
|
|


|

|







 







|







555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
...
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
static int
test_coverage (sqlite3 * sqlite, unsigned char pixel, unsigned char compression,
	       int type, int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    const char *sample_name = NULL;
    const char *pixel_name = NULL;
    unsigned char num_bands = 1;
    const char *compression_name = NULL;
    const char *indir;
    const char *reload;
    int qlty = 100;
    char *sql;
    int tile_size = 256;
    gaiaGeomCollPtr geom;

    if (!type)
      {
	  indir = "map_samples/trento-gray";
	  reload = "map_samples/trento-gray/trento-gray1.jpg";
      }
................................................................................
static int
drop_coverage (sqlite3 * sqlite, unsigned char pixel, unsigned char compression,
	       int type, int *retcode)
{
/* dropping some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    char *sql;

/* setting the coverage name */
    switch (type)
      {
      case 0:
	  switch (pixel)

Changes to test/test_map_trieste.c.

467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
...
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
static int
test_coverage (sqlite3 * sqlite, unsigned char pixel, unsigned char compression,
	       int tile_sz, int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    const char *sample_name;
    const char *pixel_name;
    unsigned char num_bands;
    const char *compression_name;
    int qlty;
    int tile_size;
    char *sql;
    gaiaGeomCollPtr geom;

/* setting the coverage name */
    switch (pixel)
      {
      case RL2_PIXEL_GRAYSCALE:
................................................................................
static int
drop_coverage (sqlite3 * sqlite, unsigned char compression, int tile_sz,
	       int *retcode)
{
/* dropping some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage;
    char *sql;

/* setting the coverage name */
    switch (compression)
      {
      case RL2_COMPRESSION_NONE:
	  switch (tile_sz)







|
|
|
|
|
|
|







 







|







467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
...
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
static int
test_coverage (sqlite3 * sqlite, unsigned char pixel, unsigned char compression,
	       int tile_sz, int *retcode)
{
/* testing some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    const char *sample_name = NULL;
    const char *pixel_name = NULL;
    unsigned char num_bands = 1;
    const char *compression_name = NULL;
    int qlty = 100;
    int tile_size = 256;
    char *sql;
    gaiaGeomCollPtr geom;

/* setting the coverage name */
    switch (pixel)
      {
      case RL2_PIXEL_GRAYSCALE:
................................................................................
static int
drop_coverage (sqlite3 * sqlite, unsigned char compression, int tile_sz,
	       int *retcode)
{
/* dropping some DBMS Coverage */
    int ret;
    char *err_msg = NULL;
    const char *coverage = NULL;
    char *sql;

/* setting the coverage name */
    switch (compression)
      {
      case RL2_COMPRESSION_NONE:
	  switch (tile_sz)

Changes to test/test_palette.c.

167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
		  int blob_size2, int *retcode)
{
    int ret;
    sqlite3 *db_handle;
    const char *sql;
    sqlite3_stmt *stmt;
    unsigned char *blob3 = NULL;
    int blob_size3;
    void *cache = spatialite_alloc_connection ();

/* opening and initializing the "memory" test DB */
    ret = sqlite3_open_v2 (":memory:", &db_handle,
			   SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
    if (ret != SQLITE_OK)
      {







|







167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
		  int blob_size2, int *retcode)
{
    int ret;
    sqlite3 *db_handle;
    const char *sql;
    sqlite3_stmt *stmt;
    unsigned char *blob3 = NULL;
    int blob_size3 = 0;
    void *cache = spatialite_alloc_connection ();

/* opening and initializing the "memory" test DB */
    ret = sqlite3_open_v2 (":memory:", &db_handle,
			   SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
    if (ret != SQLITE_OK)
      {

Changes to test/test_wr_tiff.c.

4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
    int bufpix_size;
    const double *p_in;
    double *p_out;
    rl2TiffDestinationPtr tiff = NULL;
    rl2RasterPtr raster;
    int tile_size = 128;
    const char *tfw_path;
    char *tfw;
    unsigned char xsample_type;
    unsigned char xpixel_type;
    unsigned char alias_pixel_type;
    unsigned char xnum_bands;
    if (tiled == 0)
	tile_size = 1;








|







4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
    int bufpix_size;
    const double *p_in;
    double *p_out;
    rl2TiffDestinationPtr tiff = NULL;
    rl2RasterPtr raster;
    int tile_size = 128;
    const char *tfw_path;
    char *tfw = NULL;
    unsigned char xsample_type;
    unsigned char xpixel_type;
    unsigned char alias_pixel_type;
    unsigned char xnum_bands;
    if (tiled == 0)
	tile_size = 1;

Changes to tools/rl2tool.c.

2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
....
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
....
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
....
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
static void
spatialite_autocreate (sqlite3 * db)
{
/* attempting to perform self-initialization for a newly created DB */
    int ret;
    char sql[1024];
    char *err_msg = NULL;
    int count;
    int i;
    char **results;
    int rows;
    int columns;

/* checking if this DB is really empty */
    strcpy (sql, "SELECT Count(*) from sqlite_master");
................................................................................
{
/* attempting to parse a NO-DATA pixel value */
    int band = 0;
    char *num = NULL;
    const char *p;
    const char *start;
    const char *end;
    char int8_value;
    unsigned char uint8_value;
    short int16_value;
    unsigned short uint16_value;
    int int32_value;
    unsigned int uint32_value;
    float flt_value;
    double dbl_value;
    rl2PixelPtr pixel = NULL;

    switch (pixel_type)
      {
      case RL2_PIXEL_MONOCHROME:
	  num_bands = 1;
	  break;
................................................................................
    const char *db_path = NULL;
    const char *src_path = NULL;
    const char *dst_path = NULL;
    const char *dir_path = NULL;
    const char *file_ext = ".tif";
    const char *coverage = NULL;
    const char *section = NULL;
    sqlite3_int64 section_id;
    int ok_section_id = 0;
    unsigned char sample = RL2_SAMPLE_UNKNOWN;
    unsigned char pixel = RL2_PIXEL_UNKNOWN;
    unsigned char compression = RL2_COMPRESSION_NONE;
    unsigned char num_bands = RL2_BANDS_UNKNOWN;
    unsigned char band_index = 0;
    int quality = -1;
................................................................................
    int in_memory = 0;
    int cache_size = 0;
    int journal_off = 0;
    int full_section = 0;
    int error = 0;
    int mode = ARG_NONE;
    void *cache;
    void *cache_mem;
    char *hist_path = NULL;
    int strict_resolution = 0;
    int mixed_resolutions = 0;
    int section_paths = 0;
    int section_md5 = 1;
    int section_summary = 1;








|







 







|
|
|
|
|
|
|
|







 







|







 







|







2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
....
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
....
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
....
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
static void
spatialite_autocreate (sqlite3 * db)
{
/* attempting to perform self-initialization for a newly created DB */
    int ret;
    char sql[1024];
    char *err_msg = NULL;
    int count = 0;
    int i;
    char **results;
    int rows;
    int columns;

/* checking if this DB is really empty */
    strcpy (sql, "SELECT Count(*) from sqlite_master");
................................................................................
{
/* attempting to parse a NO-DATA pixel value */
    int band = 0;
    char *num = NULL;
    const char *p;
    const char *start;
    const char *end;
    char int8_value = 0;
    unsigned char uint8_value = 0;
    short int16_value = 0;
    unsigned short uint16_value = 0;
    int int32_value = 0;
    unsigned int uint32_value = 0;
    float flt_value = 0.0;
    double dbl_value = 0.0;
    rl2PixelPtr pixel = NULL;

    switch (pixel_type)
      {
      case RL2_PIXEL_MONOCHROME:
	  num_bands = 1;
	  break;
................................................................................
    const char *db_path = NULL;
    const char *src_path = NULL;
    const char *dst_path = NULL;
    const char *dir_path = NULL;
    const char *file_ext = ".tif";
    const char *coverage = NULL;
    const char *section = NULL;
    sqlite3_int64 section_id = 0;
    int ok_section_id = 0;
    unsigned char sample = RL2_SAMPLE_UNKNOWN;
    unsigned char pixel = RL2_PIXEL_UNKNOWN;
    unsigned char compression = RL2_COMPRESSION_NONE;
    unsigned char num_bands = RL2_BANDS_UNKNOWN;
    unsigned char band_index = 0;
    int quality = -1;
................................................................................
    int in_memory = 0;
    int cache_size = 0;
    int journal_off = 0;
    int full_section = 0;
    int error = 0;
    int mode = ARG_NONE;
    void *cache;
    void *cache_mem = NULL;
    char *hist_path = NULL;
    int strict_resolution = 0;
    int mixed_resolutions = 0;
    int section_paths = 0;
    int section_md5 = 1;
    int section_summary = 1;

Changes to tools/wmslite.c.

1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
static char *
get_current_timestamp ()
{
/* formatting the current timestamp */
    char *dummy;
    struct tm *xtm;
    time_t now;
    const char *day;
    const char *month;
    time (&now);
    xtm = gmtime (&now);
    switch (xtm->tm_wday)
      {
      case 0:
	  day = "Sun";
	  break;







|
|







1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
static char *
get_current_timestamp ()
{
/* formatting the current timestamp */
    char *dummy;
    struct tm *xtm;
    time_t now;
    const char *day = NULL;
    const char *month = NULL;
    time (&now);
    xtm = gmtime (&now);
    switch (xtm->tm_wday)
      {
      case 0:
	  day = "Sun";
	  break;