Permalink
Browse files

msResampleGDALToMap(): restrict fix done for #1715, to avoid regressi…

…ons like #5445

026847b
introduced a post correction of the source geotransform so that it matches the
sSrcExtent exactly. However the condition for this to make sense is that the
initial geotransform has square pixels.
  • Loading branch information...
rouault committed Jun 14, 2017
1 parent 879ca29 commit 3e262f4ca736516bf303b7c9389ffbf89a5be430
Showing with 6 additions and 1 deletion.
  1. +6 −1 mapresample.c
View
@@ -1547,7 +1547,12 @@ int msResampleGDALToMap( mapObj *map, layerObj *layer, imageObj *image,
/* matches the sSrcExtent, even if that generates non-square pixels (#1715) */
/* The rotated case should ideally be dealt with, but not for now... */
if( adfSrcGeoTransform[2] == 0 && adfSrcGeoTransform[4] == 0 &&
adfSrcGeoTransform[5] < 0 )
adfSrcGeoTransform[5] < 0 &&
/* But do that only if the pixels were square before, otherwise */
/* this is going to mess with source rasters whose pixels aren't at */
/* all square (#5445) */
fabs(fabs(adfSrcGeoTransform[1]) - fabs(adfSrcGeoTransform[5])) <
0.01 * fabs(adfSrcGeoTransform[1]) )
{
adfSrcGeoTransform[1] = (sSrcExtent.maxx - sSrcExtent.minx) *
dfNominalCellSize / nLoadImgXSize;

0 comments on commit 3e262f4

Please sign in to comment.