[mapguide-users] Re: Is it Possible to set Feature Label for
a layer dynamically
SriRam007
binod_tripathy at yahoo.co.in
Tue Feb 23 06:34:02 EST 2010
Utility.InitializeWebTier(Request);
string myLayerName = "Districts";//layerSelect.Value.ToString()
//args = Utility.GetRequestParameters(Request);
//Query Qry = new Query(args);
MgUserInformation userInfo = new
MgUserInformation(Session["ID"].ToString());
MgSiteConnection siteConnection = new MgSiteConnection();
siteConnection.Open(userInfo);
MgResourceService resourceService =
siteConnection.CreateService(MgServiceType.ResourceService) as
MgResourceService;
MgFeatureService featureService =
siteConnection.CreateService(MgServiceType.FeatureService) as
MgFeatureService;
MgMap map = new MgMap();
map.Open(resourceService, "Sheboygan");//For "Sheboygan" Replace
Utility.GetParameter(this.args, "MAPNAME")
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);//layerResId, reader,
null);
layer.SetLayerDefinition(layerDefResId, resourceService);
map.Save(resourceService);
Please tell where i went wrong...
thanks waiting for ur reply...
--
View this message in context: http://n2.nabble.com/Is-it-Possible-to-set-Feature-Label-for-a-layer-dynamically-tp4590194p4618330.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list