AnsweredAssumed Answered

Change Feature Layer Data Source URL

Question asked by mjk5000 on Apr 13, 2018
Latest reply on Apr 16, 2018 by mjk5000

I have about 14 feature layers, and i want to be able to switch our the Data Source URL from my code if it does not match the environment I am in.  i would even settle for being able to just drop and re-add the layer if it has a different datasource then the one I want to load.  Unfortunately, I cant seem to find how to Get/Set this value for a layer?  I attached a screen shot of what I want to get/set

 

FeatureLayer LoadLayer = GetBasicFeaturLayer(entry.Key) as FeatureLayer;
                       
if (LoadLayer == null) //Not already on the Map, load it
{
   Uri uri = new Uri(NEWurl + entry.Value);
   LoadLayer = LayerFactory.Instance.CreateFeatureLayer(uri, MapView.Active.Map, position);
}
else
{
   //HERE
   //HERE
   //I need to check if the layer that already exists on the map has a different datasource
   //IF CURRENT URL != NEWurl
   //If Not equal, then remove existing layer or some how redo the data source  

   //Here is the remove logic, but I would rather rename, but I first need to find out if datasouce is different
   RemoveBasicFeaturLayer(entry.Key);
   Uri uri = new Uri(NEWurl + entry.Value);
   LoadLayer = LayerFactory.Instance.CreateFeatureLayer(uri, MapView.Active.Map, position);
}

Attachments

Outcomes