[mapserver-commits] r9716 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Wed Jan 20 14:29:31 EST 2010


Author: assefa
Date: 2010-01-20 14:29:31 -0500 (Wed, 20 Jan 2010)
New Revision: 9716

Modified:
   trunk/mapserver/mapwms.c
Log:
Adjust geotransform parameters for GetFeatureInfo #3241

Modified: trunk/mapserver/mapwms.c
===================================================================
--- trunk/mapserver/mapwms.c	2010-01-20 19:26:35 UTC (rev 9715)
+++ trunk/mapserver/mapwms.c	2010-01-20 19:29:31 UTC (rev 9716)
@@ -2925,13 +2925,40 @@
       }
   }
 
+  /*make sure to initialize the map scale so that layers that are scale dependent are resepected for 
+    the query*/ 
+  msCalculateScale(map->extent,map->units,map->width,map->height, map->resolution, &map->scaledenom);
+
+  /*adjust geotransformation parameters. This has no impact on regular GetFeatureInfo results
+   but is necessary if we need to return the results through templating mechanism and
+  need to transform (reproject) the data #3241*/
+  if( msTestConfigOption( map, "MS_NONSQUARE", MS_FALSE ) )
+  {
+      double cellsize_x = (map->extent.maxx - map->extent.minx)/map->width;
+      double cellsize_y = (map->extent.maxy - map->extent.miny)/map->height;
+
+      if( cellsize_y != 0.0 
+          && (fabs(cellsize_x/cellsize_y) > 1.00001
+              || fabs(cellsize_x/cellsize_y) < 0.99999) )
+      {
+          map->gt.need_geotransform = MS_TRUE;
+          if (map->debug)
+            msDebug( "msDrawMap(): kicking into non-square pixel preserving mode.\n" );
+      }
+      map->cellsize = (cellsize_x*0.5 + cellsize_y*0.5);
+
+      /* update geotransform based on adjusted extent. */
+      msMapComputeGeotransform( map );
+
+      /* Do we need to fake out stuff for rotated support? */
+      if( map->gt.need_geotransform )
+        msMapSetFakedExtent( map );
+  }
 /* -------------------------------------------------------------------- */
 /*      check if all layers selected are queryable. If not send an      */
 /*      exception.                                                      */
 /* -------------------------------------------------------------------- */
-  /*make sure to initialize the map scale so that layers that are scale dependent are resepected for 
-    the query*/ 
-  msCalculateScale(map->extent,map->units,map->width,map->height, map->resolution, &map->scaledenom);
+  
   for (i=0; i<map->numlayers; i++)
   {
       if (GET_LAYER(map, i)->status == MS_ON && !msIsLayerQueryable(GET_LAYER(map, i)))



More information about the mapserver-commits mailing list