[mapguide-users] Re: Is it Possible to set Feature Label for
a layer dynamically
Kenneth Skovhede, GEOGRAF A/S
ks at geograf.dk
Tue Feb 23 06:50:48 EST 2010
The second to last line, you set the layer to point at the original, not
the copy.
Change the line to:
layer.SetLayerDefinition(layerResId, resourceService);
Regards, Kenneth Skovhede, GEOGRAF A/S
On 23-02-2010 12:39, SriRam007 wrote:
> Utility.InitializeWebTier(Request);
> string myLayerName = "Districts";
>
> MgUserInformation userInfo = new
> MgUserInformation(Session["ID"].ToString());
> MgSiteConnection siteConnection = new MgSiteConnection();
> siteConnection.Open(userInfo);
> MgResourceService resourceService =
> siteConnection.CreateService(MgServiceType.ResourceService) as
> MgResourceService;
> MgMap map = new MgMap();
> map.Open(resourceService, "Sheboygan");
> MgLayerCollection layers = map.GetLayers();
> ArrayList layerNames = new ArrayList();
> MgLayer layer = Utility.GetLayerByName(map, myLayerName);
> string s = layer.GetLayerDefinition().ToString();
>
> MgResourceIdentifier resId = new
> MgResourceIdentifier(layer.GetFeatureSourceId());
> MgResourceIdentifier layerDefResId = layer.GetLayerDefinition();
> MgByteReader byteReader =
> resourceService.GetResourceContent(layerDefResId);
>
> string layerDefinition = ReplaceXMLValue(byteReader);
>
> MgResourceIdentifier layerResId = new
> MgResourceIdentifier("Session:" + Session["ID"].ToString() +
> "//Districts.LayerDefinition");
> MgByteReader reader = new MgByteReader(layerDefinition, "text/xml");
> resourceService.SetResource(layerResId, new
> MgByteReader(layerDefinition, "text/xml"), null);
> layer.SetLayerDefinition(layerDefResId, resourceService);
> map.Save(resourceService);
>
> Please tell where i went wrong...
>
>
> thanks
> waiting for ur reply...
>
More information about the mapguide-users
mailing list