Added the ability for GDAL overviews to be recursively searched.

This commit is contained in:
Blake Thompson 2018-08-08 14:17:12 -05:00
parent 74b2886036
commit b449e0b408
2 changed files with 16 additions and 0 deletions

View file

@ -131,12 +131,22 @@ void gdal_featureset::find_best_overview(int bandNumber,
int & current_height) const int & current_height) const
{ {
GDALRasterBand * band = dataset_.GetRasterBand(bandNumber); GDALRasterBand * band = dataset_.GetRasterBand(bandNumber);
find_best_overview(band, ideal_width, ideal_height, current_width, current_height);
}
void gdal_featureset::find_best_overview(GDALRasterBand * band,
int ideal_width,
int ideal_height,
int & current_width,
int & current_height) const
{
int band_overviews = band->GetOverviewCount(); int band_overviews = band->GetOverviewCount();
if (band_overviews > 0) if (band_overviews > 0)
{ {
for (int b = 0; b < band_overviews; b++) for (int b = 0; b < band_overviews; b++)
{ {
GDALRasterBand * overview = band->GetOverview(b); GDALRasterBand * overview = band->GetOverview(b);
find_best_overview(overview, ideal_width, ideal_height, current_width, current_height);
int overview_width = overview->GetXSize(); int overview_width = overview->GetXSize();
int overview_height = overview->GetYSize(); int overview_height = overview->GetYSize();
if ((overview_width < current_width || if ((overview_width < current_width ||

View file

@ -78,6 +78,12 @@ private:
int & current_width, int & current_width,
int & current_height) const; int & current_height) const;
void find_best_overview(GDALRasterBand * band,
int ideal_width,
int ideal_height,
int & current_width,
int & current_height) const;
mapnik::feature_ptr get_feature(mapnik::query const& q); mapnik::feature_ptr get_feature(mapnik::query const& q);
mapnik::feature_ptr get_feature_at_point(mapnik::coord2d const& p); mapnik::feature_ptr get_feature_at_point(mapnik::coord2d const& p);
GDALDataset & dataset_; GDALDataset & dataset_;