port fixes from trunk for gdal bilinear resampling quality (r1912,#563)

This commit is contained in:
Dane Springmeyer 2010-07-10 11:53:40 +00:00
parent d14f8515ef
commit 55f0c4da60
6 changed files with 316 additions and 254 deletions

View file

@ -189,6 +189,35 @@ namespace mapnik
{
if_rules.push_back(const_cast<rule_type*>(&(*ruleIter)));
}
if (ds->type() == datasource::Raster)
{
if (ds->params().get<double>("filter_factor",0.0) == 0.0)
{
const symbolizers& symbols = ruleIter->get_symbolizers();
symbolizers::const_iterator symIter = symbols.begin();
symbolizers::const_iterator symEnd = symbols.end();
for (;symIter != symEnd;++symIter)
{
try
{
raster_symbolizer sym = boost::get<raster_symbolizer>(*symIter);
std::string scaling = sym.get_scaling();
if (scaling == "bilinear" || scaling == "bilinear8" )
{
// todo - allow setting custom value in symbolizer property?
q.filter_factor(2.0);
}
}
catch (const boost::bad_get &v)
{
// case where useless symbolizer is attached to raster layer
//throw config_error("Invalid Symbolizer type supplied, only RasterSymbolizer is supported");
}
}
}
}
}
}
std::set<std::string>::const_iterator namesIter=names.begin();

View file

