[mapserver-commits] r8015 - in trunk/mapserver: . mapscript/php3
mapscript/swiginc
svn at osgeo.org
svn at osgeo.org
Tue Nov 11 13:14:14 EST 2008
Author: pramsey
Date: 2008-11-11 13:14:14 -0500 (Tue, 11 Nov 2008)
New Revision: 8015
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapobject.c
trunk/mapserver/mapraster.c
trunk/mapserver/maprasterquery.c
trunk/mapserver/mapscript/php3/mapscript_i.c
trunk/mapserver/mapscript/swiginc/shapefile.i
trunk/mapserver/mapserver.h
trunk/mapserver/mapshape.c
trunk/mapserver/mapshape.h
trunk/mapserver/shptree.c
Log:
IGNORE_MISSING_DATA largely replaced by run-time CONFIG property, ON_MISSING_DATA, which supports three modes: FAIL, LOG, and IGNORE. (#2785) ms-rfc-47.txt
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2008-11-08 15:22:31 UTC (rev 8014)
+++ trunk/mapserver/HISTORY.TXT 2008-11-11 18:14:14 UTC (rev 8015)
@@ -12,6 +12,10 @@
Current Version (5.3-dev, SVN trunk):
------------------------------------
+- IGNORE_MISSING_DATA: largely replaced by run-time CONFIG property,
+ ON_MISSING_DATA, which supports three modes: FAIL, LOG, and IGNORE.
+ (#2785) ms-rfc-47.txt
+
- mapstring.c: msStringTrim(*char str), front-and-back whitespace trimmer
- mappostgis.c: re-write to remove binary cursors and break up
Modified: trunk/mapserver/mapobject.c
===================================================================
--- trunk/mapserver/mapobject.c 2008-11-08 15:22:31 UTC (rev 8014)
+++ trunk/mapserver/mapobject.c 2008-11-11 18:14:14 UTC (rev 8015)
@@ -227,6 +227,33 @@
}
/************************************************************************/
+/* msMapIgnoreMissingData() */
+/************************************************************************/
+
+int msMapIgnoreMissingData( mapObj *map )
+{
+ const char *result = msGetConfigOption( map, "ON_MISSING_DATA" );
+ const int default_result =
+#ifndef IGNORE_MISSING_DATA
+ MS_MISSING_DATA_FAIL;
+#else
+ MS_MISSING_DATA_LOG;
+#endif
+
+ if( result == NULL )
+ return default_result;
+
+ if( strcasecmp(result,"FAIL") == 0 )
+ return MS_MISSING_DATA_FAIL;
+ else if( strcasecmp(result,"LOG") == 0 )
+ return MS_MISSING_DATA_LOG;
+ else if( strcasecmp(result,"IGNORE") == 0 )
+ return MS_MISSING_DATA_IGNORE;
+
+ return default_result;
+}
+
+/************************************************************************/
/* msMapSetExtent() */
/************************************************************************/
Modified: trunk/mapserver/mapraster.c
===================================================================
--- trunk/mapserver/mapraster.c 2008-11-08 15:22:31 UTC (rev 8014)
+++ trunk/mapserver/mapraster.c 2008-11-11 18:14:14 UTC (rev 8015)
@@ -1588,20 +1588,27 @@
** Generate an error.
*/
if( !f ) {
- msSetError(MS_IOERR, "%s using full path %s", "msDrawRaster()", filename, szPath);
+ int ignore_missing = msMapIgnoreMissingData( map );
+ if( ignore_missing != MS_MISSING_DATA_IGNORE ) {
+ msSetError(MS_IOERR, "%s using full path %s", "msDrawRaster()", filename, szPath);
+ }
-#ifndef IGNORE_MISSING_DATA
- if( layer->debug || map->debug )
+ if( ignore_missing == MS_MISSING_DATA_FAIL ) {
+ if( layer->debug || map->debug )
msDebug( "Unable to open file %s for layer %s ... fatal error.\n", filename, layer->name );
+ final_status = MS_FAILURE;
+ break;
+ }
- final_status = MS_FAILURE;
- break;
-#else
- if( layer->debug || map->debug )
+ if( ignore_missing == MS_MISSING_DATA_LOG ) {
+ if( layer->debug || map->debug )
msDebug( "Unable to open file %s for layer %s ... ignoring this missing data.\n", filename, layer->name );
+ continue;
+ }
- continue; /* skip it, next tile */
-#endif
+ if( ignore_missing == MS_MISSING_DATA_IGNORE ) {
+ continue; /* skip it, next tile */
+ }
}
/* put others which may require checks here */
Modified: trunk/mapserver/maprasterquery.c
===================================================================
--- trunk/mapserver/maprasterquery.c 2008-11-08 15:22:31 UTC (rev 8014)
+++ trunk/mapserver/maprasterquery.c 2008-11-11 18:14:14 UTC (rev 8015)
@@ -721,8 +721,8 @@
if(layer->tileindex) { /* we have in index file */
if(msShapefileOpen(&tilefile, "rb",
msBuildPath3(szPath, map->mappath, map->shapepath,
- layer->tileindex)) == -1)
- if(msShapefileOpen(&tilefile, "rb", msBuildPath(szPath, map->mappath, layer->tileindex)) == -1)
+ layer->tileindex), MS_TRUE) == -1)
+ if(msShapefileOpen(&tilefile, "rb", msBuildPath(szPath, map->mappath, layer->tileindex), MS_TRUE) == -1)
return(MS_FAILURE);
tileitemindex = msDBFGetItemIndex(tilefile.hDBF, layer->tileitem);
@@ -790,22 +790,22 @@
if( hDS == NULL )
{
+ int ignore_missing = msMapIgnoreMissingData( map );
msReleaseLock( TLOCK_GDAL );
-#ifndef IGNORE_MISSING_DATA
- if( layer->debug || map->debug )
+ if ( ignore_missing == MS_MISSING_DATA_FAIL ) {
+ if( layer->debug || map->debug )
msSetError( MS_IMGERR,
"Unable to open file %s for layer %s ... fatal error.\n%s",
szPath, layer->name, CPLGetLastErrorMsg(),
"msRasterQueryByRect()" );
-
- return(MS_FAILURE);
-#else
- if( layer->debug || map->debug )
+ return(MS_FAILURE);
+ }
+ if( ignore_missing == MS_MISSING_DATA_LOG ) {
+ if( layer->debug || map->debug )
msDebug( "Unable to open file %s for layer %s ... ignoring this missing data.\n%s",
filename, layer->name, CPLGetLastErrorMsg() );
-
-#endif
+ }
continue;
}
Modified: trunk/mapserver/mapscript/php3/mapscript_i.c
===================================================================
--- trunk/mapserver/mapscript/php3/mapscript_i.c 2008-11-08 15:22:31 UTC (rev 8014)
+++ trunk/mapserver/mapscript/php3/mapscript_i.c 2008-11-11 18:14:14 UTC (rev 8015)
@@ -1069,9 +1069,9 @@
return NULL;
if(type == -1)
- status = msShapefileOpen(shapefile, "rb", filename);
+ status = msShapefileOpen(shapefile, "rb", filename, MS_TRUE);
else if (type == -2)
- status = msShapefileOpen(shapefile, "rb+", filename);
+ status = msShapefileOpen(shapefile, "rb+", filename, MS_TRUE);
else
status = msShapefileCreate(shapefile, filename, type);
Modified: trunk/mapserver/mapscript/swiginc/shapefile.i
===================================================================
--- trunk/mapserver/mapscript/swiginc/shapefile.i 2008-11-08 15:22:31 UTC (rev 8014)
+++ trunk/mapserver/mapscript/swiginc/shapefile.i 2008-11-11 18:14:14 UTC (rev 8015)
@@ -42,9 +42,9 @@
return NULL;
if (type == -1)
- status = msShapefileOpen(shapefile, "rb", filename);
+ status = msShapefileOpen(shapefile, "rb", filename, MS_TRUE);
else if (type == -2)
- status = msShapefileOpen(shapefile, "rb+", filename);
+ status = msShapefileOpen(shapefile, "rb+", filename, MS_TRUE);
else
status = msShapefileCreate(shapefile, filename, type);
Modified: trunk/mapserver/mapserver.h
===================================================================
--- trunk/mapserver/mapserver.h 2008-11-08 15:22:31 UTC (rev 8014)
+++ trunk/mapserver/mapserver.h 2008-11-11 18:14:14 UTC (rev 8015)
@@ -175,6 +175,10 @@
#define MS_MAXCOLORS 256
+#define MS_MISSING_DATA_IGNORE 0
+#define MS_MISSING_DATA_FAIL 1
+#define MS_MISSING_DATA_LOG 2
+
#define MS_BUFFER_LENGTH 2048 /* maximum input line length */
#define MS_URL_LENGTH 1024
#define MS_MAXPATHLEN 1024
@@ -1520,6 +1524,7 @@
MS_DLL_EXPORT int msMapRestoreRealExtent( mapObj *map );
MS_DLL_EXPORT int msMapLoadOWSParameters( mapObj *map, cgiRequestObj *request,
const char *wmtver_string );
+MS_DLL_EXPORT int msMapIgnoreMissingData( mapObj *map );
/* mapfile.c */
Modified: trunk/mapserver/mapshape.c
===================================================================
--- trunk/mapserver/mapshape.c 2008-11-08 15:22:31 UTC (rev 8014)
+++ trunk/mapserver/mapshape.c 2008-11-11 18:14:14 UTC (rev 8015)
@@ -1626,13 +1626,14 @@
return MS_SUCCESS;
}
-int msShapefileOpen(shapefileObj *shpfile, char *mode, char *filename)
+int msShapefileOpen(shapefileObj *shpfile, char *mode, char *filename, int log_failures)
{
int i;
char *dbfFilename;
if(!filename) {
- msSetError(MS_IOERR, "No (NULL) filename provided.", "msShapefileOpen()");
+ if( log_failures )
+ msSetError(MS_IOERR, "No (NULL) filename provided.", "msShapefileOpen()");
return(-1);
}
@@ -1648,7 +1649,8 @@
shpfile->hSHP = msSHPOpen( filename, mode);
if(!shpfile->hSHP) {
- msSetError(MS_IOERR, "(%s)", "msShapefileOpen()", filename);
+ if( log_failures )
+ msSetError(MS_IOERR, "(%s)", "msShapefileOpen()", filename);
return(-1);
}
@@ -1674,7 +1676,8 @@
shpfile->hDBF = msDBFOpen(dbfFilename, "rb");
if(!shpfile->hDBF) {
- msSetError(MS_IOERR, "(%s)", "msShapefileOpen()", dbfFilename);
+ if( log_failures )
+ msSetError(MS_IOERR, "(%s)", "msShapefileOpen()", dbfFilename);
free(dbfFilename);
return(-1);
}
@@ -1810,6 +1813,52 @@
free(tiFileAbsDirTmp);
}
+/*
+** Build possible paths we might find the tile file at:
+** map dir + shape path + filename?
+** tile dir + shape path + filename?
+** map dir + filename?
+**
+** Returns
+** MS_SUCCESS - found a file
+** MS_FAILURE - no file, and map is configured to fail on missing
+** MS_DONE - no file, and map is configured to continue on missing
+*/
+int msTiledSHPTryOpen(shapefileObj *shpfile, layerObj *layer, char *tiFileAbsDir, char *filename) {
+ char szPath[MS_MAXPATHLEN];
+ int ignore_missing = msMapIgnoreMissingData(layer->map);
+ int log_failures = MS_TRUE;
+
+ if( ignore_missing == MS_MISSING_DATA_IGNORE )
+ log_failures = MS_FALSE;
+
+ if(msShapefileOpen(shpfile, "rb", msBuildPath3(szPath, layer->map->mappath, layer->map->shapepath, filename), log_failures) == -1) {
+ if(msShapefileOpen(shpfile, "rb", msBuildPath3(szPath, tiFileAbsDir, layer->map->shapepath, filename), log_failures) == -1) {
+ if(msShapefileOpen(shpfile, "rb", msBuildPath(szPath, layer->map->mappath, filename), log_failures) == -1) {
+ if(ignore_missing == MS_MISSING_DATA_FAIL) {
+ msSetError(MS_IOERR, "Unable to open shapefile '%s' for layer '%s' ... fatal error.", "msTiledSHPTryOpen()", filename, layer->name);
+ return(MS_FAILURE);
+ }
+ else if( ignore_missing == MS_MISSING_DATA_LOG ) {
+ if( layer->debug || layer->map->debug ) {
+ msDebug( "Unable to open shapefile '%s' for layer '%s' ... ignoring this missing data.\n", szPath, layer->name );
+ }
+ return(MS_DONE);
+ }
+ else if( ignore_missing == MS_MISSING_DATA_IGNORE ) {
+ return(MS_DONE);
+ }
+ else {
+ /* never get here */
+ msSetError(MS_IOERR, "msIgnoreMissingData returned unexpected value.", "msTiledSHPTryOpen()");
+ return(MS_FAILURE);
+ }
+ }
+ }
+ }
+ return(MS_SUCCESS);
+}
+
int msTiledSHPOpenFile(layerObj *layer)
{
int i;
@@ -1857,8 +1906,8 @@
/* we need tSHP->tileshpfile if we're not working with a layer */
tSHP->tileshpfile = (shapefileObj *) malloc(sizeof(shapefileObj));
- if(msShapefileOpen(tSHP->tileshpfile, "rb", msBuildPath3(szPath, layer->map->mappath, layer->map->shapepath, layer->tileindex)) == -1)
- if(msShapefileOpen(tSHP->tileshpfile, "rb", msBuildPath(szPath, layer->map->mappath, layer->tileindex)) == -1)
+ if(msShapefileOpen(tSHP->tileshpfile, "rb", msBuildPath3(szPath, layer->map->mappath, layer->map->shapepath, layer->tileindex), MS_TRUE) == -1)
+ if(msShapefileOpen(tSHP->tileshpfile, "rb", msBuildPath(szPath, layer->map->mappath, layer->tileindex), MS_TRUE) == -1)
return(MS_FAILURE);
}
@@ -1868,7 +1917,8 @@
/* position the source at the FIRST tile to use as a template, this is so the functions that fill the iteminfo array have something to work from */
for(i=0; i<tSHP->tileshpfile->numshapes; i++) {
-
+ int try_open;
+
if(!layer->data) /* assume whole filename is in attribute field */
filename = (char*) msDBFReadStringAttribute(tSHP->tileshpfile->hDBF, i, layer->tileitemindex);
else {
@@ -1877,24 +1927,12 @@
}
if(strlen(filename) == 0) continue; /* check again */
-
- if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath3(szPath, layer->map->mappath, layer->map->shapepath, filename)) == -1) {
- if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath3(szPath, tiFileAbsDir, layer->map->shapepath, filename)) == -1) {
- if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath(szPath, layer->map->mappath, filename)) == -1) {
-#ifndef IGNORE_MISSING_DATA
- if( layer->debug || layer->map->debug ) {
- msDebug( "Unable to open file %s for layer %s ... fatal error.\n", filename, layer->name );
- }
- return(MS_FAILURE);
-#else
- if( layer->debug || layer->map->debug ) {
- msDebug( "Unable to open shapefile %s for layer %s ... ignoring this missing data.\n", szPath, layer->name );
- }
- continue; /* check again */
-#endif
- }
- }
- }
+
+ try_open = msTiledSHPTryOpen(tSHP->shpfile, layer, tiFileAbsDir, filename);
+ if( try_open == MS_DONE )
+ continue;
+ else if (try_open == MS_FAILURE )
+ return(MS_FAILURE);
return(MS_SUCCESS); /* found a template, ok to proceed */
}
@@ -1903,10 +1941,11 @@
return(MS_FAILURE);
}
+
int msTiledSHPWhichShapes(layerObj *layer, rectObj rect)
{
int i, status;
- char *filename, tilename[MS_MAXPATHLEN], szPath[MS_MAXPATHLEN];
+ char *filename, tilename[MS_MAXPATHLEN];
char tiFileAbsDir[MS_MAXPATHLEN];
msTiledSHPLayerInfo *tSHP=NULL;
@@ -1934,7 +1973,8 @@
msInitShape(&tshape);
while((status = msLayerNextShape(tlp, &tshape)) == MS_SUCCESS) {
-
+ int try_open;
+
/* TODO: seems stupid to read the tileitem seperately from the shape, need to fix msTiledSHPOpenFile */
if(!layer->data) /* assume whole filename is in attribute field */
filename = (char *) msDBFReadStringAttribute(tSHP->tileshpfile->hDBF, tshape.index, layer->tileitemindex);
@@ -1945,23 +1985,11 @@
if(strlen(filename) == 0) continue; /* check again */
- if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath3(szPath, layer->map->mappath, layer->map->shapepath, filename)) == -1) {
- if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath3(szPath, tiFileAbsDir, layer->map->shapepath, filename)) == -1) {
- if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath(szPath, layer->map->mappath, filename)) == -1) {
-#ifndef IGNORE_MISSING_DATA
- if( layer->debug || layer->map->debug ) {
- msDebug( "Unable to open file %s for layer %s ... fatal error.\n", filename, layer->name );
- }
- return(MS_FAILURE);
-#else
- if( layer->debug || layer->map->debug ) {
- msDebug( "Unable to open shapefile %s for layer %s ... ignoring this missing data.\n", szPath, layer->name );
- }
- continue; /* check again */
-#endif
- }
- }
- }
+ try_open = msTiledSHPTryOpen(tSHP->shpfile, layer, tiFileAbsDir, filename);
+ if( try_open == MS_DONE )
+ continue;
+ else if (try_open == MS_FAILURE )
+ return(MS_FAILURE);
status = msShapefileWhichShapes(tSHP->shpfile, rect, layer->debug);
if(status == MS_DONE) {
@@ -1981,7 +2009,8 @@
return(status); /* if we reach here we either 1) ran out of tiles or 2) had an error reading a tile */
} else { /* or reference a shapefile directly */
-
+ int try_open;
+
status = msShapefileWhichShapes(tSHP->tileshpfile, rect, layer->debug);
if(status != MS_SUCCESS) return(status); /* could be MS_DONE or MS_FAILURE */
@@ -1999,23 +2028,11 @@
if(strlen(filename) == 0) continue; /* check again */
- if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath3(szPath, layer->map->mappath, layer->map->shapepath, filename)) == -1) {
- if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath3(szPath, tiFileAbsDir, layer->map->shapepath, filename)) == -1) {
- if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath(szPath, layer->map->mappath, filename)) == -1) {
-#ifndef IGNORE_MISSING_DATA
- if( layer->debug || layer->map->debug ) {
- msDebug( "Unable to open file %s for layer %s ... fatal error.\n", filename, layer->name );
- }
- return(MS_FAILURE);
-#else
- if( layer->debug || layer->map->debug ) {
- msDebug( "Unable to open shapefile %s for layer %s ... ignoring this missing data.\n", szPath, layer->name );
- }
- continue; /* check again */
-#endif
- }
- }
- }
+ try_open = msTiledSHPTryOpen(tSHP->shpfile, layer, tiFileAbsDir, filename);
+ if( try_open == MS_DONE )
+ continue;
+ else if (try_open == MS_FAILURE )
+ return(MS_FAILURE);
status = msShapefileWhichShapes(tSHP->shpfile, rect, layer->debug);
if(status == MS_DONE) {
@@ -2045,7 +2062,7 @@
int msTiledSHPNextShape(layerObj *layer, shapeObj *shape)
{
int i, status, filter_passed = MS_FALSE;
- char *filename, tilename[MS_MAXPATHLEN], szPath[MS_MAXPATHLEN];
+ char *filename, tilename[MS_MAXPATHLEN];
char **values=NULL;
char tiFileAbsDir[MS_MAXPATHLEN];
@@ -2074,7 +2091,8 @@
if(tSHP->tilelayerindex != -1) { /* does the tileindex reference another layer */
layerObj *tlp;
shapeObj tshape;
-
+ int try_open;
+
tlp = (GET_LAYER(layer->map, tSHP->tilelayerindex));
msInitShape(&tshape);
@@ -2090,23 +2108,11 @@
if(strlen(filename) == 0) continue; /* check again */
- if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath3(szPath, layer->map->mappath, layer->map->shapepath, filename)) == -1) {
- if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath3(szPath, tiFileAbsDir, layer->map->shapepath, filename)) == -1) {
- if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath(szPath, layer->map->mappath, filename)) == -1) {
-#ifndef IGNORE_MISSING_DATA
- if( layer->debug || layer->map->debug ) {
- msDebug( "Unable to open file %s for layer %s ... fatal error.\n", filename, layer->name );
- }
- return(MS_FAILURE);
-#else
- if( layer->debug || layer->map->debug ) {
- msDebug( "Unable to open shapefile %s for layer %s ... ignoring this missing data.\n", szPath, layer->name );
- }
- continue; /* check again */
-#endif
- }
- }
- }
+ try_open = msTiledSHPTryOpen(tSHP->shpfile, layer, tiFileAbsDir, filename);
+ if( try_open == MS_DONE )
+ continue;
+ else if (try_open == MS_FAILURE )
+ return(MS_FAILURE);
status = msShapefileWhichShapes(tSHP->shpfile, tSHP->tileshpfile->statusbounds, layer->debug);
if(status == MS_DONE) {
@@ -2134,32 +2140,22 @@
for(i=(tSHP->tileshpfile->lastshape + 1); i<tSHP->tileshpfile->numshapes; i++) {
if(msGetBit(tSHP->tileshpfile->status,i)) {
+ int try_open;
+
if(!layer->data) /* assume whole filename is in attribute field */
filename = (char*)msDBFReadStringAttribute(tSHP->tileshpfile->hDBF, i, layer->tileitemindex);
else {
sprintf(tilename,"%s/%s", msDBFReadStringAttribute(tSHP->tileshpfile->hDBF, i, layer->tileitemindex) , layer->data);
filename = tilename;
- }
+ }
if(strlen(filename) == 0) continue; /* check again */
- if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath3(szPath, layer->map->mappath, layer->map->shapepath, filename)) == -1) {
- if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath3(szPath, tiFileAbsDir, layer->map->shapepath, filename)) == -1) {
- if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath(szPath, layer->map->mappath, filename)) == -1) {
-#ifndef IGNORE_MISSING_DATA
- if( layer->debug || layer->map->debug ) {
- msDebug( "Unable to open file %s for layer %s ... fatal error.\n", filename, layer->name );
- }
- return(MS_FAILURE);
-#else
- if( layer->debug || layer->map->debug ) {
- msDebug( "Unable to open shapefile %s for layer %s ... ignoring this missing data.\n", szPath, layer->name );
- }
- continue; /* check again */
-#endif
- }
- }
- }
+ try_open = msTiledSHPTryOpen(tSHP->shpfile, layer, tiFileAbsDir, filename);
+ if( try_open == MS_DONE )
+ continue;
+ else if (try_open == MS_FAILURE )
+ return(MS_FAILURE);
status = msShapefileWhichShapes(tSHP->shpfile, tSHP->tileshpfile->statusbounds, layer->debug);
if(status == MS_DONE) {
@@ -2242,9 +2238,9 @@
/* open the shapefile, since a specific tile was request an error should be generated if that tile does not exist */
if(strlen(filename) == 0) return(MS_FAILURE);
- if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath3(szPath, tiFileAbsDir, layer->map->shapepath, filename)) == -1) {
- if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath3(szPath, layer->map->mappath, layer->map->shapepath, filename)) == -1) {
- if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath(szPath, layer->map->mappath, filename)) == -1) {
+ if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath3(szPath, tiFileAbsDir, layer->map->shapepath, filename), MS_TRUE) == -1) {
+ if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath3(szPath, layer->map->mappath, layer->map->shapepath, filename), MS_TRUE) == -1) {
+ if(msShapefileOpen(tSHP->shpfile, "rb", msBuildPath(szPath, layer->map->mappath, filename), MS_TRUE) == -1) {
return(MS_FAILURE);
}
}
@@ -2443,8 +2439,8 @@
layer->layerinfo = shpfile;
- if(msShapefileOpen(shpfile, "rb", msBuildPath3(szPath, layer->map->mappath, layer->map->shapepath, layer->data)) == -1) {
- if(msShapefileOpen(shpfile, "rb", msBuildPath(szPath, layer->map->mappath, layer->data)) == -1) {
+ if(msShapefileOpen(shpfile, "rb", msBuildPath3(szPath, layer->map->mappath, layer->map->shapepath, layer->data), MS_TRUE) == -1) {
+ if(msShapefileOpen(shpfile, "rb", msBuildPath(szPath, layer->map->mappath, layer->data), MS_TRUE) == -1) {
layer->layerinfo = NULL;
free(shpfile);
return MS_FAILURE;
Modified: trunk/mapserver/mapshape.h
===================================================================
--- trunk/mapserver/mapshape.h 2008-11-08 15:22:31 UTC (rev 8014)
+++ trunk/mapserver/mapshape.h 2008-11-11 18:14:14 UTC (rev 8015)
@@ -183,7 +183,7 @@
} msTiledSHPLayerInfo;
/* shapefileObj function prototypes */
-MS_DLL_EXPORT int msShapefileOpen(shapefileObj *shpfile, char *mode, char *filename);
+MS_DLL_EXPORT int msShapefileOpen(shapefileObj *shpfile, char *mode, char *filename, int log_failures);
MS_DLL_EXPORT int msShapefileCreate(shapefileObj *shpfile, char *filename, int type);
MS_DLL_EXPORT void msShapefileClose(shapefileObj *shpfile);
MS_DLL_EXPORT int msShapefileWhichShapes(shapefileObj *shpfile, rectObj rect, int debug);
Modified: trunk/mapserver/shptree.c
===================================================================
--- trunk/mapserver/shptree.c 2008-11-08 15:22:31 UTC (rev 8014)
+++ trunk/mapserver/shptree.c 2008-11-11 18:14:14 UTC (rev 8015)
@@ -1,5 +1,5 @@
/******************************************************************************
- * $Id:$
+ * $Id$
*
* Project: MapServer
* Purpose: Commandline utility to generate .qix shapefile spatial indexes.
@@ -124,7 +124,7 @@
byte_order = MS_NEW_MSB_ORDER;
}
- if(msShapefileOpen(&shapefile, "rb", argv[1]) == -1) {
+ if(msShapefileOpen(&shapefile, "rb", argv[1], MS_TRUE) == -1) {
fprintf(stdout, "Error opening shapefile %s.\n", argv[1]);
exit(0);
}
More information about the mapserver-commits
mailing list