raster with large grid cell size shifting

Simon Haddon simon at SIBERN.COM.AU
Wed Nov 21 13:05:53 PST 2007


Hi Frank,

Thank you very much.  I have been ripping my hair out over that one.

Cheers,
Simon

Frank Warmerdam wrote:
> 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,



More information about the MapServer-users mailing list