[fusion-commits] r2679 - trunk/widgets/Redline/classes

svn_fusion at osgeo.org svn_fusion at osgeo.org
Tue Mar 26 03:58:48 PDT 2013

Author: jng
Date: 2013-03-26 03:58:48 -0700 (Tue, 26 Mar 2013)
New Revision: 2679

#554: Workaround an issue with round-tripped SHP markup files on Linux. Creating a SHP Feature Source creates a blank prj file, even though we are passing in the WKT from the MgMap. On Windows, re-uploading this zip file (with blank prj file) is handled gracefully by MapGuide (features are still rendered). On Linux this is not the case, so we workaround the problem by plugging the MgMap's WKT into the physical prj file before we zip it up for download, ensuring a non-empty prj file is packaged up.

Modified: trunk/widgets/Redline/classes/markupmanager.php
--- trunk/widgets/Redline/classes/markupmanager.php	2013-03-26 10:47:57 UTC (rev 2678)
+++ trunk/widgets/Redline/classes/markupmanager.php	2013-03-26 10:58:48 UTC (rev 2679)
@@ -579,6 +579,26 @@
             $zip = new ZipArchive();
             $zip->open($zipPath, ZIPARCHIVE::CREATE);
             foreach ($tmpFiles as $dataName => $filePath) {
+                $dataNorm = strtolower($dataName);
+                //HACK: There must be some defect in MgFeatureService::CreateFeatureSource() for SHP
+                //files or the FDO provider, because even if we plug in a coord sys WKT when we create
+                //it, we get a blank prj file (both Windows/Linux). Re-uploading this same zip file back into 
+                //the widget causes problems in Linux (markup features not rendered) because of the blank prj.
+                //
+                //So that's the problem. Here's the workaround: If we find a blank prj file as we're assembling
+                //the zip file for download, pump our current Map's WKT into the prj file before packaging it up
+                //
+                //That's what we were already doing when we called MgFeatureService::CreateFeatureSource(), but it
+                //or the provider didn't like it.
+                if ( substr( $dataNorm, strlen( $dataNorm ) - strlen( "prj" ) ) == "prj" ) {
+                    $content = file_get_contents($filePath);
+                    if (strlen($content) == 0) {
+                        $map = new MgMap();
+                        $map->Open($resourceService, $this->args['MAPNAME']);
+                        $content = $map->GetMapSRS();
+                        file_put_contents($filePath, $content);
+                    }
+                }
                 $zip->addFile($filePath, $dataName);

More information about the fusion-commits mailing list