[mapguide-users] Re: Is it Possible to set Feature Label for
a layer dynamically
SriRam007
binod_tripathy at yahoo.co.in
Tue Feb 23 09:34:20 EST 2010
Thank u very much to both of u
Kenneth Skovhede, GEOGRAF A/S And zspitzer
Really u both helped me a lot. Specially Kenneth Skovhede
And here is the Full and Final Code
Everyone can use it
Utility.InitializeWebTier(Request);
string myLayerName = ddlLayer.SelectedItem.Text.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() + "//" +
myLayerName + ".LayerDefinition");
MgByteReader reader = new MgByteReader(layerDefinition, "text/xml");
resourceService.SetResource(layerResId, new
MgByteReader(layerDefinition, "text/xml"), null);
layer.SetLayerDefinition(layerResId, resourceService);
map.Save(resourceService);
But I want to modify that MapDefinition
and I want the changes should be done permanently not only until the end of
the session.
Ok any way At first let me go through some sites and this forum about
MapDefinition. If still not getting anything I will ask u again.
thank u very much...
Jai Sree Ram
--
View this message in context: http://n2.nabble.com/Is-it-Possible-to-set-Feature-Label-for-a-layer-dynamically-tp4590194p4619133.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list