@ -25,7 +25,6 @@
#ifndef QUERY_HPP
#define QUERY_HPP
//mapnik
#include <mapnik/filter.hpp>
#include <mapnik/envelope.hpp>
#include <mapnik/feature.hpp>
// stl
@ -39,25 +38,23 @@ namespace mapnik {
Envelope<double> bbox_;
double resolution_;
double scale_denominator_;
double filter_factor_;
std::set<std::string> names_;
public:
explicit query(const Envelope<double>& bbox, double resolution, double scale_denominator)
: bbox_(bbox),
resolution_(resolution),
scale_denominator_(scale_denominator)
{}
explicit query(const Envelope<double>& bbox, double resolution)
: bbox_(bbox),
resolution_(resolution),
scale_denominator_(0.0)
{}
query(Envelope<double> const& bbox, double resolution, double scale_denominator = 1.0)
: bbox_(bbox),
resolution_(resolution),
scale_denominator_(scale_denominator),
filter_factor_(1.0)
{}
query(const query& other)
: bbox_(other.bbox_),
resolution_(other.resolution_),
scale_denominator_(other.scale_denominator_),
filter_factor_(other.filter_factor_),
names_(other.names_)
{}
@ -67,6 +64,7 @@ namespace mapnik {
bbox_=other.bbox_;
resolution_=other.resolution_;
scale_denominator_=other.scale_denominator_;
filter_factor_=other.filter_factor_;
names_=other.names_;
return *this;
}
@ -85,6 +83,16 @@ namespace mapnik {
{
return bbox_;
}
double get_filter_factor() const
{
return filter_factor_;
}
void filter_factor(double factor)
{
filter_factor_ = factor;
}
void add_property_name(const std::string& name)
{

View file

@ -64,7 +64,8 @@ inline GDALDataset *gdal_datasource::open_dataset() const
gdal_datasource::gdal_datasource(parameters const& params)
: datasource(params),
desc_(*params.get<std::string>("type"),"utf-8")
desc_(*params.get<std::string>("type"),"utf-8"),
filter_factor_(*params_.get<double>("filter_factor",0.0))
{
#ifdef MAPNIK_DEBUG
@ -81,7 +82,7 @@ gdal_datasource::gdal_datasource(parameters const& params)
dataset_name_ = *base + "/" + *file;
else
dataset_name_ = *file;
shared_dataset_ = *params_.get<mapnik::boolean>("shared",false);
band_ = *params_.get<int>("band", -1);
@ -134,11 +135,11 @@ layer_descriptor gdal_datasource::get_descriptor() const
featureset_ptr gdal_datasource::features(query const& q) const
{
gdal_query gq = q;
return featureset_ptr(new gdal_featureset(*open_dataset(), band_, gq));
return featureset_ptr(new gdal_featureset(*open_dataset(), band_, gq, filter_factor_));
}
featureset_ptr gdal_datasource::features_at_point(coord2d const& pt) const
{
gdal_query gq = pt;
return featureset_ptr(new gdal_featureset(*open_dataset(), band_, gq));
return featureset_ptr(new gdal_featureset(*open_dataset(), band_, gq, filter_factor_));
}

View file

@ -47,6 +47,7 @@ class gdal_datasource : public mapnik::datasource
unsigned width_;
unsigned height_;
bool shared_dataset_;
double filter_factor_;
inline GDALDataset *open_dataset() const;
};

View file

@ -37,312 +37,334 @@ using mapnik::point_impl;
using mapnik::geometry2d;
gdal_featureset::gdal_featureset(GDALDataset & dataset, int band, gdal_query q)
: dataset_(dataset),
band_(band),
gquery_(q),
first_(true) {}
gdal_featureset::gdal_featureset(GDALDataset & dataset, int band, gdal_query q, double filter_factor)
: dataset_(dataset),
band_(band),
gquery_(q),
filter_factor_(filter_factor),
first_(true) {}
gdal_featureset::~gdal_featureset()
{
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: closing dataset = " << &dataset_ << "\n";
std::clog << "GDAL Plugin: closing dataset = " << &dataset_ << "\n";
#endif
GDALClose(&dataset_);
GDALClose(&dataset_);
}
feature_ptr gdal_featureset::next()
{
if (first_)
{
first_ = false;
if (first_)
{
first_ = false;
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: featureset, dataset = " << &dataset_ << "\n";
std::clog << "GDAL Plugin: featureset, dataset = " << &dataset_ << "\n";
#endif
query *q = boost::get<query>(&gquery_);
if(q) {
return get_feature(*q);
} else {
coord2d *p = boost::get<coord2d>(&gquery_);
if(p) {
return get_feature_at_point(*p);
}
}
// should never reach here
}
return feature_ptr();
query *q = boost::get<query>(&gquery_);
if(q) {
return get_feature(*q);
} else {
coord2d *p = boost::get<coord2d>(&gquery_);
if(p) {
return get_feature_at_point(*p);
}
}
// should never reach here
}
return feature_ptr();
}
feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
{
feature_ptr feature(new Feature(1));
feature_ptr feature(new Feature(1));
GDALRasterBand * red = 0;
GDALRasterBand * green = 0;
GDALRasterBand * blue = 0;
GDALRasterBand * alpha = 0;
GDALRasterBand * grey = 0;
GDALRasterBand * red = 0;
GDALRasterBand * green = 0;
GDALRasterBand * blue = 0;
GDALRasterBand * alpha = 0;
GDALRasterBand * grey = 0;
int nbands = dataset_.GetRasterCount();
int nbands = dataset_.GetRasterCount();
unsigned raster_width = dataset_.GetRasterXSize();
unsigned raster_height = dataset_.GetRasterYSize();
unsigned raster_width = dataset_.GetRasterXSize();
unsigned raster_height = dataset_.GetRasterYSize();
// TODO - pull from class attributes...
double tr[6];
dataset_.GetGeoTransform(tr);
double dx = tr[1];
double dy = tr[5];
double x0 = tr[0]; // minx
double y0 = tr[3]; // miny
double x1 = tr[0] + raster_width * dx + raster_height * tr[2]; // maxx
double y1 = tr[3] + raster_width * tr[4] + raster_height * dy; // maxy
Envelope<double> raster_extent(x0,y0,x1,y1);
CoordTransform t(raster_width,raster_height,raster_extent,0,0);
Envelope<double> intersect = raster_extent.intersect(q.get_bbox());
Envelope<double> box = t.forward(intersect);
// TODO - pull from class attributes...
double tr[6];
dataset_.GetGeoTransform(tr);
double dx = tr[1];
double dy = tr[5];
double x0 = tr[0] + (raster_height) * tr[2]; // minx
double y0 = tr[3] + (raster_height) * tr[5]; // miny
double x1 = tr[0] + (raster_width) * tr[1]; // maxx
double y1 = tr[3] + (raster_width) * tr[4]; // maxy
Envelope<double> raster_extent(x0,y0,x1,y1);
CoordTransform t(raster_width,raster_height,raster_extent,0,0);
Envelope<double> intersect = raster_extent.intersect(q.get_bbox());
Envelope<double> box = t.forward(intersect);
//size of resized output pixel in source image domain
double margin_x = 1.0/(fabs(dx)*q.resolution());
double margin_y = 1.0/(fabs(dy)*q.resolution());
if (margin_x < 1)
margin_x = 1.0;
if (margin_y < 1)
margin_y = 1.0;
//select minimum raster containing whole box
int x_off = rint(box.minx() - margin_x);
int y_off = rint(box.miny() - margin_y);
int end_x = rint(box.maxx() + margin_x);
int end_y = rint(box.maxy() + margin_y);
//clip to available data
if (x_off < 0)
x_off = 0;
if (y_off < 0)
y_off = 0;
if (end_x > (int)raster_width)
end_x = raster_width;
if (end_y > (int)raster_height)
end_y = raster_height;
int width = end_x - x_off;
int height = end_y - y_off;
// don't process almost invisible data
if (box.width() < 0.5)
width = 0;
if (box.height() < 0.5)
height = 0;
//calculate actual envelope of returned raster
Envelope<double> feature_raster_extent(x_off, y_off, x_off+width, y_off+height);
intersect = t.backward(feature_raster_extent);
//size of resized output pixel in source image domain
double margin_x = 1.0/(fabs(dx)*q.resolution());
double margin_y = 1.0/(fabs(dy)*q.resolution());
if (margin_x < 1)
margin_x = 1.0;
if (margin_y < 1)
margin_y = 1.0;
//select minimum raster containing whole box
int x_off = rint(box.minx() - margin_x);
int y_off = rint(box.miny() - margin_y);
int end_x = rint(box.maxx() + margin_x);
int end_y = rint(box.maxy() + margin_y);
//clip to available data
if (x_off < 0)
x_off = 0;
if (y_off < 0)
y_off = 0;
if (end_x > (int)raster_width)
end_x = raster_width;
if (end_y > (int)raster_height)
end_y = raster_height;
int width = end_x - x_off;
int height = end_y - y_off;
// don't process almost invisible data
if (box.width() < 0.5)
width = 0;
if (box.height() < 0.5)
height = 0;
//calculate actual Envelope of returned raster
Envelope<double> feature_raster_extent(x_off, y_off, x_off+width, y_off+height);
intersect = t.backward(feature_raster_extent);
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Raster extent=" << raster_extent << "\n";
std::clog << "GDAL Plugin: View extent=" << intersect << "\n";
std::clog << "GDAL Plugin: Query resolution=" << q.resolution() << "\n";
std::clog << boost::format("GDAL Plugin: StartX=%d StartY=%d Width=%d Height=%d \n") % x_off % y_off % width % height;
std::clog << "GDAL Plugin: Raster extent=" << raster_extent << "\n";
std::clog << "GDAL Plugin: View extent=" << intersect << "\n";
std::clog << "GDAL Plugin: Query resolution=" << boost::get<0>(q.resolution()) << "," << boost::get<1>(q.resolution()) << "\n";
std::clog << boost::format("GDAL Plugin: StartX=%d StartY=%d Width=%d Height=%d \n") % x_off % y_off % width % height;
#endif
if (width > 0 && height > 0)
{
int im_width = int(q.resolution() * intersect.width() + 0.5);
int im_height = int(q.resolution() * intersect.height() + 0.5);
// if layer-level filter_factor is set, apply it
if (filter_factor_)
{
im_width *= filter_factor_;
im_height *= filter_factor_;
}
// otherwise respect symbolizer level factor applied to query, default of 1.0
else
{
double sym_downsample_factor = q.get_filter_factor();
im_width *= sym_downsample_factor;
im_height *= sym_downsample_factor;
}
if (width > 0 && height > 0)
{
int im_width = int(q.resolution() * intersect.width() + 0.5);
int im_height = int(q.resolution() * intersect.height() + 0.5);
// case where we need to avoid upsampling so that the
// image can be later scaled within raster_symbolizer
if (im_width >= width || im_height >= height)
{
im_width = width;
im_height = height;
}
// case where we need to avoid upsampling so that the
// image can be later scaled within raster_symbolizer
if (im_width >= width || im_height >= height)
{
im_width = width;
im_height = height;
}
if (im_width > 0 && im_height > 0)
{
mapnik::ImageData32 image(im_width, im_height);
image.set(0xffffffff);
if (im_width > 0 && im_height > 0)
{
mapnik::ImageData32 image(im_width, im_height);
image.set(0xffffffff);
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Image Size=(" << im_width << "," << im_height << ")\n";
std::clog << "GDAL Plugin: Reading band " << band_ << "\n";
std::clog << "GDAL Plugin: Image Size=(" << im_width << "," << im_height << ")\n";
std::clog << "GDAL Plugin: Reading band " << band_ << "\n";
#endif
if (band_>0) // we are querying a single band
{
float *imageData = (float*)image.getBytes();
GDALRasterBand * band = dataset_.GetRasterBand(band_);
band->RasterIO(GF_Read, x_off, y_off, width, height,
imageData, image.width(), image.height(),
GDT_Float32, 0, 0);
feature->set_raster(mapnik::raster_ptr(new mapnik::raster(intersect,image)));
}
typedef std::vector<int,int> pallete;
if (band_>0) // we are querying a single band
{
float *imageData = (float*)image.getBytes();
GDALRasterBand * band = dataset_.GetRasterBand(band_);
band->RasterIO(GF_Read, x_off, y_off, width, height,
imageData, image.width(), image.height(),
GDT_Float32, 0, 0);
feature->set_raster(mapnik::raster_ptr(new mapnik::raster(intersect,image)));
}
else // working with all bands
{
for (int i = 0; i < nbands; ++i)
{
GDALRasterBand * band = dataset_.GetRasterBand(i+1);
else // working with all bands
{
for (int i = 0; i < nbands; ++i)
{
GDALRasterBand * band = dataset_.GetRasterBand(i+1);
#ifdef MAPNIK_DEBUG
get_overview_meta(band);
get_overview_meta(band);
#endif
GDALColorInterp color_interp = band->GetColorInterpretation();
switch (color_interp)
{
case GCI_RedBand:
red = band;
GDALColorInterp color_interp = band->GetColorInterpretation();
switch (color_interp)
{
case GCI_RedBand:
red = band;
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Found red band" << "\n";
std::clog << "GDAL Plugin: Found red band" << "\n";
#endif
break;
case GCI_GreenBand:
green = band;
break;
case GCI_GreenBand:
green = band;
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Found green band" << "\n";
std::clog << "GDAL Plugin: Found green band" << "\n";
#endif
break;
case GCI_BlueBand:
blue = band;
break;
case GCI_BlueBand:
blue = band;
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Found blue band" << "\n";
std::clog << "GDAL Plugin: Found blue band" << "\n";
#endif
break;
case GCI_AlphaBand:
alpha = band;
break;
case GCI_AlphaBand:
alpha = band;
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Found alpha band" << "\n";
std::clog << "GDAL Plugin: Found alpha band" << "\n";
#endif
break;
case GCI_GrayIndex:
grey = band;
break;
case GCI_GrayIndex:
grey = band;
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Found gray band" << "\n";
std::clog << "GDAL Plugin: Found gray band" << "\n";
#endif
break;
case GCI_PaletteIndex:
{
grey = band;
break;
case GCI_PaletteIndex:
{
grey = band;
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Found gray band, and colortable..." << "\n";
std::clog << "GDAL Plugin: Found gray band, and colortable..." << "\n";
#endif
GDALColorTable *color_table = band->GetColorTable();
GDALColorTable *color_table = band->GetColorTable();
if ( color_table)
{
int count = color_table->GetColorEntryCount();
if ( color_table)
{
int count = color_table->GetColorEntryCount();
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Color Table count = " << count << "\n";
std::clog << "GDAL Plugin: Color Table count = " << count << "\n";
#endif
for ( int i = 0; i < count; i++ )
{
const GDALColorEntry *ce = color_table->GetColorEntry ( i );
if (!ce ) continue;
for ( int i = 0; i < count; i++ )
{
const GDALColorEntry *ce = color_table->GetColorEntry ( i );
if (!ce ) continue;
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Color entry RGB (" << ce->c1 << "," <<ce->c2 << "," << ce->c3 << ")\n";
std::clog << "GDAL Plugin: Color entry RGB (" << ce->c1 << "," <<ce->c2 << "," << ce->c3 << ")\n";
#endif
}
}
break;
}
case GCI_Undefined:
}
}
break;
}
case GCI_Undefined:
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Found undefined band (assumming gray band)" << "\n";
std::clog << "GDAL Plugin: Found undefined band (assumming gray band)" << "\n";
#endif
grey = band;
break;
default:
grey = band;
break;
default:
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: band type unknown!" << "\n";
std::clog << "GDAL Plugin: band type unknown!" << "\n";
#endif
break;
}
}
if (red && green && blue)
{
break;
}
}
if (red && green && blue)
{
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: processing rgb bands..." << "\n";
std::clog << "GDAL Plugin: processing rgb bands..." << "\n";
#endif
red->RasterIO(GF_Read,x_off,y_off,width,height,image.getBytes() + 0,
image.width(),image.height(),GDT_Byte,4,4*image.width());
green->RasterIO(GF_Read,x_off,y_off,width,height,image.getBytes() + 1,
image.width(),image.height(),GDT_Byte,4,4*image.width());
blue->RasterIO(GF_Read,x_off,y_off,width,height,image.getBytes() + 2,
image.width(),image.height(),GDT_Byte,4,4*image.width());
}
else if (grey)
{
red->RasterIO(GF_Read,x_off,y_off,width,height,image.getBytes() + 0,
image.width(),image.height(),GDT_Byte,4,4*image.width());
green->RasterIO(GF_Read,x_off,y_off,width,height,image.getBytes() + 1,
image.width(),image.height(),GDT_Byte,4,4*image.width());
blue->RasterIO(GF_Read,x_off,y_off,width,height,image.getBytes() + 2,
image.width(),image.height(),GDT_Byte,4,4*image.width());
}
else if (grey)
{
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: processing gray band..." << "\n";
std::clog << "GDAL Plugin: processing gray band..." << "\n";
#endif
grey->RasterIO(GF_Read,x_off,y_off,width,height,image.getBytes() + 0,
image.width(),image.height(),GDT_Byte, 4, 4 * image.width());
grey->RasterIO(GF_Read,x_off,y_off,width,height,image.getBytes() + 1,
image.width(),image.height(),GDT_Byte, 4, 4 * image.width());
grey->RasterIO(GF_Read,x_off,y_off,width,height,image.getBytes() + 2,
image.width(),image.height(),GDT_Byte, 4, 4 * image.width());
}
if (alpha)
{
// TODO : apply colormap if present
grey->RasterIO(GF_Read,x_off,y_off,width,height,image.getBytes() + 0,
image.width(),image.height(),GDT_Byte, 4, 4 * image.width());
grey->RasterIO(GF_Read,x_off,y_off,width,height,image.getBytes() + 1,
image.width(),image.height(),GDT_Byte, 4, 4 * image.width());
grey->RasterIO(GF_Read,x_off,y_off,width,height,image.getBytes() + 2,
image.width(),image.height(),GDT_Byte, 4, 4 * image.width());
}
if (alpha)
{
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: processing alpha band..." << "\n";
std::clog << "GDAL Plugin: processing alpha band..." << "\n";
#endif
alpha->RasterIO(GF_Read,x_off,y_off,width,height,image.getBytes() + 3,
image.width(),image.height(),GDT_Byte,4,4*image.width());
}
feature->set_raster(mapnik::raster_ptr(new mapnik::raster(intersect,image)));
}
return feature;
}
}
return feature_ptr();
alpha->RasterIO(GF_Read,x_off,y_off,width,height,image.getBytes() + 3,
image.width(),image.height(),GDT_Byte,4,4*image.width());
}
feature->set_raster(mapnik::raster_ptr(new mapnik::raster(intersect,image)));
}
return feature;
}
}
return feature_ptr();
}
feature_ptr gdal_featureset::get_feature_at_point(mapnik::coord2d const& pt)
{
if (band_>0) {
if (band_>0) {
unsigned raster_xsize = dataset_.GetRasterXSize();
unsigned raster_ysize = dataset_.GetRasterYSize();
unsigned raster_xsize = dataset_.GetRasterXSize();
unsigned raster_ysize = dataset_.GetRasterYSize();
double gt[6];
dataset_.GetGeoTransform(gt);
double gt[6];
dataset_.GetGeoTransform(gt);
double det = gt[1]*gt[5] - gt[2]*gt[4];
// subtract half a pixel width & height because gdal coord reference
// is the top-left corner of a pixel, not the center.
double X = pt.x - gt[0] - gt[1]/2;
double Y = pt.y - gt[3] - gt[5]/2;
double det1 = gt[1]*Y + gt[4]*X;
double det2 = gt[2]*Y + gt[5]*X;
unsigned x = det2/det, y = det1/det;
double det = gt[1]*gt[5] - gt[2]*gt[4];
// subtract half a pixel width & height because gdal coord reference
// is the top-left corner of a pixel, not the center.
double X = pt.x - gt[0] - gt[1]/2;
double Y = pt.y - gt[3] - gt[5]/2;
double det1 = gt[1]*Y + gt[4]*X;
double det2 = gt[2]*Y + gt[5]*X;
unsigned x = det2/det, y = det1/det;
if(0<=x && x<raster_xsize && 0<=y && y<raster_ysize) {
if(0<=x && x<raster_xsize && 0<=y && y<raster_ysize) {
#ifdef MAPNIK_DEBUG
std::clog << boost::format("GDAL Plugin: pt.x=%f pt.y=%f\n") % pt.x % pt.y;
std::clog << boost::format("GDAL Plugin: x=%f y=%f\n") % x % y;
std::clog << boost::format("GDAL Plugin: pt.x=%f pt.y=%f\n") % pt.x % pt.y;
std::clog << boost::format("GDAL Plugin: x=%f y=%f\n") % x % y;
#endif
GDALRasterBand * band = dataset_.GetRasterBand(band_);
int hasNoData;
double nodata = band->GetNoDataValue(&hasNoData);
double value;
band->RasterIO(GF_Read, x, y, 1, 1, &value, 1, 1, GDT_Float64, 0, 0);
if(!hasNoData || value!=nodata) {
// construct feature
feature_ptr feature(new Feature(1));
geometry2d * point = new point_impl;
point->move_to(pt.x, pt.y);
feature->add_geometry(point);
(*feature)["value"] = value;
return feature;
}
}
}
return feature_ptr();
GDALRasterBand * band = dataset_.GetRasterBand(band_);
int hasNoData;
double nodata = band->GetNoDataValue(&hasNoData);
double value;
band->RasterIO(GF_Read, x, y, 1, 1, &value, 1, 1, GDT_Float64, 0, 0);
if(!hasNoData || value!=nodata) {
// construct feature
feature_ptr feature(new Feature(1));
geometry2d * point = new point_impl;
point->move_to(pt.x, pt.y);
feature->add_geometry(point);
(*feature)["value"] = value;
return feature;
}
}
}
return feature_ptr();
}
void gdal_featureset::get_overview_meta(GDALRasterBand * band)
@ -355,7 +377,7 @@ void gdal_featureset::get_overview_meta(GDALRasterBand * band)
{
GDALRasterBand * overview = band->GetOverview (b);
std::clog << boost::format("GDAL Plugin: Overview=%d Width=%d Height=%d \n")
% b % overview->GetXSize() % overview->GetYSize();
% b % overview->GetXSize() % overview->GetYSize();
}
}
else
@ -368,6 +390,6 @@ void gdal_featureset::get_overview_meta(GDALRasterBand * band)
band->GetBlockSize(&bsx,&bsy);
scale = band->GetScale();
std::clog << boost::format("GDAL Plugin: Block=%dx%d Scale=%f Type=%s Color=%s \n") % bsx % bsy % scale
% GDALGetDataTypeName(band->GetRasterDataType())
% GDALGetColorInterpretationName(band->GetColorInterpretation());
% GDALGetDataTypeName(band->GetRasterDataType())
% GDALGetColorInterpretationName(band->GetColorInterpretation());
}

View file

@ -36,7 +36,7 @@ class gdal_featureset : public mapnik::Featureset
{
public:
gdal_featureset(GDALDataset & dataset, int band, gdal_query q);
gdal_featureset(GDALDataset & dataset, int band, gdal_query q, double filter_factor);
virtual ~gdal_featureset();
mapnik::feature_ptr next();
private:
@ -46,6 +46,7 @@ class gdal_featureset : public mapnik::Featureset
GDALDataset & dataset_;
int band_;
gdal_query gquery_;
double filter_factor_;
bool first_;
};