Skip to content

Commit

Permalink
preliminary support for overviews in proxydb directory (#2432)
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.osgeo.org/gdal/trunk/gdal@16704 f0d54148-0727-0410-94bb-9a71ac55c965
  • Loading branch information
warmerdam committed Apr 2, 2009
1 parent 982d04d commit ee2963b
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gcore/gdal_pam.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ class CPL_DLL GDALPamDataset : public GDALDataset
virtual CPLErr SetMetadataItem( const char * pszName,
const char * pszValue,
const char * pszDomain = "" );
virtual char **GetMetadata( const char * pszDomain = "" );
virtual const char *GetMetadataItem( const char * pszName,
const char * pszDomain = "" );

virtual char **GetFileList(void);

Expand Down
34 changes: 34 additions & 0 deletions gcore/gdaldefaultoverviews.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,21 @@ void GDALDefaultOverviews::Initialize( GDALDataset *poDSIn,
}
}

/* -------------------------------------------------------------------- */
/* If we still don't have an overview, check to see if we have */
/* overview metadata referencing a remote (ie. proxy) dataset. */
/* -------------------------------------------------------------------- */
if( poODS == NULL )
{
const char *pszProxyOvrFilename =
poDS->GetMetadataItem( "OVERVIEW_FILE", "OVERVIEWS" );
if( pszProxyOvrFilename != NULL )
{
osOvrFilename = pszProxyOvrFilename;
poODS = (GDALDataset *) GDALOpen(osOvrFilename,GA_Update);
}
}

/* -------------------------------------------------------------------- */
/* If we have an overview dataset, then mark all the overviews */
/* with the base dataset Used later for finding overviews */
Expand Down Expand Up @@ -458,6 +473,25 @@ GDALDefaultOverviews::BuildOverviews(
eErr = GTIFFBuildOverviews( osOvrFilename, nBands, pahBands,
nNewOverviews, panNewOverviewList,
pszResampling, pfnProgress, pProgressData );

// Probe for proxy overview filename.
if( eErr == CE_Failure )
{
CPLDebug( "GDALDefaultOverviews", "GTIFFBuildOverviews failed, request proxy overview" );
const char *pszProxyOvrFilename =
poDS->GetMetadataItem("FILENAME","ProxyOverviewRequest");

if( pszProxyOvrFilename != NULL )
{
CPLDebug( "GDALDefaultOverviews",
"got %s", pszProxyOvrFilename );
osOvrFilename = pszProxyOvrFilename;
eErr = GTIFFBuildOverviews( osOvrFilename, nBands, pahBands,
nNewOverviews, panNewOverviewList,
pszResampling,
pfnProgress, pProgressData );
}
}

if( eErr == CE_None )
{
Expand Down
37 changes: 37 additions & 0 deletions gcore/gdalpamdataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,43 @@ CPLErr GDALPamDataset::SetMetadataItem( const char *pszName,
return GDALDataset::SetMetadataItem( pszName, pszValue, pszDomain );
}

/************************************************************************/
/* GetMetadataItem() */
/************************************************************************/

const char *GDALPamDataset::GetMetadataItem( const char *pszName,
const char *pszDomain )

{
CPLDebug( "GDALPamDataset", "GetMetadataItem(%s,%s)",
pszName, pszDomain );

if( pszDomain == NULL || !EQUAL(pszDomain,"ProxyOverviewRequest") )
return GDALDataset::GetMetadataItem( pszName, pszDomain );

CPLString osPrelimOvr = GetDescription();
osPrelimOvr += ".ovr";

const char *pszProxyOvrFilename = PamAllocateProxy( osPrelimOvr );
if( pszProxyOvrFilename == NULL )
return NULL;

SetMetadataItem( "OVERVIEW_FILE", pszProxyOvrFilename, "OVERVIEWS" );

return pszProxyOvrFilename;
}

/************************************************************************/
/* GetMetadata() */
/************************************************************************/

char **GDALPamDataset::GetMetadata( const char *pszDomain )

{
// if( pszDomain == NULL || !EQUAL(pszDomain,"ProxyOverviewRequest") )
return GDALDataset::GetMetadata( pszDomain );
}

/************************************************************************/
/* TryLoadAux() */
/************************************************************************/
Expand Down

0 comments on commit ee2963b

Please sign in to comment.