raster with large grid cell size shifting

Frank Warmerdam warmerdam at POBOX.COM
Wed Nov 21 10:13:53 EST 2007


Simon Haddon wrote:
> Hi,
> 
> I wasn't quiet sure what subject heading to give this problem.  I hope it
> is ok.
> 
> I have a map file which creates maps in decimal degrees.  The data is a
> mix raster and vector.  It is the raster data which I am having trouble
> with.
> 
> If I have any raster data with a large grid cell size (ie: 25 km) the
> generated map always has complete pixels (cells) created.  There are never
> any truncated pixels.  As a result pixels don't even maintain their
> correct relative position and can be seen differently, compared to the
> overlayed point and polygon data, depending on how fair you move or resize
> the map.
> 
> If I move the map a whole pixel cell size the pixels redraw in their
> correct position.  If a move the map 1/2 a pixel cell size then the pixels
> move to fit the image.  This can also extend to stretching the pixel cells
> to always ensure that a complete set of cells are displayed on the map
> 
> Has anyone had any experience with this problem and does anyone have any
> suggestions about how to fix it.

Simon,

This is due to an optimization in MapServer to use the GDAL RasterIO() call
for up/down sampling.  The net result is that requests are always made
on "pixel boundaries" and you get the result you see.  If you add the line:

   PROCESSING "RESAMPLE=NEAREST"

then MapServer will use a more general resampling code chunk which will give
better results, but at some performance cost.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the mapserver-users mailing list