<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
You cannot use the SessionID directly to access resources.<br>
It must be used to build an URI like this:<br>
<br>
"Session:<sessionid>//Map1.Map"<br>
where "<sessionid>" is the value you get from GetSessionId().<br>
<br>
This is mentioned on page 19 in the manual.<br>
<pre class="moz-signature" cols="72">
Regards, Kenneth, GEOGRAF A/S
</pre>
<br>
<br>
dorra2007 skrev:
<blockquote cite="mid:13404034.post@talk.nabble.com" type="cite">
<pre wrap="">I used this function to get the session ID :
document.myform.session.value=parent.parent.mapFrame.GetSessionId();
But I have this error:
The session ID is invalid because the session separator character was not
found
Have you an idea about the "session separator"?
Regards.
Kenneth, GEOGRAF A/S wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I assume that you do know that the code below is in Java/JSP and not
javascript.
The resourceService is created from the site, with CreateService.
I just tried to find the example in the HTML version of the manual, with
no luck, try the PDF version instead:
<a class="moz-txt-link-freetext" href="http://mapguide.osgeo.org/files/mapguide/docs/MgOpenSourceDevGuide.pdf">http://mapguide.osgeo.org/files/mapguide/docs/MgOpenSourceDevGuide.pdf</a>
Page 36:
MgInitializeWebTier ($webconfigFilePath);
$userInfo = new MgUserInformation($mgSessionId);
$siteConnection = new MgSiteConnection();
$siteConnection->Open($userInfo);
$resourceService =
$siteConnection->CreateService(MgServiceType::ResourceService);
$map = new MgMap();
$map->Open($resourceService, $mgMapName);
$layers = $map->GetLayers();
$roadLayer = $layers->GetItem('Roads');
$roadLabel = $roadLayer->GetLegendLabel();
if ($roadLabel == 'Roads')
$newLabel = 'Streets';
else
$newLabel = 'Roads';
$roadLayer->SetLegendLabel($newLabel);
// You must save the updated map or the
// changes will not be applied
// Also be sure to refresh the map on page load.
$map->Save($resourceService);
On-top-of-my-head translation to jsp:
MgInitializeWebTier (webconfigFilePath);
MgUserInformation userInfo = new MgUserInformation(mgSessionId);
MgSiteConnection siteConnection = new MgSiteConnection();
siteConnection.Open(userInfo);
MgResourceService resourceService =
siteConnection.CreateService(MgServiceType::ResourceService);
MgMap map = new MgMap();
map.Open(resourceService, mgMapName);
MgLayerCollection layers = map.GetLayers();
MgLayer roadLayer = layers.GetItem('Roads');
roadLabel = roadLayer.GetLegendLabel();
String newLabel;
if (roadLabel == "Roads")
newLabel = "Streets";
else
newLabel = "Roads";
roadLayer.SetLegendLabel(newLabel);
// You must save the updated map or the
// changes will not be applied
// Also be sure to refresh the map on page load.
map.Save(resourceService);
Regards, Kenneth, GEOGRAF A/S
dorra2007 skrev:
</pre>
<blockquote type="cite">
<pre wrap="">Hi all;
I have read several posts about the setvisible function, but I have still
errors in my code (I am using javascript/jsp).
Can someone give me a comprhensive code in javascript, wich show how i
can
use the SetVisible method?
PS: My featuresource is a postgis database.
here is the code i used:
map=new MgMap();
map.open(resourceService,map_name);
layer=map.GetLayers().GetItem(layer_name);
layer.SetVisible(true);
map.save(resourceService);
the resourceService is not defined. In fact, what does it refers to?And
how
can I define it?Should I create a map object?..
Many question, can someone help me?
Thank you in advance.
</pre>
</blockquote>
<pre wrap="">_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
</body>
</html>