Check-in [504e3f9a0e]
Not logged in

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

Overview
Comment:add a test case supporting EXIF-GPS
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 504e3f9a0eaa534ab6d78a2e104a20fdcbd6809a
User & Date: sandro 2012-03-27 00:34:06
Context
2012-03-27
10:08
fixing small issues related to NaN representation on Windows own printf() check-in: 1207a6772b user: sandro tags: trunk
00:34
add a test case supporting EXIF-GPS check-in: 504e3f9a0e user: sandro tags: trunk
2012-03-26
22:01
Fix handling of positive points in Shift_Longitude check-in: 63314fc228 user: bradh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/gaiageo/gg_transform.c.

422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
...
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
...
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
		  }
		else
		  {
		      gaiaGetPoint (line->Coords, iv, &x, &y);
		  }
		if (x < 0)
		  {
		    x += 360.0;
		  }
		if (line->DimensionModel == GAIA_XY_Z)
		  {
		      gaiaSetPointXYZ (line->Coords, iv, x, y, z);
		  }
		else if (line->DimensionModel == GAIA_XY_M)
		  {
................................................................................
		  }
		else
		  {
		      gaiaGetPoint (ring->Coords, iv, &x, &y);
		  }
		if (x < 0)
		  {
		    x += 360.0;
		  }
		if (ring->DimensionModel == GAIA_XY_Z)
		  {
		      gaiaSetPointXYZ (ring->Coords, iv, x, y, z);
		  }
		else if (ring->DimensionModel == GAIA_XY_M)
		  {
................................................................................
			    gaiaGetPointXYZM (ring->Coords, iv, &x, &y, &z, &m);
			}
		      else
			{
			    gaiaGetPoint (ring->Coords, iv, &x, &y);
			}
		      if (x < 0)
		        {
			  x += 360.0;
			}
		      if (ring->DimensionModel == GAIA_XY_Z)
			{
			    gaiaSetPointXYZ (ring->Coords, iv, x, y, z);
			}
		      else if (ring->DimensionModel == GAIA_XY_M)
			{







|







 







|







 







|
|







422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
...
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
...
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
		  }
		else
		  {
		      gaiaGetPoint (line->Coords, iv, &x, &y);
		  }
		if (x < 0)
		  {
		      x += 360.0;
		  }
		if (line->DimensionModel == GAIA_XY_Z)
		  {
		      gaiaSetPointXYZ (line->Coords, iv, x, y, z);
		  }
		else if (line->DimensionModel == GAIA_XY_M)
		  {
................................................................................
		  }
		else
		  {
		      gaiaGetPoint (ring->Coords, iv, &x, &y);
		  }
		if (x < 0)
		  {
		      x += 360.0;
		  }
		if (ring->DimensionModel == GAIA_XY_Z)
		  {
		      gaiaSetPointXYZ (ring->Coords, iv, x, y, z);
		  }
		else if (ring->DimensionModel == GAIA_XY_M)
		  {
................................................................................
			    gaiaGetPointXYZM (ring->Coords, iv, &x, &y, &z, &m);
			}
		      else
			{
			    gaiaGetPoint (ring->Coords, iv, &x, &y);
			}
		      if (x < 0)
			{
			    x += 360.0;
			}
		      if (ring->DimensionModel == GAIA_XY_Z)
			{
			    gaiaSetPointXYZ (ring->Coords, iv, x, y, z);
			}
		      else if (ring->DimensionModel == GAIA_XY_M)
			{

Changes to test/Makefile.am.

751
752
753
754
755
756
757

758
759
760
761
762
763
764
	sql_stmt_tests/distance4.testcase \
	sql_stmt_tests/distance5.testcase \
	sql_stmt_tests/distance6.testcase \
	sql_stmt_tests/distance7.testcase \
	sql_stmt_tests/distance8.testcase \
	sql_stmt_tests/dm_m.testcase \
	sql_stmt_tests/DSC_1467.JPG \

	sql_stmt_tests/emptyfile.txt \
	sql_stmt_tests/endpoint1.testcase \
	sql_stmt_tests/envelope1.testcase \
	sql_stmt_tests/envelope2.testcase \
	sql_stmt_tests/envelope3.testcase \
	sql_stmt_tests/envelope4.testcase \
	sql_stmt_tests/envelope5.testcase \







>







751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
	sql_stmt_tests/distance4.testcase \
	sql_stmt_tests/distance5.testcase \
	sql_stmt_tests/distance6.testcase \
	sql_stmt_tests/distance7.testcase \
	sql_stmt_tests/distance8.testcase \
	sql_stmt_tests/dm_m.testcase \
	sql_stmt_tests/DSC_1467.JPG \
	sql_stmt_tests/DSCN0042.JPG \
	sql_stmt_tests/emptyfile.txt \
	sql_stmt_tests/endpoint1.testcase \
	sql_stmt_tests/envelope1.testcase \
	sql_stmt_tests/envelope2.testcase \
	sql_stmt_tests/envelope3.testcase \
	sql_stmt_tests/envelope4.testcase \
	sql_stmt_tests/envelope5.testcase \

Changes to test/Makefile.in.

1059
1060
1061
1062
1063
1064
1065

1066
1067
1068
1069
1070
1071
1072
	sql_stmt_tests/distance4.testcase \
	sql_stmt_tests/distance5.testcase \
	sql_stmt_tests/distance6.testcase \
	sql_stmt_tests/distance7.testcase \
	sql_stmt_tests/distance8.testcase \
	sql_stmt_tests/dm_m.testcase \
	sql_stmt_tests/DSC_1467.JPG \

	sql_stmt_tests/emptyfile.txt \
	sql_stmt_tests/endpoint1.testcase \
	sql_stmt_tests/envelope1.testcase \
	sql_stmt_tests/envelope2.testcase \
	sql_stmt_tests/envelope3.testcase \
	sql_stmt_tests/envelope4.testcase \
	sql_stmt_tests/envelope5.testcase \







>







1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
	sql_stmt_tests/distance4.testcase \
	sql_stmt_tests/distance5.testcase \
	sql_stmt_tests/distance6.testcase \
	sql_stmt_tests/distance7.testcase \
	sql_stmt_tests/distance8.testcase \
	sql_stmt_tests/dm_m.testcase \
	sql_stmt_tests/DSC_1467.JPG \
	sql_stmt_tests/DSCN0042.JPG \
	sql_stmt_tests/emptyfile.txt \
	sql_stmt_tests/endpoint1.testcase \
	sql_stmt_tests/envelope1.testcase \
	sql_stmt_tests/envelope2.testcase \
	sql_stmt_tests/envelope3.testcase \
	sql_stmt_tests/envelope4.testcase \
	sql_stmt_tests/envelope5.testcase \

Changes to test/check_exif.c.

193
194
195
196
197
198
199


200
201
202
203
204
205
206
...
310
311
312
313
314
315
316




















































































































































































































































317
318
319
320
321
322
323
    char tag_name[128];
    char human[8192];
    gaiaExifTagPtr pT;
    sqlite3_int64 val64;
    const char *result;
    unsigned char *blob = NULL;
    gaiaExifTagListPtr tag_list = NULL;



    spatialite_init (0);
    
    fl = fopen("sql_stmt_tests/DSC_1467.JPG", "rb");
    if (!fl)
    if (ret != SQLITE_OK) {
	fprintf(stderr, "cannot open EXIF-JPEG image: DSC_1467.JPG\n");
................................................................................
        tag.TagId = i;
        gaiaExifTagGetName(&tag, tag_name, 128);
    }
    for (i = 0x0000; i < 0xffff; i++)
    {
        gaiaExifTag tag;
        tag.Gps = 1;




















































































































































































































































        tag.TagId = i;
        gaiaExifTagGetName(&tag, tag_name, 128);
    }

    if (blob)
        free(blob);
    if (tag_list)







>
>







 







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







193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
...
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
368
369
370
371
372
373
374
375
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
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
    char tag_name[128];
    char human[8192];
    gaiaExifTagPtr pT;
    sqlite3_int64 val64;
    const char *result;
    unsigned char *blob = NULL;
    gaiaExifTagListPtr tag_list = NULL;
    double longitude;
    double latitude;

    spatialite_init (0);
    
    fl = fopen("sql_stmt_tests/DSC_1467.JPG", "rb");
    if (!fl)
    if (ret != SQLITE_OK) {
	fprintf(stderr, "cannot open EXIF-JPEG image: DSC_1467.JPG\n");
................................................................................
        tag.TagId = i;
        gaiaExifTagGetName(&tag, tag_name, 128);
    }
    for (i = 0x0000; i < 0xffff; i++)
    {
        gaiaExifTag tag;
        tag.Gps = 1;
        tag.TagId = i;
        gaiaExifTagGetName(&tag, tag_name, 128);
    }

    if (blob)
        free(blob);
    if (tag_list)
        gaiaExifTagsFree(tag_list);
    fclose(fl);
       
    fl = fopen("sql_stmt_tests/DSCN0042.JPG", "rb");
    if (!fl)
    if (ret != SQLITE_OK) {
	fprintf(stderr, "cannot open EXIF-JPEG image: DSCN0042.JPG\n");
	return -100;
    }
    if (fseek(fl, 0, SEEK_END) == 0)
        sz = ftell(fl);
    if (sz <= 14) {
	fprintf(stderr, "invalid size EXIF-JPEG image: DSCN0042.JPG\n");
	return -17;
    }
    
    blob = (unsigned char *) malloc(sz);
    rewind(fl);
    rd = fread(blob, 1, sz, fl);
    if (rd != sz) {
	fprintf(stderr, "read error EXIF-JPEG image: DSCN0042.JPG\n");
	return -18;
    }
    
    tag_list = gaiaGetExifTags(blob, sz);
    if (tag_list == NULL) {
	fprintf(stderr, "cannot extract EXIF tags from JPEG image: DSCN0042.JPG\n");
	return -19;
    }

    val64 = get_pixel_x(tag_list, &ok);
    if (!ok) {
	fprintf(stderr, "DSCN0042.JPG: PixelX tag not found\n");
	return -20;
    }
    if (val64 != 640) {
	fprintf(stderr, "DSCN0042.JPG: PixelX unexpected value: %d\n", (int)val64);
	return -21;
    }

    val64 = get_pixel_y(tag_list, &ok); 
    if (!ok) {
	fprintf(stderr, "DSCN0042.JPG: PixelY tag not found\n");
	return -22;
    }
    if (val64 != 480) {
	fprintf(stderr, "DSCN0042.JPG: PixelY unexpected value: %d\n", (int)val64);
	return -23;
    }
  
    get_make(tag_list, &result, &ok);
    if (!ok) {
	fprintf(stderr, "DSCN0042.JPG: Make tag not found\n");
	return -24;
    }
    if (strcmp(result, "NIKON") != 0) {
	fprintf(stderr, "DSCN0042.JPG: Make unexpected value: %s|\n", result);
	return -25;
    };

    get_model(tag_list, &result, &ok);
    if (!ok) {
	fprintf(stderr, "DSCN0042.JPG: Model tag not found\n");
	return -26;
    }
    if (strcmp(result, "COOLPIX P6000") != 0) {
	fprintf(stderr, "DSCN0042.JPG: Model unexpected value: %s|\n", result);
	return -27;
    };

    get_date(tag_list, &result, &ok);
    if (!ok) {
	fprintf(stderr, "DSCN0042.JPG: Date tag not found\n");
	return -28;
    }
    if (strcmp(result, "2008:10:22 17:00:07") != 0) {
	fprintf(stderr, "DSCN0042.JPG: Date unexpected value: %s|\n", result);
	return -29;
    };
            
    for (i = 0; i < gaiaGetExifTagsCount(tag_list); i++)
    {
        pT = gaiaGetExifTagByPos(tag_list, i);
        if (pT)
        {
            gaiaExifTagGetName(pT, tag_name, 128);
            gaiaExifTagGetValueType(pT);
            gaiaIsExifGpsTag(pT);
            gaiaExifTagGetValueType(pT);
            gaiaExifTagGetNumValues(pT);
            gaiaExifTagGetHumanReadable (pT, human, 8190, &ok);
        }
    }

    pT = gaiaGetExifTagById (tag_list, 0x0112);
    if (pT == NULL) {
	fprintf(stderr, "DSCN0042.JPG: tag Orientation not found: %s|\n", result);
	return -30;
    };

    pT = gaiaGetExifTagByName (tag_list, "YCbCrPositioning");
    if (pT == NULL) {
	fprintf(stderr, "DSCN0042.JPG: tag YCbCrPositioning not found: %s|\n", result);
	return -31;
    };

    for (i = 0x0000; i < 0xffff; i++)
    {
        gaiaExifTag tag;
        tag.Gps = 0;
        tag.TagId = i;
        gaiaExifTagGetName(&tag, tag_name, 128);
    }
    for (i = 0x0000; i < 0xffff; i++)
    {
        gaiaExifTag tag;
        tag.Gps = 1;
        tag.TagId = i;
        gaiaExifTagGetName(&tag, tag_name, 128);
    }

    if (!gaiaGetGpsLatLong(blob, sz, human, 8192)) {
	fprintf(stderr, "cannot extract GPS coords from JPEG image: DSCN0042.JPG\n");
	return -32;
    }
    if (strcmp(human, "N 43.00 27.00 52.04 / E 11.00 52.00 53.32") != 0) {
	fprintf(stderr, "DSCN0042.JPG: GPS coords unexpected value: %s|\n", human);
	return -33;
    };
    if (!gaiaGetGpsLatLong(blob, sz, human, 20)) {
	fprintf(stderr, "cannot extract GPS coords(20) from JPEG image: DSCN0042.JPG\n");
	return -34;
    }
    if (strcmp(human, "N 43.00 27.00 52.04 ") != 0) {
	fprintf(stderr, "DSCN0042.JPG: GPS coords(20) unexpected value: %s|\n", human);
	return -35;
    };
    if (!gaiaGetGpsCoords(blob, sz, &longitude, &latitude)) {
	fprintf(stderr, "cannot extract GPS long/lat from JPEG image: DSCN0042.JPG\n");
	return -36;
    }
    if (longitude != 11.881478 || latitude != 43.464455) {
	fprintf(stderr, "DSCN0042.JPG: GPS long/lat unexpected values: %1.9f %1.9f|\n", longitude, latitude);
	return -37;
    };

    if (blob)
        free(blob);
    if (tag_list)
        gaiaExifTagsFree(tag_list);
    fclose(fl);
       
    fl = fopen("sql_stmt_tests/La_folla_durante_il_Palio.jpg", "rb");
    if (!fl)
    if (ret != SQLITE_OK) {
	fprintf(stderr, "cannot open EXIF-JPEG image: La_folla_durante_il_Palio.jpg\n");
	return -50;
    }
    if (fseek(fl, 0, SEEK_END) == 0)
        sz = ftell(fl);
    if (sz <= 14) {
	fprintf(stderr, "invalid size EXIF-JPEG image: La_folla_durante_il_Palio.jpg\n");
	return -51;
    }
    
    blob = (unsigned char *) malloc(sz);
    rewind(fl);
    rd = fread(blob, 1, sz, fl);
    if (rd != sz) {
	fprintf(stderr, "read error EXIF-JPEG image: La_folla_durante_il_Palio.jpg\n");
	return -52;
    }
    
    tag_list = gaiaGetExifTags(blob, sz);
    if (tag_list == NULL) {
	fprintf(stderr, "cannot extract EXIF tags from JPEG image: La_folla_durante_il_Palio.jpg\n");
	return -53;
    }

    val64 = get_pixel_x(tag_list, &ok);
    if (!ok) {
	fprintf(stderr, "La_folla_durante_il_Palio.jpg: PixelX tag not found\n");
	return -54;
    }
    if (val64 != 1280) {
	fprintf(stderr, "La_folla_durante_il_Palio.jpg: PixelX unexpected value: %d\n", (int)val64);
	return -55;
    }

    val64 = get_pixel_y(tag_list, &ok); 
    if (!ok) {
	fprintf(stderr, "La_folla_durante_il_Palio.jpg: PixelY tag not found\n");
	return -56;
    }
    if (val64 != 960) {
	fprintf(stderr, "La_folla_durante_il_Palio.jpg: PixelY unexpected value: %d\n", (int)val64);
	return -57;
    }
  
    get_make(tag_list, &result, &ok);
    if (!ok) {
	fprintf(stderr, "La_folla_durante_il_Palio.jpg: Make tag not found\n");
	return -58;
    }
    if (strcmp(result, "Nokia") != 0) {
	fprintf(stderr, "La_folla_durante_il_Palio.jpg: Make unexpected value: %s|\n", result);
	return -59;
    };

    get_model(tag_list, &result, &ok);
    if (!ok) {
	fprintf(stderr, "La_folla_durante_il_Palio.jpg: Model tag not found\n");
	return -60;
    }
    if (strcmp(result, "6630") != 0) {
	fprintf(stderr, "La_folla_durante_il_Palio.jpg: Model unexpected value: %s|\n", result);
	return -61;
    };
    
    for (i = 0; i < gaiaGetExifTagsCount(tag_list); i++)
    {
        pT = gaiaGetExifTagByPos(tag_list, i);
        if (pT)
        {
            gaiaExifTagGetName(pT, tag_name, 128);
            gaiaExifTagGetValueType(pT);
            gaiaIsExifGpsTag(pT);
            gaiaExifTagGetValueType(pT);
            gaiaExifTagGetNumValues(pT);
            gaiaExifTagGetHumanReadable (pT, human, 8190, &ok);
        }
    }

    for (i = 0x0000; i < 0xffff; i++)
    {
        gaiaExifTag tag;
        tag.Gps = 0;
        tag.TagId = i;
        gaiaExifTagGetName(&tag, tag_name, 128);
    }

    if (blob)
        free(blob);
    if (tag_list)

Added test/sql_stmt_tests/DSCN0042.JPG.

cannot compute difference between binary files

Added test/sql_stmt_tests/La_folla_durante_il_Palio.jpg.

cannot compute difference between binary files

Changes to test/sql_stmt_tests/testFDO.sqlite.

cannot compute difference between binary files

Changes to test/sql_stmt_tests/testFGF.sqlite.

cannot compute difference between binary files