From 69f38549c5763300a218a60fff14d77dcf39adee Mon Sep 17 00:00:00 2001 From: Jiri Drbalek Date: Thu, 24 May 2018 13:23:40 +0000 Subject: [PATCH] gdal: Do not shrink query extent --- plugins/input/gdal/gdal_featureset.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/plugins/input/gdal/gdal_featureset.cpp b/plugins/input/gdal/gdal_featureset.cpp index b5ca2667b..440041481 100644 --- a/plugins/input/gdal/gdal_featureset.cpp +++ b/plugins/input/gdal/gdal_featureset.cpp @@ -267,18 +267,14 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q) if (current_width != (int)raster_width_) { double ratio = (double)current_width / (double)raster_width_; - int adjusted_width = static_cast(std::floor((ratio * im_width) + 0.5)); - double adjusted_ratio = (double)adjusted_width / (double)im_width; - im_offset_x = adjusted_ratio * im_offset_x; - im_width = adjusted_width; + im_offset_x = std::floor(ratio * im_offset_x); + im_width = static_cast(std::ceil(ratio * im_width)); } if (current_height != (int)raster_height_) { double ratio = (double)current_height / (double)raster_height_; - int adjusted_height = static_cast(std::floor((ratio * im_height) + 0.5)); - double adjusted_ratio = (double)adjusted_height / (double)im_height; - im_offset_y = adjusted_ratio * im_offset_y; - im_height = adjusted_height; + im_offset_y = std::floor(ratio * im_offset_y); + im_height = static_cast(std::ceil(ratio * im_height)); } }