67 static const std::string ADD_ALPHA_CHANNEL_KW =
"add_alpha_channel";
68 static const std::string ADD_ENTRY_KW =
"add_entry";
69 static const std::string ADD_LEVELS_KW =
"add_levels";
70 static const std::string ALIGN_TO_GRID_KW =
"align_to_grid";
71 static const std::string APPEND_KW =
"append";
72 static const std::string BATCH_SIZE_KW =
"batch_size";
73 static const std::string CLIP_EXTENTS_KW =
"clip_extents";
74 static const std::string CLIP_EXTENTS_ALIGN_TO_GRID_KW =
"clip_extents_align_to_grid";
75 static const std::string COMPRESSION_LEVEL_KW =
"compression_level";
76 static const std::string DEFAULT_FILE_NAME =
"output.gpkg";
77 static const std::string EPSG_KW =
"epsg";
78 static const std::string INCLUDE_BLANK_TILES_KW =
"include_blank_tiles";
79 static const std::string TILE_SIZE_KW =
"tile_size";
80 static const std::string TILE_TABLE_NAME_KW =
"tile_table_name";
81 static const std::string TRUE_KW =
"true";
82 static const std::string USE_PROJECTION_EXTENTS_KW =
"use_projection_extents";
83 static const std::string WRITER_MODE_KW =
"writer_mode";
84 static const std::string ZOOM_LEVELS_KW =
"zoom_levels";
90 static ossimTrace traceDebug(
"ossimGpkgWriter:debug");
94 static const char OSSIM_ID[] =
"$Id: ossimGpkgWriter.cpp 22466 2013-10-24 18:23:51Z dburken $";
112 m_partialTileCodec(0),
113 m_fullTileCodecAlpha(false),
114 m_partialTileCodecAlpha(false),
116 m_zoomLevelMatrixSizes(),
128 <<
"ossimGpkgWriter::ossimGpkgWriter entered" << std::endl;
141 m_kwl->
addPair( TILE_SIZE_KW, std::string(
"( 256, 256 )") );
173 return (
m_db?
true:
false);
184 int flags = SQLITE_OPEN_READWRITE;
191 flags |= SQLITE_OPEN_CREATE;
196 flags |= SQLITE_OPEN_CREATE;
203 m_kwl->
addPair( ADD_LEVELS_KW, std::string(
"0"),
true );
207 if ( rc == SQLITE_OK )
221 sql <<
"PRAGMA application_id = " << ID;
239 static const char MODULE[] =
"ossimGpkgWriter::openFile";
258 <<
"\nwriter options/settings:\n" 280 std::string tileTableName;
308 << MODULE <<
" exit status: " << (
status?
"true":
"false") << std::endl;
319 static const char MODULE[] =
"ossimGpkgWriter::initializeGpkg";
348 bool needToExpandFlag =
true;
403 <<
"\nlevel[" <<
m_zoomLevels[0] <<
"] gsd: " << largestGsd
404 <<
"\nlevel[" <<
m_zoomLevels[levels-1] <<
"] gsd: " << smallestGsd
405 <<
"\nexpanded aoi(first zoom level): " << expandedAoi
421 std::vector<ossim_int32>::const_iterator zoomLevel =
m_zoomLevels.begin();
446 <<
"\nlevel: " << (*zoomLevel)
449 <<
"\nclippedAoi: " << clippedAoi
450 <<
"\nexpandedAoi: " << expandedAoi
451 <<
"\nmatrixSize: " << matrixSize
459 expandedAoi, clippedAoi ) )
467 <<
" WARNING:\nwriteGpkgNsgTileMatrixExtentTable call failed!" 475 <<
" WARNING:\nwriteGpkgTileMatrixTable call failed!" << std::endl;
498 <<
"Must have at least one zoom level!" 499 <<
"Set zoom_levels key in option keyword list." 500 <<
"e.g. \"zoom_levels:()4,5,6,7,8,9,10,11\"" 506 else if (traceDebug())
514 << MODULE <<
" exit status: " << (
status?
"true":
"false") << std::endl;
524 sqlite3_close(
m_db );
538 static const char MODULE[] =
"ossimGpkgWriter::writeFile";
543 << MODULE <<
" entered..." 544 <<
"\nwriter options/settings:\n" 616 if( originalSequencerInput.
valid() )
619 originalSequencerInput = 0;
627 << MODULE <<
" Caught exception!\n" 632 catch (
const RBD_COMMON::BaseException& me )
635 << MODULE <<
" Caught Matrix exception!\n" 643 << MODULE <<
" Caught unknown exception!\n" 651 << MODULE <<
" exit status: " << (
status?
"true":
"false") << std::endl;
660 static const char MODULE[] =
"ossimGpkgWriter::writeEntry";
678 if ( productProjection.
valid() )
681 getGsd( productProjection.
get(), sourceGsd );
686 ( productProjection->
getClassName() ==
"ossimUtmProjection" ) )
692 << MODULE <<
" WARNING!" 693 <<
"\"align_to_grid\" option is invalid a UTM projection and is " 694 <<
"being disabled..." 698 m_kwl->
addPair( ALIGN_TO_GRID_KW, std::string(
"0"),
true );
740 std::vector<ossim_int32> zoomLevels;
747 if ( zoomLevels.size() )
775 zoomLevels[zoomLevels.size()-1],
801 <<
"source aoi: " << sourceAoi
802 <<
"\nproduct aoi: " << aoi
803 <<
"\nexpanded aoi(last zoom level): " << expandedAoi
804 <<
"\ngsd: " << fullResGsd
805 <<
"\nstop gsd: " << stopGsd
832 productProjection.
get(),
851 static const char MODULE[] =
"ossimGpkgWriter::addLevels";
869 if ( productProjection.
valid() )
871 std::string tileTableName;
882 getGsd( productProjection.
get(), sourceGsd );
887 ( productProjection->
getClassName() ==
"ossimUtmProjection" ) )
893 << MODULE <<
" WARNING!" 894 <<
"\"align_to_grid\" option is invalid a UTM projection and is " 895 <<
"being disabled..." 899 m_kwl->
addPair( ALIGN_TO_GRID_KW, std::string(
"0"),
true );
945 std::vector<ossim_int32> currentZoomLevels;
947 std::sort( currentZoomLevels.begin(), currentZoomLevels.end() );
951 std::vector<ossim_int32> zoomLevels;
961 if ( zoomLevels.size() )
989 zoomLevels[zoomLevels.size()-1],
1006 <<
"source aoi: " << sourceAoi
1007 <<
"\nproduct aoi: " << aoi
1009 <<
"\ngsd: " << fullResGsd
1010 <<
"\nstop gsd: " << stopGsd
1030 productProjection.
get(),
1050 const std::vector<ossim_int32>& zoomLevels )
1055 static const char MODULE[] =
"ossimGpkgWriter::writeZoomLevels";
1072 std::vector<ossim_int32>::const_iterator zoomLevel = zoomLevels.begin();
1073 while ( zoomLevel != zoomLevels.end() )
1091 if ( totalTiles < 1 )
1114 totalTiles += (
x *
y);
1116 }
while ( z < levels );
1122 <<
"total tiles: " << totalTiles <<
"\n";
1128 <<
"ossimGpkgWriter::writeZoomLevels DEBUG:" 1129 <<
"\nlevel: " << (*zoomLevel)
1132 <<
"\nclippedAoi: " << clippedAoi
1133 <<
"\nexpandedAoi: " << expandedAoi
1134 <<
"\nmatrixSize: " << matrixSize
1142 expandedAoi, clippedAoi ) )
1144 writeTiles( db, expandedAoi, (*zoomLevel), totalTiles, tilesWritten );
1151 <<
" WARNING:\nwriteGpkgNsgTileMatrixExtentTable call failed!" << std::endl;
1158 <<
" WARNING:\nwriteGpkgTileMatrixTable call failed!" << std::endl;
1165 if ( zoomLevel != zoomLevels.end() )
1184 sqlite3_exec(db,
"END TRANSACTION", NULL, NULL, &sErrMsg);
1190 << MODULE <<
" exited...\n";
1211 sqlite3_stmt* pStmt = 0;
1213 sql <<
"INSERT INTO " <<
m_tileTableName <<
"( zoom_level, tile_column, tile_row, tile_data ) VALUES ( " 1223 <<
"sql:\n" << sql.str() <<
"\n";
1226 int rc = sqlite3_prepare_v2(db,
1232 bool writeBlanks =
keyIsTrue( INCLUDE_BLANK_TILES_KW );
1251 sqlite3_exec(db,
"BEGIN TRANSACTION", NULL, NULL, &sErrMsg);
1254 writeTile( pStmt, db, tile, zoomLevel, row, col);
1259 sqlite3_exec(db,
"END TRANSACTION", NULL, NULL, &sErrMsg);
1268 errMsg <<
"ossimGpkgWriter::writeTiles ERROR: " 1269 <<
"Sequencer returned null tile pointer for (" 1270 << col <<
", " << row <<
")";
1292 sqlite3_finalize(pStmt);
1297 <<
"sqlite3_prepare_v2 error: " << sqlite3_errmsg(db) << std::endl;
1311 if ( db && tile.
valid() )
1313 std::vector<ossim_uint8> codecTile;
1342 int rc = sqlite3_bind_int (pStmt, 1, zoomLevel);
1343 rc |= sqlite3_bind_int (pStmt, 2, col);
1344 rc |= sqlite3_bind_int (pStmt, 3, row);
1345 rc |= sqlite3_bind_blob (pStmt,
1347 (
void*)&codecTile.front(),
1350 if ( rc == SQLITE_OK )
1352 rc = sqlite3_step(pStmt);
1353 if ( rc == SQLITE_OK )
1356 <<
"sqlite3_step error: " << sqlite3_errmsg(db) << std::endl;
1363 <<
"sqlite3_bind_blob error: " << sqlite3_errmsg(db) << std::endl;
1366 sqlite3_clear_bindings(pStmt);
1367 sqlite3_reset(pStmt);
1381 if ( db && codecTile )
1384 int rc = sqlite3_bind_int (pStmt, 1, zoomLevel);
1385 rc |= sqlite3_bind_int (pStmt, 2, col);
1386 rc |= sqlite3_bind_int (pStmt, 3, row);
1387 rc |= sqlite3_bind_blob (pStmt,
1392 if ( rc == SQLITE_OK )
1394 rc = sqlite3_step(pStmt);
1395 if ( rc == SQLITE_OK )
1398 <<
"sqlite3_step error: " << sqlite3_errmsg(db) << std::endl;
1405 <<
"sqlite3_bind_blob error: " << sqlite3_errmsg(db) << std::endl;
1408 sqlite3_clear_bindings(pStmt);
1409 sqlite3_reset(pStmt);
1418 sql <<
"INSERT INTO " <<
m_tileTableName <<
"( zoom_level, tile_column, tile_row, tile_data ) VALUES ( " 1428 <<
"sql:\n" << sql.str() <<
"\n";
1431 return sqlite3_prepare_v2(
m_db,
1461 sqlite3_exec(
m_db,
"BEGIN TRANSACTION", NULL, NULL, &sErrMsg);
1469 sqlite3_exec(
m_db,
"END TRANSACTION", NULL, NULL, &sErrMsg);
1494 sqlite3_exec(
m_db,
"BEGIN TRANSACTION", NULL, NULL, &sErrMsg);
1502 sqlite3_exec(
m_db,
"END TRANSACTION", NULL, NULL, &sErrMsg);
1513 sqlite3_exec(
m_db,
"END TRANSACTION", NULL, NULL, &sErrMsg);
1559 if ( record.
insert( db ) )
1572 <<
"ossimGpkgWriter::writeGpkgSpatialRefSysTable ERROR initialized record!\n";
1642 clippedAoi.
ul().
y - expandedAoi.
ul().
y,
1643 clippedAoi.
lr().
x - expandedAoi.
ul().
x,
1644 clippedAoi.
lr().
y - expandedAoi.
ul().
y );
1649 status = record.insert( db );
1673 regularExpression = prefix;
1676 regularExpression +=
"*";
1681 regularExpression = prefix;
1691 imageTypeList.push_back(
ossimString(
"ossim_gpkg"));
1701 if ( (imageType ==
"ossim_gpkg") || (imageType ==
"image/gpkg") )
1711 if ( property.
valid() )
1714 std::string key =
property->getName().string();
1715 if ( ( key == ADD_ALPHA_CHANNEL_KW ) ||
1716 ( key == ADD_ENTRY_KW ) ||
1717 ( key == ADD_LEVELS_KW ) ||
1718 ( key == ALIGN_TO_GRID_KW ) ||
1719 ( key == APPEND_KW ) ||
1720 ( key == BATCH_SIZE_KW ) ||
1721 ( key == COMPRESSION_LEVEL_KW ) ||
1723 ( key == EPSG_KW ) ||
1724 ( key == INCLUDE_BLANK_TILES_KW ) ||
1725 ( key == TILE_SIZE_KW ) ||
1726 ( key == TILE_TABLE_NAME_KW ) ||
1727 ( key == WRITER_MODE_KW ) ||
1728 ( key == ZOOM_LEVELS_KW ) )
1731 property->valueToString(value);
1750 propertyNames.push_back(
ossimString(ADD_ALPHA_CHANNEL_KW));
1751 propertyNames.push_back(
ossimString(ADD_ENTRY_KW));
1752 propertyNames.push_back(
ossimString(ADD_LEVELS_KW));
1753 propertyNames.push_back(
ossimString(ALIGN_TO_GRID_KW));
1755 propertyNames.push_back(
ossimString(BATCH_SIZE_KW));
1756 propertyNames.push_back(
ossimString(COMPRESSION_LEVEL_KW));
1759 propertyNames.push_back(
ossimString(INCLUDE_BLANK_TILES_KW));
1760 propertyNames.push_back(
ossimString(TILE_SIZE_KW));
1761 propertyNames.push_back(
ossimString(TILE_TABLE_NAME_KW));
1762 propertyNames.push_back(
ossimString(WRITER_MODE_KW));
1763 propertyNames.push_back(
ossimString(ZOOM_LEVELS_KW));
1789 switch (theCompressionLevel)
1791 case Z_NO_COMPRESSION:
1799 case Z_BEST_COMPRESSION:
1817 if(s ==
"z_no_compression")
1819 theCompressionLevel = Z_NO_COMPRESSION;
1821 else if(s ==
"z_best_speed")
1823 theCompressionLevel = Z_BEST_SPEED;
1825 else if(s ==
"z_best_compression")
1827 theCompressionLevel = Z_BEST_COMPRESSION;
1829 else if(s ==
"z_default_compression")
1831 theCompressionLevel = Z_DEFAULT_COMPRESSION;
1842 <<
"\nossimGpkgWriter::setCompressionLevel DEBUG" 1843 <<
"passed in level: " << level.c_str()
1856 if ( fullResGsd.
hasNans() == false )
1858 double delta = fullResZoomLevel - currentZoomLevel;
1861 gsd = fullResGsd * ( std::pow( 2.0, delta ) );
1863 else if ( delta < 0 )
1865 gsd = fullResGsd / ( std::pow( 2, std::fabs(delta) ) );
1938 gsd = gsd / ( std::pow( 2.0, zoomLevel ) );
1962 bool result =
false;
2074 if ( proj.
valid() == false )
2077 if ( sourceProj.
valid() )
2080 if ( sourceProj->
getClassName() ==
"ossimEquDistCylProjection" )
2085 else if ( sourceProj->
getClassName() ==
"ossimMercatorProjection" )
2090 else if ( sourceProj->
getClassName() ==
"ossimGoogleProjection" )
2094 else if ( sourceProj->
getClassName() ==
"ossimUtmProjection" )
2101 if ( proj.
valid() == false )
2118 getGsd( geom, fullResGsd );
2125 if ( fullResGsd.
y < fullResGsd.
x )
2127 fullResGsd.
x = fullResGsd.
y;
2129 else if ( fullResGsd.
x < fullResGsd.
y )
2131 fullResGsd.
y = fullResGsd.
x;
2138 if ( gridAligned && (proj->
getClassName() ==
"ossimUtmProjection" ) )
2141 gridAligned =
false;
2147 if ( fullResGsd.
y < fullResGsd.
x )
2149 fullResGsd.
x = fullResGsd.
y;
2151 else if ( fullResGsd.
x < fullResGsd.
y )
2153 fullResGsd.
y = fullResGsd.
x;
2174 if ( epsgCode == 4326 )
2179 else if ( epsgCode == 3395 )
2184 else if ( ( epsgCode == 3857 ) || ( epsgCode == 900913) )
2262 std::sort( zoomLevels.begin(), zoomLevels.end() );
2265 if ( zoomLevels[0] < 0 )
2287 std::vector<ossim_int32>& zoomLevels,
2290 if ( proj && (aoi.
hasNans() ==
false) )
2293 fullResGsd = sourceGsd;
2298 if ( zoomLevels.size() )
2302 ossim_int32 zoomLevel = zoomLevels[zoomLevels.size()-1];
2320 fullResGsd = fullResGsd / ( std::pow( 2.0, zoomLevel ) );
2348 if ( fullResGsd.
hasNans() == false )
2351 ossimDpt gsdThreshold = fullResGsd * 1.5;
2355 while ( ( zoomGsd.
x > gsdThreshold.
x ) &&
2356 ( zoomGsd.
y > gsdThreshold.
y ) )
2359 zoomGsd = zoomGsd/2.0;
2360 fullResGsd = zoomGsd;
2364 ossim_int32 stopZoomLevel = startZoomLevel-(levels-1);
2366 if ( stopZoomLevel < 0 ) stopZoomLevel = 0;
2368 for (
ossim_int32 i = stopZoomLevel; i <= startZoomLevel; ++i )
2370 zoomLevels.push_back(i);
2382 zoomLevels.push_back(i);
2392 <<
"ossimGpkgWriter::getZoomLevels DEBUG" 2393 <<
"aoi: " << aoi <<
"\n" 2394 <<
"sourceGsd: " << sourceGsd <<
"\n" 2395 <<
"\nfullResGsd: " << fullResGsd <<
"\n" 2397 std::vector<ossim_int32>::const_iterator i = zoomLevels.begin();
2398 while ( i != zoomLevels.end() )
2402 if ( i != zoomLevels.end() )
2430 while ( ( TW < w ) && ( TH < h ) )
2442 <<
"ossimGpkgWriter::getNumberOfZoomLevels DEBUG" 2443 <<
"\nlevels: " << result <<
"\n";
2453 static const char MODULE[] =
"ossimGpkgWriter::getAoi";
2488 <<
"\nulGpt: " << ulGpt
2489 <<
"\nlrGpt: " << lrGpt
2490 <<
"\nulDpt: " << ulDpt
2491 <<
"\nlrDpt: " << lrDpt
2511 <<
"aoi: " << aoi <<
"\n" 2512 << MODULE <<
" exited...\n";
2568 <<
"ossimGpkgWriter::setProjectionTie DEBUG:\n" 2569 <<
"tie: " << tie << std::endl;
2591 <<
"ossimGpkgWriter::setProjectionTie DEBUG:\n" 2592 <<
"tie: " << tie << std::endl;
2614 else if ( os ==
"png" )
2618 else if ( os ==
"pnga" )
2663 bool result =
false;
2697 dims.
x = 40030220.0;
2705 errMsg <<
"ossimGpkgWriter::getProjectionDimensionsInMeters ERROR:\n" 2706 <<
"EPSG 4326 Origin latitude is not at 0.\n";
2718 dims.
x = 40075016.6856;
2719 dims.
y = 34261226.9711;
2728 dims.
x = 40075016.685578488;
2729 dims.
y = 40075016.685578488;
2735 errMsg <<
"ossimGpkgWriter::getProjectionDimensionsInMeters ERROR:\n" 2736 <<
"Unhandled espg code: " << epsgCode <<
"\n";
2745 void ossimGpkgWriter::clipToProjectionBounds(
2768 else if ( code == 3857 )
2803 errMsg <<
"ossimGpkgWriter::initializeProjectionRect ERROR:\n" 2804 <<
"EPSG 4326 Origin latitude is not at 0.\n";
2824 ossimDrect( -20037508.342789244, 20037508.342789244,
2831 errMsg <<
"ossimGpkgWriter::initializeProjectionRect ERROR:\n" 2832 <<
"Unhandled espg code: " << epsgCode <<
"\n";
2841 <<
"ossimGpkgWriter::initializeProjectionRect:\n" 2881 aoi.
ul(), ulEastingNorthingPt );
2883 aoi.
lr(), lrEastingNorthingPt );
2887 ulEastingNorthingPt.
y + halfGsd.
y,
2888 lrEastingNorthingPt.
x + halfGsd.
x,
2889 lrEastingNorthingPt.
y - halfGsd.
y,
2898 <<
"ossimGpkgWriter::initializeRect:" 2900 <<
"\nrect: " << rect
2908 std::string key =
"tile_table_name";
2910 if ( tileTableName.empty() )
2912 tileTableName =
"tiles";
2920 if ( file.
size() > 0 )
2978 errMsg <<
"ossimGpkgWriter::initializeCodec ERROR:\n" 2980 <<
"\nCheck for ossim png plugin..." 2988 const std::string KEY =
"cut_wms_bbox";
2994 bool result =
getRect( CLIP_EXTENTS_KW, rect );
2995 alignToGridFlag =
true;
2997 if(!value.
empty()) alignToGridFlag = value.
toBool();
3009 std::string replacementPattern = value.
string() + std::string(
":");
3011 std::vector<ossimString> cutBox;
3012 bbox.
split( cutBox,
"," );
3013 if( cutBox.size() == 4 )
3027 const std::vector<ossim_int32>& currentZoomLevels,
3028 const std::vector<ossim_int32>& newZoomLevels )
const 3030 static const char MODULE[] =
"ossimGpkgWriter::checkLevels";
3033 if ( currentZoomLevels.size() )
3035 if ( newZoomLevels.size() )
3038 if ( newZoomLevels[0] < currentZoomLevels[0] )
3043 <<
"New level[" << newZoomLevels[0]
3044 <<
"] will not fit in existing extents of level[" 3045 << currentZoomLevels[0] <<
"].\n";
3050 std::vector<ossim_int32>::const_iterator newIdx = newZoomLevels.begin();
3051 while ( newIdx < newZoomLevels.end() )
3053 std::vector<ossim_int32>::const_iterator currentIdx = currentZoomLevels.begin();
3054 while ( currentIdx != currentZoomLevels.end() )
3056 if ( (*newIdx) == (*currentIdx) )
3061 <<
"New level[" << (*newIdx)
3062 <<
"] already exists in current matrix set.\n";
3081 std::vector<ossim_int32>::const_iterator zIdx =
m_zoomLevels.begin();
3085 if ( (*zIdx) == level )
3087 if ( ( row < (*sIdx).y ) && ( col < (*sIdx).x ) &&
3088 ( row > -1 ) && ( col > -1 ) )
3110 if ( desiredGsd.
hasNans() == false )
3114 getGsd( proj, currentGsd );
3121 scale.
x = desiredGsd.
x / currentGsd.
x;
3122 scale.
y = desiredGsd.
y / currentGsd.
y;
3126 cout << "ossimGpkgWriter::applyScaleToProjection DEBUG:" 3127 <<
"\nproj gsd: " << currentGsd
3128 <<
"\ndesired gsd: " << desiredGsd
3129 <<
"\nscale: " << scale
void setRectangle(const ossimIrect &rect)
static ossimCodecFactoryRegistry * instance()
ossimGpkgWriterMode getWriterMode() const
Gets the writer mode.
bool insert(sqlite3 *db)
Inserst this record into gpkg_contents table.
virtual const ossimDpt & getDecimalDegreesPerPixel() const
Returns decimal degrees per pixel as an ossimDpt with "x" representing longitude and "y" representing...
static bool createTable(sqlite3 *db, const std::string &tableName)
Creates table in database.
virtual ~ossimGpkgWriter()
void checkLevels(const std::vector< ossim_int32 > ¤tZoomLevels, const std::vector< ossim_int32 > &newZoomLevels) const
Checks for: new level lower then existing.
virtual void slaveProcessTiles()
virtual ossimObject * dup() const =0
ossim_int32 m_organization_coordsys_id
void stripPrefixFromAll(const ossimString ®ularExpression)
void getTileSize(ossimIpt &tileSize) const
void initializeCodec()
Initializes m_fullTileCodec and m_partialTileCodec.
static bool remove(const ossimFilename &pathname)
Removes pathname from filesystem if supported by platform.
ossim_float64 max< ossim_float64 >(ossim_float64 a, ossim_float64 b)
virtual bool writeTile(ossimRefPtr< ossimImageData > &tile, ossim_int32 zoomLevel, ossim_int64 row, ossim_int64 col)
Direct interface to writing a tile to database.
std::vector< ossim_int32 > m_zoomLevels
Holds zoom level indexes for connectionless write tile.
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
bool append() const
Check if file is to be open new or appended.
bool writeGpkgTileMatrixSetTable(sqlite3 *db, const ossimDrect &boundingRect)
virtual void computeAlphaChannel()
Computes the alpha channel.
ossimRefPtr< ossimCodecBase > m_partialTileCodec
virtual void finalizeTileProcessing()
Calls sqlite3_finalize(pStmt) terminating tile processing.
ossimRefPtr< ossimMapProjection > getNewWorldMercatorProjection() const
virtual void getImageTypeList(std::vector< ossimString > &imageTypeList) const
void getImageTypeList(std::vector<ossimString>& imageTypeList)const
ossimString theOutputImageType
bool needsAborting() const
virtual bool isMaster() const
This will be a base for all combiners.
Represents serializable keyword/value map.
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
virtual void setToStartOfSequence()
static const ossimErrorCode OSSIM_OK
virtual bool isOpen() const
const ossimGpkgTileMatrixSetRecord & getTileMatrixSet() const
bool insert(sqlite3 *db)
Inserst this record into gpkg_spatial_ref_sys table.
const ossimMapProjection * getAsMapProjection() const
virtual ossim_uint32 getPcsCode() const
Returns the EPSG PCS code or 32767 if the projection is a custom (non-EPSG) projection.
int exec(sqlite3 *db, const std::string &sql)
Preforms sqlite3_prepare_v2, sqlite3_step and sqlite3_finalize.
virtual ossimDpt worldToLineSample(const ossimGpt &worldPoint) const
const ossimDpt & ul() const
bool insert(sqlite3 *db)
Inserst this record into gpkg_spatial_ref_sys table.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
ossim_uint32 height() const
virtual ossimRefPtr< ossimImageData > getNextTile(ossim_uint32 resLevel=0)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
static bool createTable(sqlite3 *db)
Creates table in database.
ossim_int32 writeGpkgSpatialRefSysTable(sqlite3 *db, const ossimMapProjection *proj)
static ossimString toString(bool aValue)
Numeric to string methods.
void setProjectionTie(ossimMapProjection *proj) const
void getZoomLevelMatrixSizes(std::vector< ossimIpt > &zoomLevelMatrixSizes) const
Gets zoom level matrix of all tile matrixes.
virtual bool isGeographic() const
OSSIM_DLL void defaultTileSize(ossimIpt &tileSize)
bool initializeGpkg()
Initializes the output gpkg file.
const ossimIpt & ul() const
void split(std::vector< ossimString > &result, const ossimString &separatorList, bool skipBlankFields=false) const
Splits this string into a vector of strings (fields) using the delimiter list specified.
virtual ossimDataObjectStatus getDataObjectStatus() const
ossim_int32 getNumberOfZoomLevels(const ossimIrect &aoi) const
Zoom levels needed to get AOI down to one tile.
void addPair(const std::string &key, const std::string &value, bool overwrite=true)
virtual ossimString getClassName() const
virtual void setDecimalDegreesPerPixel(const ossimDpt &gsd)
ossim_uint32 toUInt32() const
bool m_partialTileCodecAlpha
void getGsd(const ossimDpt &fullResGsd, ossim_int32 fullResZoomLevel, ossim_int32 currentZoomLevel, ossimDpt &gsd)
bool requiresEightBit() const
static bool createTable(sqlite3 *db)
Creates table in database.
Pure virtual base class for image file writers.
void getMatrixSize(const ossimIrect &rect, ossimIpt &matrixSize) const
ossimDpt getDegreesPerPixel() const
Returns the resolution of this image in degrees/pixel.
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
Pushes this's names onto the list of property names.
bool getTileEntry(sqlite3 *db, const std::string &tileTableName, ossimGpkgTileEntry &entry)
Gets tile entry whos table_name field matches tileTableName.
ossimRefPtr< ossimKeywordlist > m_kwl
Hold all options.
std::string getWriterModeString(ossimGpkgWriterMode mode) const
Gets the writer mode as string.
bool isValidZoomLevelRowCol(ossim_int32 level, ossim_int32 row, ossim_int32 col) const
Checks to see if level, row, column are within range of existing gpkg.
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
void getAoiFromRect(const ossimMapProjection *proj, const ossimDrect &rect, ossimIrect &aoi)
Get the view coordinates for edge to edge rect.
virtual void applyScale(const ossimDpt &scale, bool recenterTiePoint)
Applies scale to theDeltaLonPerPixel, theDeltaLatPerPixel and theMetersPerPixel data members (eg: the...
virtual void setMetersPerPixel(const ossimDpt &gsd)
virtual ossimString getExtension() const
Returns a 3-letter extension from the image type descriptor (theOutputImageType) that can be used for...
ossimDrect m_clipRect
AOI clipped to projection rect.
bool toSimpleVector(std::vector< T > &result, const ossimString &stringOfPoints)
virtual ossimString getClassName() const
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
static bool createTable(sqlite3 *db)
Creates table in database.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual bool init(sqlite3_stmt *pStmt)
Initialize from database.
static bool createTable(sqlite3 *db)
Creates gpkg_contents table in database.
virtual bool encode(const ossimRefPtr< ossimImageData > &in, std::vector< ossim_uint8 > &out) const =0
Encode method.
void writeTiles(sqlite3 *db, const ossimIrect &aoi, ossim_int32 zoomLevel, const ossim_float64 &totalTiles, ossim_float64 &tilesWritten)
ossimDrect clipToRect(const ossimDrect &rect) const
virtual ossimGpt lineSampleToWorld(const ossimDpt &projectedPoint) const
virtual void setAreaOfInterest(const ossimIrect &areaOfInterest)
ossimString replaceAllThatMatch(const char *regularExpressionPattern, const char *value="") const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
ossim_uint64 m_batchSize
Number of transactions batched before being executed.
virtual void setProperty(ossimRefPtr< ossimProperty > property)
Will set the property whose name matches the argument "property->getName()".
virtual const char * what() const
Returns the error message.
virtual void setPcsCode(ossim_uint32 pcsCode)
virtual void lineSampleToEastingNorthing(const ossimDpt &liineSample, ossimDpt &eastingNorthing) const
ossimRefPtr< ossimMapProjection > getNewGeographicProjection() const
std::string::size_type size() const
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
std::vector< ossimIpt > m_zoomLevelMatrixSizes
Hold zoom level matrix sizes for connectionless write tile.
void setView(ossimMapProjection *proj)
ossimFilename theFilename
bool toBool() const
String to numeric methods.
virtual void initialize()
void setCompressionQuality(const std::string &quality)
virtual bool openFile(const ossimKeywordlist &options)
Opens file for writing, appending, merging without an input connection.
bool getRect(const std::string &key, ossimDrect &rect) const
Gets rectangle.
bool m_writeBlanks
Controlled by option key: "include_blank_tiles".
bool hasImageType(const ossimString &imageType) const
bool hasImageType(const ossimString& imageType) const
unsigned long long ossim_uint64
unsigned int ossim_uint32
sqlite3_stmt * m_pStmt
Holds Statement handle from sqlite3_prepare_v2(...) for connectionless write tile.
ossimDpt getMetersPerPixel() const
Returns the GSD associated with this image in the active projection.
virtual bool init(sqlite3_stmt *pStmt)
Initialize from database.
static ossimDatumFactory * instance()
void extractKeysThatMatch(ossimKeywordlist &kwl, const ossimString ®ularExpression) const
std::string m_tileTableName
bool createTables(sqlite3 *db)
const ossimIpt & lr() const
static ossimString downcase(const ossimString &aString)
void initializeRect(const ossimMapProjection *proj, const ossimIrect &aoi, ossimDrect &rect)
virtual ossim_int32 connectMyInputTo(ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
Will try to connect this objects input to the passed in object.
virtual void initialize()
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
ossim_uint32 width() const
const ossimGpkgSpatialRefSysRecord & getSrs() const
Spatial ref sys.
ossimRefPtr< ossimCodecBase > m_fullTileCodec
Will cache and hold the allocated codecs to use for the encoding.
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if not defined...
void applyScaleToProjection(ossimMapProjection *proj, const ossimDpt &desiredGsd) const
Get the current gsd from projection.
virtual void setEnableFlag(bool flag)
void toPoint(const std::string &s)
Initializes this point from string.
ossim_uint32 getCompressionQuality() const
Gets the compression quality.
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
ossim_uint32 getEpsgCode() const
const ossimGpt & getOrigin() const
virtual ossimString getLongName() const
void getTileTableName(std::string &tileTableName) const
Gets the tile table name.
virtual ossimCodecBase * createCodec(const ossimString &type) const
Will loop through all registered factories trying to allocate a codec for the passed in type...
virtual ossimString getShortName() const
bool writeGpkgTileMatrixTable(sqlite3 *db, ossim_int32 zoom_level, const ossimIpt &matrixSize, const ossimDpt &gsd)
Initialize method.
virtual const ossimFilename & getFilename() const
ossim_int64 getNumberOfTilesHorizontal() const
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
T * getObjectAs(ossim_uint32 idx=0)
ossim_uint64 getBatchSize() const
This is the number of transactions batched before being executed.
void getZoomLevels(std::vector< ossim_int32 > &zoomLevels) const
Gets zoom levels from options keyword list if set.
bool writeGpkgContentsTable(sqlite3 *db, const ossimDrect &boundingRect)
void reInitializeCutters(const ossimMapProjection *proj)
Finds all ossimRectangleCutter and calls setRectangle with a nan rect to reset the bounding box after...
virtual void setProperty(ossimRefPtr< ossimProperty > property)
virtual ossimErrorCode getErrorStatus() const
bool writeEntry()
Writes an entry to gpkg.
ossimDrect m_sceneBoundingRect
Holds the bounding rect of the scene edges either in decimal degrees for geographic projection or Eas...
ossimDrect m_outputRect
Expanded(final) AOI clipped to projection rect.
virtual void setProperty(const ossimString &name, const ossimString &value)
void initializeProjectionRect(const ossimMapProjection *productProj)
virtual bool setView(ossimObject *baseObject)=0
void getRect(ossimDrect &rect) const
Gets the rectangle from bounds.
static const char * COMPRESSION_QUALITY_KW
ossimRefPtr< ossimMapProjection > getNewOutputProjection() const
Gets projection from "epsg" code if in options list.
ossim_uint64 toUInt64() const
void reInitializeCombiners()
Finds all combiners and calls initialize to reset the bounding box after a view change.
ossimString getCompressionLevel() const
Get the gpkg compression level as a string.
virtual bool writeCodecTile(ossim_uint8 *codecTile, ossim_int32 codecTileSize, ossim_int32 zoomLevel, ossim_int64 row, ossim_int64 col)
Direct interface to writing a Codec tile to database.
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
virtual void eastingNorthingToLineSample(const ossimDpt &eastingNorthing, ossimDpt &lineSample) const
virtual ossimProjection * createProjection(const ossimFilename &filename, ossim_uint32 entryIdx) const
STUB. Not implemented.
void writeZoomLevels(sqlite3 *db, ossimMapProjection *proj, const std::vector< ossim_int32 > &zoomLevels)
void stretchToTileBoundary(const ossimIpt &tileWidthHeight)
bool writeGpkgNsgTileMatrixExtentTable(sqlite3 *db, ossim_int32 zoom_level, const ossimIrect &expandedAoi, const ossimIrect &clippedAoi)
sqlite3 * m_db
database connection
virtual void setUlTiePoints(const ossimGpt &gpt)
virtual void accept(ossimVisitor &visitor)
We will add a visitor interface for all connectable objects.
#define RTTI_DEF1(cls, name, b1)
bool insert(sqlite3 *db)
Inserst this record into gpkg_spatial_ref_sys table.
virtual bool init(sqlite3_stmt *pStmt)
Initialize from database.
bool getWmsCutBox(ossimDrect &rect) const
Get rectangle in projected space from key: cut_wms_bbox key:value form: cut_wms_bbox: <minx>...
void getZoomLevels(std::vector< ossim_int32 > &zoomLevels) const
Gets zoom levels of all tile matrixes.
virtual void setPercentComplete(double percentComplete)
bool getClipExtents(ossimDrect &rect, bool &alignToGridFlag) const
Get clip rectangle in projected space from key: clip_extents key:value form: clip_extents: <minx>...
virtual bool init(sqlite3_stmt *pStmt)
Initialize from database.
virtual ossimIrect getAreaOfInterest() const
bool keyIsTrue(const std::string &key) const
virtual ossimDpt getMetersPerPixel() const
virtual bool writeFile()
Writes the file to disk or a stream.
virtual ossim_int32 beginTileProcessing()
Calls initial sqlite3_prepare_v2 statement.
virtual void setTileSize(const ossimIpt &tileSize)
const ossimDpt & lr() const
ossimDrect m_projectionBoundingRect
Holds the bounding rect of the output projection edges either in decimal degrees for geographic proje...
bool addLevels()
Adds levels to an existing an gpkg.
static const char * FILENAME_KW
static bool createTable(sqlite3 *db)
Creates table in database.
bool setCompressionLevel(const ossimString &level)
Set the gpkg compression level from a string.
unsigned char ossim_uint8
static ossimEpsgProjectionFactory * instance()
Implements singleton pattern.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_int64 getNumberOfTilesVertical() const
void getExpandedAoi(const ossimIrect &aoi, ossimIrect &expandedAoi) const
Gets aoi expanded to tile boundaries.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
saves the state of the object.
const std::string & string() const
void getProjectionDimensionsInMeters(const ossimMapProjection *proj, ossimDpt &dims) const
Gets the projection dimensions in meters.
ossim_uint64 m_batchCount
Working variable for holding the current batch count.
bool m_fullTileCodecAlpha
true if codec requires alpha channel.
ossim_float64 min< ossim_float64 >(ossim_float64 a, ossim_float64 b)