39 static ossimTrace traceDebug(
"ossimTiffInfo:debug");
40 static ossimTrace traceDump(
"ossimTiffInfo:dump");
42 static const std::string PHOTO_INTERP[] =
54 static const std::string ANGULAR_UNITS_KW =
"angular_units";
55 static const std::string CENTER_LATITUDE__KW =
"center_latitude";
56 static const std::string CENTER_LONGITUDE_KW =
"center_longitude";
57 static const std::string COORD_TRANS_CODE_KW =
"coord_trans_code";
58 static const std::string FALSE_ORIGIN_LONGITUDE_KW =
"false_origin_longitude";
59 static const std::string FALSE_ORIGIN_LATITUDE_KW =
"false_origin_latitude";
60 static const std::string FALSE_ORIGIN_EASTING_KW =
"false_origin_easting";
61 static const std::string FALSE_ORIGIN_NORTHING_KW =
"false_origin_northing";
62 static const std::string GEODETIC_DATUM_KW =
"geodetic_datum";
63 static const std::string IMAGE_LENGTH_KW =
"image_length";
64 static const std::string IMAGE_WIDTH_KW =
"image_width";
65 static const std::string LINEAR_UNITS_KW =
"linear_units";
66 static const std::string MODEL_PIXEL_SCALE_KW =
"model_pixel_scale";
67 static const std::string MODEL_TIE_POINT_KW =
"model_tie_point";
68 static const std::string MODEL_TRANSFORM_KW =
"model_transform";
69 static const std::string MODEL_TYPE_KW =
"model_type";
70 static const std::string ORIGIN_LATITUDE_KW =
"origin_latitude";
71 static const std::string ORIGIN_LONGITUDE_KW =
"origin_longitude";
72 static const std::string RASTER_TYPE_KW =
"raster_type";
73 static const std::string VERTICAL_UNITS_KW =
"vertical_units";
95 if(!inStream)
return false;
100 const std::string& connectionString )
108 if (str&&str->good())
122 if (sysByteOrder != tifByteOrder)
143 ( (version == 42) || (version == 43) ) )
169 static const char MODULE[] =
"ossimTiffInfo::print";
174 << MODULE <<
" DEBUG Entered...\n";
205 if (sysByteOrder != tifByteOrder)
236 out <<
"tiff.version: " << int(version)
237 << ((version==42)?
"(classic)\n":
"(big)\n")
238 <<
"tiff.byte_order: ";
242 out <<
"big_endian\n";
246 out <<
"little_endian\n";
261 <<
"tiff.tag_value_length: " << tagValueLength <<
"\n";
267 std::streamoff seekOffset;
268 std::streampos streamPosition;
281 << MODULE <<
" FATAL ERROR - " 282 <<
"No offset to an image file directory found.\n" 283 <<
"Returning with error." 291 << MODULE <<
" DEBUG: " 292 <<
"Offset to first ifd: " << seekOffset
297 std::ios_base::fmtflags f = out.flags();
298 out << std::setprecision(15);
305 std::string prefix =
"tiff.";
307 out << prefix <<
"directory_offset: " << seekOffset <<
"\n";
332 << MODULE <<
" FATAL error reading number of direcories." 342 << MODULE <<
" DEBUG:\n" 343 <<
"ifd: " << seekOffset
344 <<
"\ntags in directory: " << nTags<<
"\n";
366 << MODULE <<
" FATAL error reading tag number." 381 << MODULE <<
" FATAL error reading type number." 399 << MODULE <<
" FATAL error reading count." 407 if (arraySizeInBytes == 0)
415 if (valueArray)
delete [] valueArray;
418 if (arraySizeInBytes <= tagValueLength)
424 if (arraySizeInBytes < tagValueLength)
455 << MODULE <<
" DEBUG:" 456 <<
"\ntag[" << tagIdx <<
"]:" << tag
457 <<
"\ntype: " << type
458 <<
"\ncount: " << count
459 <<
"\narray size in bytes: " << arraySizeInBytes
468 delete [] geoKeyBlock;
470 geoKeyBlock =
reinterpret_cast<ossim_uint16*
>(valueArray);
471 geoKeyLength = count;
476 if ( geoDoubleBlock )
478 delete [] geoDoubleBlock;
480 geoDoubleBlock =
reinterpret_cast<ossim_float64*
>(valueArray);
481 geoDoubleLength = count;
488 delete [] geoAsciiBlock;
490 geoAsciiBlock =
reinterpret_cast<ossim_int8*
>(valueArray);
491 geoAsciiLength = count;
507 delete [] valueArray;
523 geoDoubleLength,geoDoubleBlock,
524 geoAsciiLength,geoAsciiBlock);
526 delete [] geoKeyBlock;
532 delete [] geoDoubleBlock;
537 delete [] geoAsciiBlock;
553 << MODULE <<
" No offset to an image file directory found.\n" 554 <<
"Returning with error." 564 <<
"DEBUG ossimTiffInfo::readTags: " 565 <<
"Next Image File Directory(IFD) offset = " 566 << seekOffset <<
"\n";
592 << MODULE <<
" DEBUG Exited..." << std::endl;
601 static const char MODULE[] =
"ossimTiffInfo::print(std::istream&, std::ostream&)";
607 std::streampos startPosition = inStr.tellg();
621 if (sysByteOrder != tifByteOrder)
652 outStr <<
"tiff.version: " << int(version)
653 << ((version==42)?
"(classic)\n":
"(big)\n")
654 <<
"tiff.byte_order: ";
658 outStr <<
"big_endian\n";
662 outStr <<
"little_endian\n";
677 <<
"tiff.tag_value_length: " << tagValueLength <<
"\n";
683 std::streamoff seekOffset;
684 std::streampos streamPosition;
694 if (
getOffset(seekOffset, inStr, version) ==
false)
699 << MODULE <<
" FATAL ERROR - " 700 <<
"No offset to an image file directory found.\n" 701 <<
"Returning with error." 712 << MODULE <<
" DEBUG: " 713 <<
"Offset to first ifd: " << seekOffset
719 std::ios_base::fmtflags f = outStr.flags();
720 outStr << std::setprecision(15);
727 std::string prefix =
"tiff.";
730 outStr << prefix <<
"directory_offset: " << seekOffset <<
"\n";
733 inStr.seekg(startPosition+seekOffset, std::ios_base::beg);
755 << MODULE <<
" FATAL error reading number of direcories." 766 << MODULE <<
" DEBUG:\n" 767 <<
"ifd: " << seekOffset
768 <<
"\ntags in directory: " << nTags<<
"\n";
791 << MODULE <<
" FATAL error reading tag number." 806 << MODULE <<
" FATAL error reading type number." 823 << MODULE <<
" FATAL error reading count." 831 if (arraySizeInBytes == 0)
839 if (valueArray)
delete [] valueArray;
842 if (arraySizeInBytes <= tagValueLength)
845 inStr.read((
char*)valueArray, arraySizeInBytes);
848 if (arraySizeInBytes < tagValueLength)
851 inStr.ignore(tagValueLength-arraySizeInBytes);
860 streamPosition = inStr.tellg();
863 inStr.seekg(startPosition+seekOffset, std::ios_base::beg);
866 inStr.read((
char*)valueArray, arraySizeInBytes);
869 inStr.seekg(streamPosition);
879 << MODULE <<
" DEBUG:" 880 <<
"\ntag[" << tagIdx <<
"]:" << tag
881 <<
"\ntype: " << type
882 <<
"\ncount: " << count
883 <<
"\narray size in bytes: " << arraySizeInBytes
890 geoKeyBlock =
reinterpret_cast<ossim_uint16*
>(valueArray);
891 geoKeyLength = count;
896 geoDoubleBlock =
reinterpret_cast<ossim_float64*
>(valueArray);
897 geoDoubleLength = count;
902 geoAsciiBlock =
reinterpret_cast<ossim_int8*
>(valueArray);
903 geoAsciiLength = count;
919 delete [] valueArray;
935 geoDoubleLength,geoDoubleBlock,
936 geoAsciiLength,geoAsciiBlock);
938 delete [] geoKeyBlock;
944 delete [] geoDoubleBlock;
949 delete [] geoAsciiBlock;
960 if (
getOffset(seekOffset, inStr, version) ==
false)
965 << MODULE <<
" No offset to an image file directory found.\n" 966 <<
"Returning with error." 975 <<
"DEBUG ossimTiffInfo::readTags: " 976 <<
"Next Image File Directory(IFD) offset = " 977 << seekOffset <<
"\n";
1001 << MODULE <<
" DEBUG Exited..." << std::endl;
1010 static const char MODULE[] =
"ossimTiffInfo::getImageGeometry #1";
1016 bool result =
false;
1034 << MODULE <<
" exit status = " << (result?
"true":
"false") <<
"\n";
1044 static const char M[] =
"ossimTiffInfo::getImageGeometry #2";
1050 bool result =
false;
1061 if ( gtiffKwl.parseStream(in) )
1071 << M <<
" exit status = " << (result?
"true":
"false") <<
"\n";
1085 static const char M[] =
"ossimTiffInfo::getImageGeometry #3";
1094 geoKeyLength, geoKeyBlock,
1095 geoDoubleLength,geoDoubleBlock,
1096 geoAsciiLength,geoAsciiBlock);
1103 if ( gtiffKwl.parseStream(in) )
1119 static const char M[] =
"ossimTiffInfo::getImageGeometry #4";
1145 if (
getPixelType(gtiffPrefix, gtiffKwl, pixelType) ==
false )
1147 pixelType =
"pixel_is_point";
1185 bool isGeographic =
false;
1188 bool hasPcsCode =
getPcsCode(gtiffPrefix, gtiffKwl, pcsCode);
1195 if ( hasPcsCode && ( pcsCode !=
"4326" ) )
1206 ossimProjectionName =
"ossimEquDistCylProjection";
1210 if ( ossimProjectionName ==
"ossimEquDistCylProjection" )
1212 isGeographic =
true;
1218 getUnits(gtiffPrefix, gtiffKwl, units);
1223 if (ossimProjectionName ==
"ossimEquDistCylProjection")
1229 bool hasScale =
getPixelScale(gtiffPrefix, gtiffKwl, scale);
1232 std::vector<ossim_float64> ties;
1243 std::vector<ossim_float64> xfrm;
1246 bool useXfrm =
false;
1247 if ( xfrm.size() == 16 )
1250 if ( !hasScale && ties.size() < 24 )
1258 out << std::setprecision(15);
1260 for(idx =0; idx < 16; ++idx)
1262 out << xfrm[idx] <<
" ";
1266 out.str().c_str(),
true);
1269 units.
c_str(),
true);
1273 if ( hasScale && (tieCount == 1) )
1277 tie.
x = ties[3] - ties[0] * scale.
x;
1278 tie.
y = ties[4] + ties[1] * scale.
y;
1294 else if (tieCount > 1)
1308 <<
"Creating a bilinear projection\n";
1352 if (
getOriginLat(gtiffPrefix, gtiffKwl, tmpDbl) ==
false )
1354 if ( isGeographic && hasScale && scale.
x )
1399 LINEAR_UNITS_KW.c_str(),
1406 VERTICAL_UNITS_KW.c_str(),
1415 << M <<
" exit status = " << (result?
"true":
"false") <<
"\n";
1423 str.read((
char*)&s,
sizeof(s));
1432 str.read((
char*)&l,
sizeof(l));
1441 str.read((
char*)&l,
sizeof(l));
1458 offset = littleOffset;
1560 <<
"ossimTiffInfo::getTypeByteSize DEBUG:" 1561 <<
"\nUnhandled type: " << int(type) <<
"\n";
1617 const std::string& prefix,
1629 out << prefix <<
"sub_file_type: ";
1635 out << prefix << IMAGE_WIDTH_KW <<
": ";
1642 out << prefix << IMAGE_LENGTH_KW <<
": ";
1649 out << prefix <<
"bits_per_sample: ";
1654 else if (valueArray)
1665 out << prefix <<
"compression: ";
1683 out << prefix <<
"photo_interpretation: ";
1691 out << PHOTO_INTERP[s] <<
"\n";
1695 out <<
"range error!\n";
1705 out << prefix <<
"fill_order: ";
1716 out << prefix <<
"image_description: ";
1723 out << prefix <<
"make: ";
1730 out << prefix <<
"model: ";
1739 out << prefix <<
"bytes_per_strip: ";
1762 out << prefix <<
"samples_per_pixel: ";
1769 out << prefix <<
"rows_per_strip: ";
1778 out << prefix <<
"bytes_per_strip: ";
1794 out << prefix <<
"min_sample_value: ";
1800 out << prefix <<
"max_sample_value: ";
1807 out << prefix <<
"xresolution: ";
1813 out << prefix <<
"yresolution: ";
1822 out << prefix <<
"planar_configuration: ";
1827 out <<
"single image plane\n";
1831 out <<
"separate image planes\n";
1835 out <<
"unknown planar value!\n";
1843 out << prefix <<
"resolution_units: ";
1865 out << prefix <<
"page_number: ";
1869 out << prefix <<
"total_pages: ";
1878 out << prefix <<
"software: ";
1885 out << prefix <<
"date_time: ";
1892 out << prefix <<
"artist: ";
1899 out << prefix <<
"predictor: ";
1906 out << prefix <<
"tile_width: ";
1912 out << prefix <<
"tile_length: ";
1920 out << prefix <<
"tile_offsets: ";
1936 out << prefix <<
"tile_byte_counts: ";
1952 out << prefix <<
"subimage_descriptor: ";
1959 out << prefix <<
"tag 330 unhandled condition.\n";
1965 out << prefix <<
"extra_samples: ";
1972 out <<
"associated_alpha_data\n";
1977 out <<
"unassociated_alpha_data\n";
1982 out <<
"unspecified_data\n";
1990 out << prefix <<
"sample_format: ";
1996 else if (valueArray)
2003 s <<
"sample_format_string";
2008 out << prefix << s.str() <<
": ";
2015 out <<
"unsigned integer data\n";
2018 out <<
"signed integer data\n";
2021 out <<
"IEEE floating point data\n";
2024 out <<
"complex signed int\n";
2027 out <<
"complex ieee floating\n";
2031 out <<
"untyped data\n";
2039 out << prefix <<
"smin_sample_value: ";
2045 out << prefix <<
"smax_sample_value: ";
2055 << prefix <<
"xml: ";
2065 out << prefix <<
"copyright: ";
2071 out << prefix << MODEL_PIXEL_SCALE_KW <<
": ";
2077 out << prefix << MODEL_TIE_POINT_KW <<
": ";
2083 out << prefix << MODEL_TRANSFORM_KW <<
": ";
2089 out << prefix <<
"photoshop_image_resource_blocks: found\n";
2094 out << prefix <<
"double_params: ";
2100 out << prefix <<
"ascii_params: ";
2111 out << prefix <<
"gdal_nodata: ";
2118 printRpcs(out, prefix, type, count, valueArray);
2124 out << prefix <<
"unhandled_tag: " << tag <<
"\n";
2129 <<
"\ntag[" << tagIdx <<
"]: " << tag
2130 <<
"\ntype: " << type
2131 <<
"\ncount: " << count
2132 <<
"\narray size in bytes: " << arraySizeInBytes
2189 out << (num/den) <<
"\n";
2193 out << num <<
" / " << den <<
"\n";
2222 out <<
"print_value_unhandled type: " << type <<
"\n";
2262 if ( valueArray[i] != 0 )
2264 out << ((char)valueArray[i]);
2312 out <<
"print_array_unhandled type: " << type <<
"\n";
2319 out <<
"null array passed to ossimTiffInfo::printArray method." <<
"\n";
2325 const std::string& prefix,
2329 ossimString xmlString(valueArray, valueArray+count);
2332 if(xmlNode->
read(in))
2337 for(idx = 0; idx < children.size(); ++idx)
2339 out << prefix <<
"gdalmetadata." 2341 <<
":" << children[idx]->getText() << std::endl;
2348 const std::string& prefix,
2352 ossimString xmlString(valueArray, valueArray+count);
2359 if ( xdoc->
read( in ) )
2361 std::vector<ossimRefPtr<ossimXmlNode> > xnodes;
2364 ossimString path =
"/x:xmpmeta/rdf:RDF/rdf:Description/Camera:CentralWavelength";
2367 if ( xnodes.size() == 1 )
2369 if ( xnodes[0].valid() )
2371 result = xnodes[0]->getText();
2372 if ( result.
size() )
2374 out << prefix <<
"xmp.camera.central_wavelength: " << result <<
"\n";
2380 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/Camera:BandName";
2382 if ( xnodes.size() == 1 )
2384 if ( xnodes[0].valid() )
2386 result = xnodes[0]->getText();
2387 if ( result.
size() )
2389 out << prefix <<
"xmp.camera.band_name: " << result <<
"\n";
2395 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/Camera:WavelengthFWHM";
2397 if ( xnodes.size() == 1 )
2399 if ( xnodes[0].valid() )
2401 result = xnodes[0]->getText();
2402 if ( result.
size() )
2404 out << prefix <<
"xmp.camera.wavelength_fwhm: " << result <<
"\n";
2410 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/Camera:BandSensitivity";
2412 if ( xnodes.size() == 1 )
2414 if ( xnodes[0].valid() )
2416 result = xnodes[0]->getText();
2417 if ( result.
size() )
2419 out << prefix <<
"xmp.camera.band_sensitivity: " << result <<
"\n";
2425 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/Camera:RigCameraIndex";
2427 if ( xnodes.size() == 1 )
2429 if ( xnodes[0].valid() )
2431 result = xnodes[0]->getText();
2432 if ( result.
size() )
2434 out << prefix <<
"xmp.camera.rig_camera_index: " << result <<
"\n";
2440 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/Camera:Yaw";
2442 if ( xnodes.size() == 1 )
2444 if ( xnodes[0].valid() )
2446 result = xnodes[0]->getText();
2447 if ( result.
size() )
2449 out << prefix <<
"xmp.camera.yaw: " << result <<
"\n";
2455 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/Camera:Pitch";
2457 if ( xnodes.size() == 1 )
2459 if ( xnodes[0].valid() )
2461 result = xnodes[0]->getText();
2462 if ( result.
size() )
2464 out << prefix <<
"xmp.camera.pitch: " << result <<
"\n";
2470 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/Camera:Roll";
2472 if ( xnodes.size() == 1 )
2474 if ( xnodes[0].valid() )
2476 result = xnodes[0]->getText();
2477 if ( result.
size() )
2479 out << prefix <<
"xmp.camera.roll: " << result <<
"\n";
2490 const std::string& prefix,
2498 if (geoKeyLength && geoKeyBlock)
2523 <<
"DEBUG ossimTiffInfo::printGeoKeys" 2524 <<
"\nKey index: " << i
2525 <<
"\ngeo key: " << key
2527 <<
"\ncount: " << count
2528 <<
"\ncode: " << code
2554 if (geoAsciiBlock && ( (code+count) <= geoAsciiLength ) )
2560 s.push_back(geoAsciiBlock[code+i]);
2563 out << prefix <<
"citation: \"\"\"" << s <<
"\"\"\"\n";
2580 if (geoAsciiBlock && ( (code+count) <= geoAsciiLength ) )
2586 s.push_back(geoAsciiBlock[code+i]);
2589 out << prefix <<
"geographic_citation: \"\"\"" << s <<
"\"\"\"\n";
2597 out << prefix << GEODETIC_DATUM_KW <<
": " << code <<
"\n";
2603 out << prefix <<
"prime_meridian_code: " << code <<
"\n";
2609 out << prefix <<
"linear_units_code: " << code <<
"\n";
2616 out << prefix <<
"angular_units_code: " << code <<
"\n";
2626 if ( geoDoubleBlock && (code < geoDoubleLength) )
2629 out << prefix <<
"angular_units_size_radians: " 2630 << geoDoubleBlock[code] <<
"\n";
2638 out << prefix <<
"ellipsoid_code: " << code <<
"\n";
2647 if ( geoDoubleBlock && (code < geoDoubleLength) )
2650 out << prefix <<
"semi_major_axis: " << geoDoubleBlock[code] <<
"\n";
2661 if ( geoDoubleBlock && ( code < geoDoubleLength) )
2664 out << prefix <<
"semi_minor_axis: " << geoDoubleBlock[code] <<
"\n";
2675 if ( geoDoubleBlock && (code < geoDoubleLength) )
2678 out << prefix <<
"inverse_flattening_ratio: " << geoDoubleBlock[code] <<
"\n";
2689 if ( geoDoubleBlock && (code < geoDoubleLength) )
2692 out << prefix <<
"prime_meridian_longitude: " << geoDoubleBlock[code] <<
"\n";
2700 out << prefix <<
"pcs_code: " << code <<
"\n";
2708 if (geoAsciiBlock && ( (code+count) <= geoAsciiLength ) )
2714 s.push_back(geoAsciiBlock[code+i]);
2717 out << prefix <<
"pcs_citation: \"\"\"" << s <<
"\"\"\"\n";
2726 out << prefix <<
"proj_code: " << code <<
"\n";
2732 out << prefix << COORD_TRANS_CODE_KW <<
": " << code <<
"\n";
2739 out << prefix <<
"linear_units_code: " << code <<
"\n";
2749 if ( geoDoubleBlock && ( code < geoDoubleLength) )
2752 out << prefix <<
"linear_units_size: " << geoDoubleBlock[code] <<
"\n";
2763 if ( geoDoubleBlock && (code < geoDoubleLength) )
2768 << geoDoubleBlock[code] <<
"\n";
2779 if ( geoDoubleBlock && ( code < geoDoubleLength) )
2784 << geoDoubleBlock[code] <<
"\n";
2795 if ( geoDoubleBlock && ( code < geoDoubleLength) )
2798 out << prefix << ORIGIN_LONGITUDE_KW <<
": " 2799 << geoDoubleBlock[code] <<
"\n";
2810 if ( geoDoubleBlock && ( code < geoDoubleLength) )
2813 out << prefix << ORIGIN_LATITUDE_KW <<
": " 2814 << geoDoubleBlock[code] <<
"\n";
2825 if ( geoDoubleBlock && ( code < geoDoubleLength) )
2830 << geoDoubleBlock[code] <<
"\n";
2841 if ( geoDoubleBlock && ( code < geoDoubleLength) )
2847 << geoDoubleBlock[code] <<
"\n";
2858 if ( geoDoubleBlock && ( code < geoDoubleLength) )
2862 << FALSE_ORIGIN_LONGITUDE_KW <<
": " 2863 << geoDoubleBlock[code] <<
"\n";
2874 if ( geoDoubleBlock && ( code < geoDoubleLength) )
2878 << FALSE_ORIGIN_LATITUDE_KW <<
": " 2879 << geoDoubleBlock[code] <<
"\n";
2890 if ( geoDoubleBlock && ( code < geoDoubleLength) )
2894 << FALSE_ORIGIN_EASTING_KW<<
": " 2895 << geoDoubleBlock[code] <<
"\n";
2906 if ( geoDoubleBlock && ( code < geoDoubleLength) )
2910 << FALSE_ORIGIN_NORTHING_KW<<
": " 2911 << geoDoubleBlock[code] <<
"\n";
2922 if ( geoDoubleBlock && ( code < geoDoubleLength) )
2925 out << prefix <<
"center_longitude: " 2926 << geoDoubleBlock[code] <<
"\n";
2937 if ( geoDoubleBlock && ( code < geoDoubleLength) )
2940 out << prefix <<
"center_latitude: " 2941 << geoDoubleBlock[code] <<
"\n";
2952 if ( geoDoubleBlock && ( code < geoDoubleLength) )
2957 << geoDoubleBlock[code] <<
"\n";
2967 if ( geoDoubleBlock && ( code < geoDoubleLength) )
2972 << geoDoubleBlock[code] <<
"\n";
2982 if (geoAsciiBlock && ( (code+count) <= geoAsciiLength ) )
2988 s.push_back(geoAsciiBlock[code+i]);
2991 out << prefix <<
"vertical_citation: \"\"\"" << s <<
"\"\"\"\n";
2999 out << prefix <<
"vertical_units_code: " << code <<
"\n";
3010 if (geoAsciiBlock && ( (code+count) <= geoAsciiLength ) )
3016 s.push_back(geoAsciiBlock[code+i]);
3019 out << prefix <<
"key_" << key <<
": \"\"\"" << s <<
"\"\"\"\n";
3024 out << prefix <<
"unhandle_key: " << key <<
"\n";
3036 if (geoAsciiBlock && geoAsciiLength)
3039 <<
"ossimTiffInfo::printGeoKeys DEBUG: geo ascii block: ";
3040 std::string s(geoAsciiBlock, static_cast<std::string::size_type>(geoAsciiLength));
3051 const std::string& prefix,
3066 out << prefix <<
"rpc.bias_error: " << p[0] <<
"\n" 3067 << prefix <<
"rpc.rand_error: " << p[1] <<
"\n" 3068 << prefix <<
"rpc.line_off: " << p[2] <<
"\n" 3069 << prefix <<
"rpc.samp_off: " << p[3] <<
"\n" 3070 << prefix <<
"rpc.lat_off: " << p[4] <<
"\n" 3071 << prefix <<
"rpc.long_off: " << p[5] <<
"\n" 3072 << prefix <<
"rpc.height_off: " << p[6] <<
"\n" 3073 << prefix <<
"rpc.line_scale: " << p[7] <<
"\n" 3074 << prefix <<
"rpc.samp_scale: " << p[8] <<
"\n" 3075 << prefix <<
"rpc.lat_scale: " << p[9] <<
"\n" 3076 << prefix <<
"rpc.long_scale: " << p[10] <<
"\n" 3077 << prefix <<
"rpc.height_scale: " << p[11] <<
"\n";
3082 for (coeff = 0; coeff < 20; ++coeff)
3084 out << prefix <<
"rpc.line_num_coeff_" << std::setfill(
'0')
3085 << std::setw(2) << coeff <<
": " << p[i] <<
"\n";
3088 for (coeff = 0; coeff < 20; ++coeff)
3090 out << prefix <<
"rpc.line_den_coeff_" << std::setfill(
'0')
3091 << std::setw(2) << coeff <<
": " << p[i] <<
"\n";
3094 for (coeff = 0; coeff < 20; ++coeff)
3096 out << prefix <<
"rpc.samp_num_coeff_" << std::setfill(
'0')
3097 << std::setw(2) << coeff <<
": " << p[i] <<
"\n";
3100 for (coeff = 0; coeff < 20; ++coeff)
3102 out << prefix <<
"rpc.samp_den_coeff_" << std::setfill(
'0')
3103 << std::setw(2) << coeff <<
": " << p[i] <<
"\n";
3111 out <<
"print_rpcs_unhandled_type: " << type <<
"\n";
3118 out <<
"print_rpcs_invalid_count: " << count <<
"\n";
3123 out <<
"print_rpcs_error: null_array\n";
3129 const std::string& prefix,
3133 out << prefix << MODEL_TYPE_KW <<
": ";
3136 out <<
"projected\n";
3140 out <<
"geographic\n";
3144 out <<
"geocentric\n";
3154 const std::string& prefix,
3158 out << prefix << RASTER_TYPE_KW <<
": ";
3161 out <<
"pixel_is_area\n";
3165 out <<
"pixel_is_point\n";
3175 const std::string& prefix,
3179 out << prefix << ANGULAR_UNITS_KW <<
": ";
3194 out <<
"arc_minutes\n";
3199 out <<
"arc_seconds\n";
3219 out <<
"dms_hemisphere\n";
3232 const std::string& prefix,
3236 out << prefix <<
"coord_trans: ";
3241 out <<
"TransverseMercator\n";
3246 out <<
"TransvMercator_Modified_Alaska\n";
3251 out <<
"ObliqueMercator\n";
3256 out <<
"ObliqueMercator_Laborde\n";
3261 out <<
"ObliqueMercator_Rosenmund\n";
3266 out <<
"ObliqueMercator_Spherical\n";
3271 out <<
"Mercator\n";
3276 out <<
"LambertConfConic_2SP\n";
3281 out <<
"LambertConfConic_Helmert\n";
3286 out <<
"LambertAzimEqualArea\n";
3291 out <<
"AlbersEqualArea\n";
3296 out <<
"AzimuthalEquidistant\n";
3301 out <<
"EquidistantConic\n";
3306 out <<
"Stereographic\n";
3311 out <<
"PolarStereographic\n";
3316 out <<
"ObliqueStereographic\n";
3321 out <<
"Equirectangular\n";
3326 out <<
"CassiniSoldner\n";
3331 out <<
"Gnomonic\n";
3336 out <<
"MillerCylindrical\n";
3341 out <<
"Orthographic\n";
3346 out <<
"Polyconic\n";
3351 out <<
"Robinson\n";
3356 out <<
"Sinusoidal\n";
3361 out <<
"VanDerGrinten\n";
3366 out <<
"NewZealandMapGrid\n";
3371 out <<
"TransvMercator_SouthOriented\n";
3376 out << code <<
" unknown\n";
3384 const std::string& prefix,
3385 const std::string& key,
3389 out << prefix << key <<
": ";
3404 out <<
"us_survey_feet\n";
3409 out <<
"foot_modified_american\n";
3414 out <<
"foot_clarke\n";
3419 out <<
"foot_indian\n";
3429 out <<
"link_benoit\n";
3434 out <<
"link_sears\n";
3439 out <<
"chain_benoit\n";
3444 out <<
"chain_sears\n";
3449 out <<
"yard_sears\n";
3454 out <<
"yard_indian\n";
3464 out <<
"mile_international_nautical\n";
3469 out << code <<
" unknown\n";
3477 const std::string& prefix,
3481 out << prefix <<
"orientation: ";
3486 out <<
"top_left\n";
3491 out <<
"top_right\n";
3496 out <<
"bottom_right\n";
3501 out <<
"bottom_left\n";
3506 out <<
"left_top\n";
3511 out <<
"right_top\n";
3516 out <<
"right_bottom\n";
3521 out <<
"left_bottom\n";
3526 out << code <<
" unknown\n";
3534 std::string& prefix)
const 3547 bool result =
false;
3549 std::vector<ossim_float64> floats;
3550 if (
getFloats(gtiffPrefix, MODEL_PIXEL_SCALE_KW, gtiffKwl, floats) )
3552 if ( floats.size() == 3 )
3554 scale.
x = floats[0];
3555 scale.
y = floats[1];
3565 std::vector<ossim_float64>& ties)
const 3567 return getFloats(gtiffPrefix, MODEL_TIE_POINT_KW, gtiffKwl, ties);
3572 std::vector<ossim_float64>& xfrm)
const 3574 return getFloats(gtiffPrefix, MODEL_TRANSFORM_KW, gtiffKwl, xfrm);
3580 std::vector<ossim_float64>& floats)
const 3582 bool result =
false;
3584 const char* lookup = gtiffKwl.
find(gtiffPrefix.
c_str(), key.
c_str());
3595 std::vector<ossim_float64>& floats)
const 3597 bool result =
false;
3607 while ( ! is.fail() )
3609 floats.push_back(f);
3614 if ( floats.size() )
3626 bool result =
false;
3628 const char* lookup = gtiffKwl.
find(gtiffPrefix.
c_str(), GEODETIC_DATUM_KW.c_str());
3655 bool result =
false;
3662 datumCode =
"NAS-C";
3668 datumCode =
"NAR-C";
3686 if ( datumCode.
size() )
3697 bool result =
false;
3706 if ( code != 32767 )
3720 if (result ==
false)
3723 lookup = gtiffKwl.
find(gtiffPrefix.
c_str(),
"pcs_citation");
3740 if ( intCode != 32767 )
3769 if (modelType ==
"geographic")
3771 if (angularUnits.
size())
3773 units = angularUnits;
3780 else if (modelType ==
"projected")
3782 if (linearUnits.
size())
3784 units = linearUnits;
3804 bool result =
false;
3805 const char* lookup = gtiffKwl.
find(gtiffPrefix.
c_str(), LINEAR_UNITS_KW.c_str());
3808 linearUnits = lookup;
3818 bool result =
false;
3819 const char* lookup = gtiffKwl.
find(gtiffPrefix.
c_str(), VERTICAL_UNITS_KW.c_str());
3822 verticalUnits = lookup;
3832 bool result =
false;
3833 const char* lookup = gtiffKwl.
find(gtiffPrefix.
c_str(), ANGULAR_UNITS_KW.c_str());
3836 angularUnits = lookup;
3846 bool result =
false;
3847 const char* lookup = gtiffKwl.
find(gtiffPrefix.
c_str(), RASTER_TYPE_KW.c_str());
3860 bool result =
false;
3861 const char* lookup = gtiffKwl.
find(gtiffPrefix.
c_str(), MODEL_TYPE_KW.c_str());
3874 bool result =
false;
3876 const char* lookup = gtiffKwl.
find(gtiffPrefix.
c_str(), COORD_TRANS_CODE_KW.c_str());
3885 if (ossimProj.
size())
3897 const char* lookup = gtiffKwl.
find(gtiffPrefix.
c_str(), IMAGE_LENGTH_KW.c_str());
3909 const char* lookup = gtiffKwl.
find(gtiffPrefix.
c_str(), IMAGE_WIDTH_KW.c_str());
3921 bool result =
false;
3935 bool result =
false;
3949 bool result =
false;
3963 bool result =
false;
3977 bool result =
false;
3996 bool result =
false;
3998 const char* lookup =
4014 bool result =
false;
4019 const char* projOriginLatGeoKey =
4020 gtiffKwl.
find(gtiffPrefix.
c_str(), ORIGIN_LATITUDE_KW.c_str());
4026 if (projOriginLatGeoKey)
4033 const char* projCenterLatGeoKey =
4034 gtiffKwl.
find(gtiffPrefix.
c_str(), CENTER_LATITUDE__KW.c_str());
4036 if (projCenterLatGeoKey)
4043 const char* projFalseOriginLatGeoKey =
4045 FALSE_ORIGIN_LATITUDE_KW.c_str());
4047 if (projFalseOriginLatGeoKey)
4066 bool result =
false;
4071 const char* projCenterLongGeoKey =
4072 gtiffKwl.
find(gtiffPrefix.
c_str(), CENTER_LONGITUDE_KW.c_str());
4078 if (projCenterLongGeoKey)
4085 const char* projOriginLongGeoKey =
4086 gtiffKwl.
find(gtiffPrefix.
c_str(), ORIGIN_LONGITUDE_KW.c_str());
4088 if (projOriginLongGeoKey)
4095 const char* projFalseOriginLongGeoKey =
4097 FALSE_ORIGIN_LONGITUDE_KW.c_str());
4099 if (projFalseOriginLongGeoKey)
4121 const double* tiePointsPtr = &ties.front();
4128 for(idx = 0; idx < tieCount; ++idx)
4130 ossimDpt xyPixel(tiePointsPtr[0]+offset, tiePointsPtr[1]+offset);
4132 ossimGpt gpt(tiePointsPtr[4], tiePointsPtr[3], tiePointsPtr[5]);
4140 const std::vector<ossim_float64>& ties,
4143 bool result =
false;
4159 while (tieIndex < SIZE)
4161 if ( ties[tieIndex] < minX ) minX = ties[tieIndex];
4162 if ( ties[tieIndex] > maxX ) maxX = ties[tieIndex];
4163 if ( ties[tieIndex+1] < minY ) minY = ties[tieIndex+1];
4164 if ( ties[tieIndex+1] > maxY ) maxY = ties[tieIndex+1];
4168 if ( (minX == 1) && (maxX == width) &&
4169 (minY == 1) && (maxY == height) )
4178 <<
"ossimGeoTiff::hasOneBasedTiePoints DEBUG:" 4179 <<
"\nminX: " << minX
4180 <<
"\nmaxX: " << maxX
4181 <<
"\nminY: " << minY
4182 <<
"\nmaxY: " << maxY
4183 <<
"\ntheWidth: " << theWidth
4184 <<
"\ntheLength: " << theLength
4185 <<
"\none based: " << (result?
"true":
"false")
bool getTiePoint(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, std::vector< ossim_float64 > &ties) const
Gets the model_tie_point array.
void swapFourBytes(void *data, ossim_uint32 size) const
std::ostream & printRpcs(std::ostream &out, const std::string &prefix, ossim_uint16 type, ossim_uint64 count, ossim_uint8 *valueArray) const
Prints tag 50844.
void clear()
Erases the entire container.
void swapTwoBytes(void *data, ossim_uint32 size) const
char ossim_int8
Previous DLL import export section.
bool getFloats(const ossimString >iffPrefix, const ossimString &key, const ossimKeywordlist >iffKwl, std::vector< ossim_float64 > &floats) const
Extracts float values from keyword list that match key.
virtual ~ossimTiffInfo()
virtual destructor
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
void swapEightBytes(void *data, ossim_uint32 size) const
static const char * DATUM_KW
std::ostream & printAngularUnits(std::ostream &out, const std::string &prefix, ossim_uint16 code) const
Prints key 2054.
static const char * FALSE_EASTING_NORTHING_UNITS_KW
static const char * CENTRAL_MERIDIAN_KW
std::ostream & printGdalMetadata(std::ostream &out, const std::string &prefix, ossim_uint64 count, ossim_uint8 *valueArray) const
bool getPixelType(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, ossimString &pixelType) const
Gets the pixel type (point or area) from keyword list as a string.
Represents serializable keyword/value map.
bool getOffset(std::streamoff &offset, std::istream &str, ossim_uint16 version) const
This will read either 4 or 8 bytes depending on the version and initialize offset.
const char * find(const char *key) const
bool read(std::istream &in)
virtual ossim_uint32 getPcsCode() const
Returns the EPSG PCS code or 32767 if the projection is a custom (non-EPSG) projection.
virtual ossimString getEntryString(ossim_int32 entry_number) const
const ossimXmlNode::ChildListType & getChildNodes() const
double nan()
Method to return ieee floating point double precision NAN.
static const char * IMAGE_MODEL_TRANSFORM_MATRIX_KW
bool contains(char aChar) const
bool getImageGeometry(ossimKeywordlist &geomKwl, ossim_uint32 entryIndex) const
Extracts geometry info to keyword list.
static ossimString toString(bool aValue)
Numeric to string methods.
static const char * NUMBER_LINES_KW
bool getAngularUnits(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, ossimString &units) const
Gets the units from keyword list as a string.
ossim_uint16 getTypeByteSize(ossim_uint16 type) const
void readLongLong(ossim_uint64 &l, std::istream &str) const
Initializes l reference.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
OSSIM_DLL ossimByteOrder byteOrder()
std::string m_connectionString
ossim_uint32 toUInt32() const
std::shared_ptr< ossim::istream > m_inputStream
static StreamFactoryRegistry * instance()
bool getStdParallelTwo(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, ossimString &value) const
Gets the second standard parallel from keyword list.
unsigned short ossim_uint16
bool getFalseEasting(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, ossimString &value) const
Gets the false easting from keyword list.
void readLong(ossim_uint32 &l, std::istream &str) const
Initializes l reference.
static const char * TYPE_KW
bool getPixelScale(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, ossimDpt &scale) const
Gets the required pixel scale from keyword list looking for the key model_pixel_scale.
virtual double optimizeFit(const ossimTieGptSet &tieSet, double *targetVariance=0)
static const char * GCS_CODE_KW
void readShort(ossim_uint16 &s, std::istream &str) const
Initializes s reference.
std::vector< ossimRefPtr< ossimXmlNode > > ChildListType
void eatValue(std::istream &str, ossim_uint16 version) const
Eats the value field.
ossim_int32 toInt32() const
static const char * PIXEL_SCALE_XY_KW
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
ossim_uint64 getArraySizeInBytes(ossim_uint64 length, ossim_uint16 type) const
virtual bool open(const ossimFilename &file)
open method.
std::ostream & printModelType(std::ostream &out, const std::string &prefix, ossim_uint16 code) const
Prints key 1024.
void swapBytes(ossim_uint8 *v, ossim_uint16 type, ossim_uint64 count) const
ossim_uint32 getLines(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl) const
Gets the number of lines from keyword list.
std::ostream & printXmpMetadata(std::ostream &out, const std::string &prefix, ossim_uint64 count, ossim_uint8 *valueArray) const
Prints OTIFFTAG_XMLPACKET (700)
void getArrayValue(T &v, ossim_uint8 *array, ossim_uint64 position) const
Initializes v.
bool getScaleFactor(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, ossim_float64 &value) const
Gets the scale factor from keyword list.
static const char * TIE_POINT_XY_KW
signed short ossim_sint16
static const char * FALSE_NORTHING_KW
std::string::size_type size() const
bool getOssimProjectionName(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, ossimString &ossimProj) const
Gets the ossimProjection from keyword list as a string.
void getDirPrefix(ossim_int32 dirIndex, std::string &prefix) const
adds imageN.
unsigned long long ossim_uint64
unsigned int ossim_uint32
bool hasOneBasedTiePoints(const std::vector< ossim_float64 > &ties, ossim_uint32 width, ossim_uint32 height) const
Check tie points to see if they are zero base or one based.
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
ossimTiffInfo()
default constructor
ossim_float64 toFloat64() const
std::ostream & printGeoKeys(std::ostream &out, const std::string &prefix, ossim_uint64 geoKeyLength, ossim_uint16 *geoKeyBlock, ossim_uint64 geoDoubleLength, ossim_float64 *geoDoubleBlock, ossim_uint64 geoAsciiLength, ossim_int8 *geoAsciiBlock) const
Prints geo keys to stream.
std::ostream & printLinearUnits(std::ostream &out, const std::string &prefix, const std::string &key, ossim_uint16 code) const
Prints key from code from section 6.3.1.3.
static const char * STD_PARALLEL_1_KW
static const char * FALSE_EASTING_KW
bool getFalseEastingNorthing(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, ossimDpt &eastingNorthing) const
Gets the false easting/northing from keyword list.
bool getPcsCode(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, ossimString &pcsCode) const
Gets the pcs code from the keyword list as a string.
bool getValue(ossim_uint64 &val, std::istream &str, WordType type, ossim_uint16 version) const
This will read either 2 , 4 or 8 bytes depending on the version and WORD_TYPE.
static const char * IMAGE_MODEL_TRANSFORM_UNIT_KW
static ossimString downcase(const ossimString &aString)
static const char * FALSE_EASTING_NORTHING_KW
virtual std::ostream & print(std::ostream &out) const
Print method.
storage class for tie point between ground and image based on ossimGpt
bool getStdParallelOne(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, ossimString &value) const
Gets the first standard parallel from keyword list.
bool getLinearUnits(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, ossimString &linearUnits) const
Gets the linear units from keyword list as a string.
static const char * ORIGIN_LATITUDE_KW
ossim_uint32 getSamples(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl) const
Gets the number of samples from keyword list.
static const char * PCS_CODE_KW
void addTiePoint(ossimRefPtr< ossimTieGpt > aTiePt)
operations
std::basic_istream< char > istream
Base class for char input streams.
ossimString toString(ossim_uint32 precision=15) const
std::ostream & printArray(std::ostream &out, ossim_uint16 type, ossim_uint64 count, ossim_uint8 *valueArray) const
bool getModelTransform(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, std::vector< ossim_float64 > &xfrm) const
Gets the model_transform array.
bool getDatumCode(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, ossimString &datumCode) const
Gets the datum code matching code from the keyword list as a string.
storage class for a set of geographic tie points, between master and slave images ...
static const char * PIXEL_TYPE_KW
std::ostream & printCoordTrans(std::ostream &out, const std::string &prefix, ossim_uint16 code) const
Prints key 3075.
bool getOriginLat(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, ossim_float64 &value) const
Gets the origin of latitude from keyword list.
bool getVerticalUnits(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, ossimString &verticalUnits) const
Gets the vertical units from keyword list as a string.
std::ostream & printRasterType(std::ostream &out, const std::string &prefix, ossim_uint16 code) const
Prints key 1025.
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
virtual ossimProjection * createProjection(const ossimFilename &filename, ossim_uint32 entryIdx) const
STUB. Not implemented.
bool getUnits(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, ossimString &units) const
Gets units from keyword list as a string.
bool read(std::istream &in)
bool getCentralMeridian(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, ossim_float64 &value) const
Gets the central meridian from keyword list.
bool getFalseNorthing(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, ossimString &value) const
Gets the false northing from keyword list.
virtual std::shared_ptr< ossim::istream > createIstream(const std::string &connectionString, const ossimKeywordlist &options=ossimKeywordlist(), std::ios_base::openmode mode=std::ios_base::in|std::ios_base::binary) const
Will try to creates an istream interface to the connectionString passed in.
void findNodes(const ossimString &xpath, std::vector< ossimRefPtr< ossimXmlNode > > &nodelist) const
Appends any matching nodes to the list supplied (should be empty):
static const char * SCALE_FACTOR_KW
std::basic_istringstream< char > istringstream
Class for char input memory streams.
std::ostream & printOrientation(std::ostream &out, const std::string &prefix, ossim_uint16 code) const
Prints tag 274.
static const char * STD_PARALLEL_2_KW
std::ostream & printValue(std::ostream &out, ossim_uint16 type, ossim_uint8 *valueArray) const
bool getModelType(const ossimString >iffPrefix, const ossimKeywordlist >iffKwl, ossimString &modeType) const
Gets the model type from keyword list as a string.
static const char * NUMBER_SAMPLES_KW
unsigned char ossim_uint8
static ossimEpsgProjectionFactory * instance()
Implements singleton pattern.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::basic_ostream< char > ostream
Base class for char output streams.
static const char * PIXEL_SCALE_UNITS_KW
static const char * TIE_POINT_UNITS_KW
void getTieSets(const std::vector< ossim_float64 > &ties, ossim_uint32 width, ossim_uint32 height, ossimTieGptSet &tieSet) const
Split tie points into sets of six tie sets.
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.