[mapserver-commits] r10376 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Sun Jul 18 11:05:26 EDT 2010


Author: warmerdam
Date: 2010-07-18 15:05:26 +0000 (Sun, 18 Jul 2010)
New Revision: 10376

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapobject.c
Log:
Allow map relative PROJ_LIB specification (#3094)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2010-07-17 14:49:24 UTC (rev 10375)
+++ trunk/mapserver/HISTORY.TXT	2010-07-18 15:05:26 UTC (rev 10376)
@@ -14,6 +14,10 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Allow map relative specification in the PROJ_LIB config item (#3094)
+
+- Try to report reprojection errors in SLD Filter evaluation (#3495)
+
 - Disabled some insecure (and potentially exploitable) mapserv command-line
   debug arguments (#3485). The --enable-cgi-cl-debug-args configure switch
   can be used to re-enable them for devs who really cannot get away without

Modified: trunk/mapserver/mapobject.c
===================================================================
--- trunk/mapserver/mapobject.c	2010-07-17 14:49:24 UTC (rev 10375)
+++ trunk/mapserver/mapobject.c	2010-07-18 15:05:26 UTC (rev 10376)
@@ -29,6 +29,8 @@
  ****************************************************************************/
 
 #include "mapserver.h"
+#include <sys/types.h>
+#include <sys/stat.h>
 
 #ifdef USE_GDAL
 #  include "gdal.h"
@@ -158,8 +160,32 @@
     /* We have special "early" handling of this so that it will be */
     /* in effect when the projection blocks are parsed and pj_init is called. */
     if( strcasecmp(key,"PROJ_LIB") == 0 )
-        msSetPROJ_LIB( value );
+    {
+        /* check if this is map relative */
+        if( !map->mappath 
+            || value[0] == '/'
+            || value[0] == '\\'
+            || (value[0] != '\0' && value[1] == ':') )
+        {
+            msSetPROJ_LIB( value );
+        }
+        else
+        {
+            struct stat stat_buf;
+            char *extended_path = (char*) malloc(strlen(map->mappath)
+                                                 + strlen(value) + 10);
+            sprintf( extended_path, "%s/%s", map->mappath, value );
 
+            if( stat( extended_path, &stat_buf ) == 0 
+                && S_ISDIR(stat_buf.st_mode) )
+                msSetPROJ_LIB( extended_path );
+            else
+                msSetPROJ_LIB( value );
+            
+            free( extended_path );
+        }
+    }
+
     /* Same for MS_ERRORFILE, we want it to kick in as early as possible
      * to catch parsing errors */
     if( strcasecmp(key,"MS_ERRORFILE") == 0 )



More information about the mapserver-commits mailing list