[mapserver-commits] r10011 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Thu Mar 25 10:38:45 EDT 2010


Author: warmerdam
Date: 2010-03-25 10:38:44 -0400 (Thu, 25 Mar 2010)
New Revision: 10011

Modified:
   trunk/mapserver/mapdrawgdal.c
Log:
fix support for EXTENT keyword on raster layers (#3402)

Modified: trunk/mapserver/mapdrawgdal.c
===================================================================
--- trunk/mapserver/mapdrawgdal.c	2010-03-25 14:37:43 UTC (rev 10010)
+++ trunk/mapserver/mapdrawgdal.c	2010-03-25 14:38:44 UTC (rev 10011)
@@ -1964,10 +1964,7 @@
 {
     const char *extent_priority = NULL;
     const char *value;
-
-#if defined(USE_WMS_SVR) || defined (USE_WFS_SVR)
     rectObj  rect;
-#endif
 
 /* -------------------------------------------------------------------- */
 /*      some GDAL drivers (ie. GIF) don't set geotransform on failure.  */
@@ -1988,7 +1985,7 @@
     if( extent_priority != NULL
         && EQUALN(extent_priority,"WORLD",5) )
     {
-	        if( GDALGetDescription(hDS) != NULL 
+        if( GDALGetDescription(hDS) != NULL 
             && GDALReadWorldFile(GDALGetDescription(hDS), "wld", 
                                  padfGeoTransform) )
         {
@@ -2027,6 +2024,30 @@
     }
 
 /* -------------------------------------------------------------------- */
+/*      Do we have the extent keyword on the layer?  We only use        */
+/*      this if we have a single raster associated with the layer as    */
+/*      opposed to a tile index.                                        */
+/*                                                                      */
+/*      Arguably this ought to take priority over all the other         */
+/*      stuff.                                                          */
+/* -------------------------------------------------------------------- */
+    if (MS_VALID_EXTENT(layer->extent) && layer->data != NULL)
+    {
+        rect = layer->extent;
+
+        padfGeoTransform[0] = rect.minx;
+        padfGeoTransform[1] = (rect.maxx - rect.minx) /
+            (double) GDALGetRasterXSize( hDS );
+        padfGeoTransform[2] = 0;
+        padfGeoTransform[3] = rect.maxy;
+        padfGeoTransform[4] = 0;
+        padfGeoTransform[5] = (rect.miny - rect.maxy) /
+            (double) GDALGetRasterYSize( hDS );
+        
+        return MS_SUCCESS;
+    }
+
+/* -------------------------------------------------------------------- */
 /*      Try OWS extent metadata.  We only try this if we know there     */
 /*      is metadata so that we don't end up going into the layer        */
 /*      getextent function which will in turn reopen the file with      */



More information about the mapserver-commits mailing list