[mapserver-commits] r7565 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Wed May 7 00:08:16 EDT 2008


Author: pramsey
Date: 2008-05-07 00:08:16 -0400 (Wed, 07 May 2008)
New Revision: 7565

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapshape.c
Log:
Don't ignore .qix file when DATA reference includes .shp extension (#590)


Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2008-05-07 04:03:45 UTC (rev 7564)
+++ trunk/mapserver/HISTORY.TXT	2008-05-07 04:08:16 UTC (rev 7565)
@@ -13,6 +13,8 @@
 Current Version (5.1-dev, SVN trunk):
 -------------------------------------
 
+- Don't ignore .qix file when DATA reference includes .shp extension (#590)
+
 - CGI able to alter layers with space and underscores (#2516)
 
 - WFS Multipoint query with PostGIS bug fixed (#2443)

Modified: trunk/mapserver/mapshape.c
===================================================================
--- trunk/mapserver/mapshape.c	2008-05-07 04:03:45 UTC (rev 7564)
+++ trunk/mapserver/mapshape.c	2008-05-07 04:08:16 UTC (rev 7565)
@@ -1718,7 +1718,9 @@
   int i;
   rectObj shaperect;
   char *filename;
-
+  char *sourcename = 0; /* shape file source string from map file */
+  char *s = 0; /* pointer to start of '.shp' in source string */
+  
   if(shpfile->status) {
     free(shpfile->status);
     shpfile->status = NULL;
@@ -1736,17 +1738,27 @@
       msSetError(MS_MEMERR, NULL, "msShapefileWhichShapes()");
       return(MS_FAILURE);
     }
-    for(i=0;i<shpfile->numshapes;i++) 
+    for(i=0;i<shpfile->numshapes;i++) {
       msSetBit(shpfile->status, i, 1);
-  } else {
-    if((filename = (char *)malloc(strlen(shpfile->source)+strlen(MS_INDEX_EXTENSION)+1)) == NULL) {
+    }
+  } 
+  else {
+
+    /* deal with case where sourcename is of the form 'file.shp' */
+    sourcename = strdup(shpfile->source);
+    s = strcasestr(sourcename, ".shp");
+    if( s ) *s = '\0';
+
+    if((filename = (char *)malloc(strlen(sourcename)+strlen(MS_INDEX_EXTENSION)+1)) == NULL) {
       msSetError(MS_MEMERR, NULL, "msShapefileWhichShapes()");    
       return(MS_FAILURE);
     }
-    sprintf(filename, "%s%s", shpfile->source, MS_INDEX_EXTENSION);
+  
+    sprintf(filename, "%s%s", sourcename, MS_INDEX_EXTENSION);
     
     shpfile->status = msSearchDiskTree(filename, rect, debug);
     free(filename);
+    free(sourcename);
 
     if(shpfile->status) { /* index  */
       msFilterTreeSearch(shpfile, shpfile->status, rect);



More information about the mapserver-commits mailing list