[mapguide-users] Runtime layer in fusion

GordonL gordon.luckett at arrowgeomatics.com
Fri Feb 6 12:24:36 PST 2015


Fusion is just a representation of what is happening on the server.

You have to add runtime layers using the MapGuide Server API and not Fusion.

http://web.archive.org/web/20130606044358/http://mapguide.osgeo.org/files/mapguide/docs/2.0/index.htm

Something like this:
/
$map->Open($mapName);

$dataResId = new
MgResourceIdentifier("Library://Samples/Sheboygan/Layers/Buildings.LayerDefinition");
				
$dataSourceReader = $resourceService->GetResourceContent($dataResId); 

$dataXml = $dataSourceReader->ToString(); 
$xmlDoc = DOMDocument::loadXML($dataXml); 
$xmlDoc->preserveWhiteSpace = true;
$FeatSrcDefinition = $xmlDoc->saveXML();

$byteSource = new
MgByteSource($FeatSrcDefinition,strlen($FeatSrcDefinition));
$byteSource->SetMimeType("text/xml"); 

$tempLayerResId = new MgResourceIdentifier("Session:" . $mgSessionId .
"//myBuildings.LayerDefinition");

$resourceService->SetResource($tempLayerResId,$byteSource->GetReader(),null); 
   
$newLayer = new MgLayer($tempLayerResId,$resourceService);
$newLayer->SetName("Buildings");
$newLayer->SetLegendLabel("Buildings I Have Added");
$newLayer->SetDisplayInLegend(true);
$newLayer->SetSelectable(true);
$newLayer->ForceRefresh();

$map->Save($resourceService);
/



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Runtime-layer-in-fusion-tp5185674p5186063.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list