Hi,

so, with raster files just updating the path in ResourceContent is not enough. 
Raster files have an additional configuration document which stores the 
filepath as well.
It seems MapGuide Studio updates the configuration document when a data source 
is saved, in Maestro you can at least manually update the config document. 
There is no API for updating the configuration document.
If anyone else is faced with the same issue - here is  the main part of my 
quick and dirty PHP script:

// FDO Autodesk.Raster?
                                                               $blRaster= 
isFDORaster($contentDomDoc->getElementsByTagName('Provider'));
                                                               if($blRaster)
                                                               {
                                                                              
//ConfigDocument - name
                                                                              
$configDocName = 
getConfigDocName($contentDomDoc->getElementsByTagName('ConfigurationDocument'));
                                                                              
if($configDocName != "")
                                                                              {
                                                                                
              $resDataConfigDoc_byteReader = 
$resourceService->GetResourceData($fsourceID,$configDocName);
                                                                                
              echo "<br><font 
color='red'>...processed..".$configDocName.".</font color><br>";

                                                                                
              //XML processing change location/feature "name" attribute in 
config file


                                                                                
              $xmlConfigDoc = $resDataConfigDoc_byteReader->ToString();
                                                                                
              
//file_put_contents($pathToFile."config_file_".$fsourceName.".xml",$xmlConfigDoc);
                                                                                
              $xmlConfigDocDom = DOMDocument::loadXML($xmlConfigDoc);
                                                                                
              $xmlConfigDocDom->preserveWhiteSpace = false;

                                                                                
              
replacePathInConfigXML($xmlConfigDocDom->getElementsByTagName('Location'), 
$pathOLD, $pathNEW);
                                                                                
              
replacePathInConfigXML($xmlConfigDocDom->getElementsByTagName('Feature'), 
$pathOLD, $pathNEW);


                                                                                
              $pathTempFile = 
$pathToFile."config_file_new_".$fsourceName.".xml";
                                                                                
              file_put_contents($pathTempFile,$xmlConfigDocDom->SaveXML());

                                                                                
              // update repo
                                                                                
              $fileByteContent = new MgByteSource($pathTempFile);
                                                                                
              $fileReader = $fileByteContent->GetReader();
                                                                                
              $resourceService->SetResourceData($fsourceID, $configDocName, 
"Stream", $fileReader);

                                                                              }
                                                               }


Rob


Von: [email protected] 
[mailto:[email protected]] Im Auftrag von Fritz Robert
Gesendet: Dienstag, 11. August 2015 15:40
An: [email protected]
Betreff: [mapguide-users] API - resource id does not refer to a valid feature 
source

Hi,

I changed the data source from local path to alias per PHP script.

For SDF/SHP files this works fine.

For raster data I get a problem:
-- raster files are not displayed
-- Mapguide log file shows an entry where Mapguide complains that file doesn't 
exist (still pointing to the local path)
-- in MapGuide Studio the data source connection (using the alias) is fine 
(Test: ok) but when I open a layer which refers to the data source I get 
"resource id does not refer to a valid feature source"

I can solve the issue manually when I just save the data source connection in 
Studio.

But how can I solve/avoid the issue using PHP API?

Any ideas?

Rob





_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to