1

I want to add all the layers in my WMTS service to ArcMap using ArcObjects, but I am able to get only one layer.

Does anyone have a solution for this?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Aug 5, 2016 at 9:08
2
  • What is the service URL that you are using to try and access this WMTS? Commented Aug 5, 2016 at 10:36
  • @PolyGeo I want to add it to my ArcMap through ArcObjetcs. Thanks for your reply. I have solved the issue at the end of the day. Commented Aug 5, 2016 at 12:50

2 Answers 2

2

I got solution for adding all layers at ones, as well as a particular layer to ArcMap:

public static void GetWMTSLayer(string url = "http://IP-Address:Port/Service/rest/services/OSM/MapServer/WMTS")
{
 IProperySet propSet= new PropertySetClass();
 propSet.SetProperty("URL",url);
 IWMTSConnectionFactory wmtsConnFactory=new WMTSConnectionFactoryClass();
 IWMTSConnection wmtsConnection=wmtsConnFactory.Open(propSet,0,null);
 IWMTSServiceDescription wmtsServceDescriotion=wmtsConnection as IWMTSServiceDescription ;
 for(int i=0;i< wmtsServceDescriotion.LayerDescriptionCount;i++)
 {
 IWMTSLayerDescription layerDescription=wmtsServceDescriotion.getLayerDescription(i);
 IWMTSLayer wmtsLayer=new WMTSLayerClass();
 IPropertySet propSet_1=new PropertySetClass();
 propSet_1.SetProperty("URL", url);
 propSet_1.SetProperty("LayerName",layerDescription.Identifier);
 WMTSConnectionName connectonName= new WMTSConnectionNameClass();
 connectionName.ConnectionProperties=propSet_1;
 wmtsLayer.Connect((IName)connectionName);
 addData(wmtslayer);
 }
}
public static void addData(IWMTSLayer wmtslayer)
{
 IMap pMap=(IMap)((IMxDocument)ArcMap.Application.Document).FocusMap);
 ILayer pLayer=new FeatureLayer();
 pLayer=(ILayer)wmtslayer;
 pMap.AddLayer(pLayer);
}
Kirk Kuykendall
25.9k9 gold badges68 silver badges155 bronze badges
answered Aug 5, 2016 at 12:45
0

If you click on the Toggle Contents Panel button you will see a new space at the bottom of the Catalog view. From there you can choose several layers

answered Aug 5, 2016 at 11:08
1
  • Actually I have added them manually I want to add it through ArcObjects. Thanks for your reply @Daniel. I have solved the issue. Commented Aug 5, 2016 at 12:47

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.