Skip to content

Commit

Permalink
msResampleGDALToMap(): fix inappropriate cellsize computation when lo…
Browse files Browse the repository at this point in the history
…ading (well beyond) full source raster.
  • Loading branch information
rouault committed Jan 17, 2017
1 parent 506c173 commit fc27281
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mapresample.c
Expand Up @@ -1471,7 +1471,12 @@ int msResampleGDALToMap( mapObj *map, layerObj *layer, imageObj *image,
sqrt(adfSrcGeoTransform[1] * adfSrcGeoTransform[1]
+ adfSrcGeoTransform[2] * adfSrcGeoTransform[2]);

if( (sOrigSrcExtent.maxx - sOrigSrcExtent.minx) > dfOversampleRatio * nDstXSize
/* Check first that the requested extent is not greater than the source */
/* raster. This might be the case for example if asking to visualize */
/* -180,-89,180,90 in EPSG:4326 from a raster in Arctic Polar Stereographic */
if( !(sOrigSrcExtent.minx <= 0 && sOrigSrcExtent.miny <= 0 &&
sOrigSrcExtent.maxx >= nSrcXSize && sOrigSrcExtent.maxy >= nSrcYSize)
&& (sOrigSrcExtent.maxx - sOrigSrcExtent.minx) > dfOversampleRatio * nDstXSize
&& !CSLFetchBoolean( layer->processing, "LOAD_FULL_RES_IMAGE", FALSE ))
sDummyMap.cellsize =
(dfNominalCellSize * (sOrigSrcExtent.maxx - sOrigSrcExtent.minx))
Expand Down
Binary file added msautotest/wxs/data/polar_stereo.tif
Binary file not shown.
Binary file added msautotest/wxs/expected/wms_polar_stereo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions msautotest/wxs/wms_polar_stereo.map
@@ -0,0 +1,48 @@
#
# Tests support for images in polar stereographic projection
#
# REQUIRES: SUPPORTS=WMS
#
#
# GetMap
# RUN_PARMS: wms_polar_stereo.png [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&LAYERS=test&STYLES=&CRS=EPSG:4326&BBOX=-89,-180,90,180&WIDTH=200&HEIGHT=200&FORMAT=image/png" > [RESULT_DEMIME]

MAP

NAME TEST
STATUS ON
SIZE 200 200
EXTENT -180 -89 180 90
IMAGECOLOR 0 0 0

PROJECTION
"init=epsg:4326"
END

IMAGETYPE png8_t

OUTPUTFORMAT
NAME png8_t
DRIVER "GD/PNG"
IMAGEMODE PC256
TRANSPARENT OFF
END

WEB
METADATA
"ows_enable_request" "*"
"wms_srs" "EPSG:4326"
END
END

LAYER
NAME test
TYPE raster
STATUS default
DATA data/polar_stereo.tif
PROJECTION
AUTO
END
END
END # of map file

1 comment on commit fc27281

@tbonfort
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rouault while you're on this, can you check/apply MapServer#1715 ?

Please sign in to comment.