[mapserver-commits] r9670 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Tue Jan 5 15:55:37 EST 2010


Author: aboudreault
Date: 2010-01-05 15:55:36 -0500 (Tue, 05 Jan 2010)
New Revision: 9670

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/maprasterquery.c
Log:
Added support to get the extent of a raster layer that use a tileindex (#3252)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2010-01-05 14:58:01 UTC (rev 9669)
+++ trunk/mapserver/HISTORY.TXT	2010-01-05 20:55:36 UTC (rev 9670)
@@ -14,6 +14,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Added support to get the extent of a raster layer that use a tileindex (#3252)
+
 - Fixed configure to support FTGL 2.1.2 (#3247)
 
 - Changed msSaveImageBufferGD to be in accordance with msSaveImageGD (#3201)

Modified: trunk/mapserver/maprasterquery.c
===================================================================
--- trunk/mapserver/maprasterquery.c	2010-01-05 14:58:01 UTC (rev 9669)
+++ trunk/mapserver/maprasterquery.c	2010-01-05 20:55:36 UTC (rev 9670)
@@ -1379,6 +1379,8 @@
   double adfGeoTransform[6];
   int nXSize, nYSize;
   GDALDatasetH hDS;
+  shapefileObj *tileshpfile;
+  int tilelayerindex = -1; 
 
   /*
   ** For the time being we only automatically derive extents from
@@ -1388,9 +1390,9 @@
   ** the polygons but that is quite complicated code wise, so I am leaving
   ** that till someone cares more about the issue.  (#79)
   */
-  if( !layer->data 
-      || strlen(layer->data) == 0 
-      || layer->tileindex != NULL )
+
+  if( (!layer->data || strlen(layer->data) == 0) 
+      && layer->tileindex == NULL)
   {
     /* should we be issuing a specific error about not supporting 
        extents for tileindexed raster layers? */
@@ -1400,6 +1402,26 @@
   if( map == NULL )
     return MS_FAILURE;
 
+  /* If the layer use a tileindex...*/
+  if (layer->tileindex)
+  {
+    tilelayerindex = msGetLayerIndex(map, layer->tileindex);
+    if(tilelayerindex != -1) /* does the tileindex reference another layer */
+      return msLayerGetExtent(GET_LAYER(map, tilelayerindex), extent);
+    else 
+    {
+      tileshpfile = (shapefileObj *) malloc(sizeof(shapefileObj));
+      if(msShapefileOpen(tileshpfile, "rb", msBuildPath3(szPath, map->mappath, map->shapepath, layer->tileindex), MS_TRUE) == -1)
+        if(msShapefileOpen(tileshpfile, "rb", msBuildPath(szPath, map->mappath, layer->tileindex), MS_TRUE) == -1)
+          return MS_FAILURE;
+      
+      *extent = tileshpfile->bounds;
+      msShapefileClose(tileshpfile);
+      free(tileshpfile);
+      return MS_SUCCESS;
+    }
+  }
+
   msTryBuildPath3(szPath, map->mappath, map->shapepath, layer->data);
 
   msAcquireLock( TLOCK_GDAL );



More information about the mapserver-commits mailing list