[mapguide-users] Re: How to change Existing Max scale for a layer

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Mon Mar 1 03:03:28 EST 2010


You are issuing MgMap.Save, but passing the layer id.
You must pass the mapname when using that method.

Regards, Kenneth Skovhede, GEOGRAF A/S

On 01-03-2010 08:07, SriRam007 wrote:
> Hi,
>
> As u told to create a new MgLayer instance, and copy all the properties from
> the original MgLayer to the new MgLayer. Then remove the original MgLayer
> and insert the new one in the same position as the previous one.
>
> I m doing like this.
> Please tell me is there any wrong Showing error "An exception occurred in
> the XML parser."
>
>              String uniqueName = this.MakeUniqueLayerName(map, myLayerName);
>              MgResourceIdentifier layerResId = new
> MgResourceIdentifier("Session:" + Session["ID"].ToString() + "//" +
> uniqueName + ".LayerDefinition");
>              MgByteReader reader = new MgByteReader(layerDefinition,
> "text/xml");
>              resourceService.SetResource(layerResId, new
> MgByteReader(layerDefinition, "text/xml"), null);
>
>              MgLayer newLayer = new MgLayer(layerResId, resourceService);
>              newLayer.SetName(uniqueName);
>              newLayer.SetLegendLabel(layer.GetLegendLabel());
>              newLayer.SetDisplayInLegend(layer.GetDisplayInLegend());
>              newLayer.SetVisible(true);
>              newLayer.SetSelectable(layer.GetSelectable());
>              layers.Insert(layers.IndexOf(layer), newLayer);
>              newLayer.ForceRefresh();
>              map.Save(resourceService, layerResId); //////Error Comming "An
> exception occurred in the XML parser."
>
>
> Here i am just replacing the new layer at the preveous layer's position
>
>
> thanks
>
>
>    


More information about the mapguide-users mailing list