[mapserver-commits] r10012 - branches/branch-5-6/mapserver

svn at osgeo.org svn at osgeo.org
Thu Mar 25 10:42:50 EDT 2010


Author: warmerdam
Date: 2010-03-25 10:42:48 -0400 (Thu, 25 Mar 2010)
New Revision: 10012

Modified:
   branches/branch-5-6/mapserver/mapdrawgdal.c
Log:
fix support for EXTENT keyword on raster layers (#3402)

Modified: branches/branch-5-6/mapserver/mapdrawgdal.c
===================================================================
--- branches/branch-5-6/mapserver/mapdrawgdal.c	2010-03-25 14:38:44 UTC (rev 10011)
+++ branches/branch-5-6/mapserver/mapdrawgdal.c	2010-03-25 14:42:48 UTC (rev 10012)
@@ -1623,10 +1623,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.  */
@@ -1647,7 +1644,7 @@
     if( extent_priority != NULL
         && EQUALN(extent_priority,"WORLD",5) )
     {
-	        if( GDALGetDescription(hDS) != NULL 
+        if( GDALGetDescription(hDS) != NULL 
             && GDALReadWorldFile(GDALGetDescription(hDS), "wld", 
                                  padfGeoTransform) )
         {
@@ -1686,6 +1683,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