Reprojecting with Gdalwarp vs native MapServer

Frank Warmerdam warmerdam at POBOX.COM
Fri Oct 20 15:36:00 EDT 2006


Jan Hartmann wrote:
> Hi,
> 
> I have noticed that reprojecting layers on the fly in MapServer is much 
> slower than creating a new file with gdalwarp and using that one in 
> MapServer. With a PHP-MapScript program MapServer took two to three 
> times as much time as gdalwarp, despite the fact that gdalwarp requires 
> an extra read/write operation to disk. Is it possible to let MapServer 
> use gdal's warping engine when gdal is available?

Jan,

Thanks for the detailed instructions you provided off line for reproducing
this problem.  With that I was able to determine there was indeed a
*dramatic* performance problem sometimes with MapServer reprojection.  It
has likely been there since the beginning of raster reprojection in mapserver.

The problem was with the "transformation approximator".  This basically
takes the first, middle and last point on a scanline to be processed and
if a linear approximation of the middle from the first and last is
sufficiently close to the real transformed middle value then the
approximator assumes it can use the linear approximation all along.

But if it fails it is supposed to subdivide and try linear approximation
on each of the halves.  etc,

The bug was that after subdividing it actually called the "real" reprojection
code for every pixel, instead of doing the first,middle,last thing again.
This means that any time that raster reprojection was being done and it was
moderately non-linear (as in your case) we would end up reprojecting the
location for each and every pixel - which is quite expensive.

I have created a bug report for this problem:

   http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1944

I have fixed the problem in 4.10-branch and in the development head.

Thank you very much for doing the careful timing and submitting detailed
information to me isolating the problem for my review!

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