[mapguide-users] Adding layers permanent
peter56
ibb.scigalla at arcor.de
Tue Oct 16 08:07:02 EDT 2007
Dear all,
based on the example in the Developer's Guide, I created a new Layer to the
map at runtime:
// Neuen MG-Layer definieren
$featureClass = 'Library://projekt/'
. 'mysql.FeatureSource';
$featureName = 'Fdotest:agmg_wasleitung';
$geometry = 'graphik';
$layerDefinition = $factory->
CreateLayerDefinition($featureClass, $featureName,
$geometry, $lineScaleRange);
//---------------------------------------------------//
// ...
// in die Karte einfügen
$newLayer = add_layer_definition_to_map($layerDefinition, "alle",
"alle", $sessionId, $resourceService, $map);
add_layer_to_group($newLayer, "Analysis", "Analysis", $map);
// --------------------------------------------------//
// jetzt sichtbar machen
$layerCollection = $map->GetLayers();
if ($layerCollection->Contains("alle"))
{
$squareFootageLayer =$layerCollection->GetItem("alle");
$squareFootageLayer->SetVisible(TRUE);
}
//---------------------------------------------------//
// im session repository speichern
$sessionIdName = "Session:$sessionId//$mapName.Map";
$sessionResourceID = new MgResourceIdentifier($sessionIdName);
$sessionResourceID->Validate();
$map->Save($resourceService, $sessionResourceID);
It works fine. (Very thanks to all writers of the Developer's Guide!) Now I
have only one problem:
I tried to make the changes permanent using the code from Developer's Guide,
but nothing happens:
// jetzt nach Handbuch Kapitel 4, Seite 66 den Layer in die Datenbank
schreiben
$byteSource = new MgByteSource($layerDefinition,
strlen($layerDefinition));
$byteSource->SetMimeType(MgMimeType::Xml);
$resourceId = new
MgResourceIdentifier("Library://LayerName.LayerDefinition");
$resourceService->SetResource($resourceId, $byteSource->GetReader(),
null);
What am I doing wrong?
Regards - Peter
--
View this message in context: http://www.nabble.com/Adding-layers-permanent-tf4633765s16610.html#a13231933
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list