[mapserver-users] Scaling and Postioning problems with Mapserver as WMS client (was: Dynamically generated Raster images in mapfile)

Heiko Schröter schroete at iup.physik.uni-bremen.de
Mon Apr 12 06:57:09 EDT 2010


Hello,

images are not scaled and positioned correctly when mapserver is working as WMS client.
After some grok debugging the symptom bubbled up in mapraster.c.
But to my best knwoledge i think the real issue is in mapwmslayer.c where the setup of the picture limits and/or the resampling logic for GDAL is broken (speaking very carefully here).

So the workaround for me is to allways pass Raster images to msResampleGDALtoMap(). Then everything works just fine.
Speed is not crucial in our case.

A real fix would be better of course.

Regards
Heiko


mapraster.c (line 1545)
#ifdef USE_PROJ
            if( ((adfGeoTransform[2] != 0.0 || adfGeoTransform[4] != 0.0
                  || adfGeoTransform[5] > 0.0 || adfGeoTransform[1] < 0.0 )
                 && layer->transform )
                || msProjectionsDiffer( &(map->projection), 
                                        &(layer->projection) ) 
                || CSLFetchNameValue( layer->processing, "RESAMPLE" ) != NULL )
            {
                status = msResampleGDALToMap( map, layer, image, hDS );
            }
            else
#endif
            {
                if( adfGeoTransform[2] != 0.0 || adfGeoTransform[4] != 0.0 )
                {
                    if( layer->debug || map->debug )
                        msDebug( 
                            "Layer %s has rotational coefficients but we\n"
                            "are unable to use them, projections support\n"
                            "needs to be built in.", 
                            layer->name );
                    
                }
		/* msDebug("HD Killroy in mapraster.c, Force resample -> msResampleGDALToMap even if logic tells no need to.\n"); */
		/* HD: 12.4.2010: Force Resample. If we come from WMS Client msDrawRasterLayer does not work properly ... */
		/* For testing we force msResampleGDALToMap even if it is slower. We don't mind  */
                status = msResampleGDALToMap( map, layer, image, hDS );
		/* status = msDrawRasterLayerGDAL(map, layer, image, hDS ); */

		/* msDrawRasterLayer is allways called, WMS or DATA source doesn't matter. */
		/* So real "bug(?)" seems to be the setup of the picture limits behind the scene. In this case in mapwmslayer.c around line 1345*/
		/* --> if (!msProjectionsDiffer(&(map->projection), &(lp->projection))) <-- But we need to resample, */
		/* otherwise picture won't fit. */
            }


More information about the mapserver-users mailing list