I'm using ArcObjects .NET to load WMS 1.3.0 service layers from our ArcGIS server into ArcMap 10.2.2. The process of connecting to the server and adding layers works fine, however none of the layers will draw - I simply have a blank canvas. I have tried two methods to add WMS layers to the map:
- Using 'Add Data' button > GIS Server > Add WMS Server
With ArcObjects .NET (see code below)
'setup connection properties
Dim pMap As IMap = pMxDoc.ActiveView.FocusMap
Dim pWMSLayer As IWMSGroupLayer = New WMSMapLayer
Dim pConnectionName As IWMSConnectionName = New WMSConnectionNameClass
Dim pPropSet As IPropertySet = New PropertySetClass
pPropSet.SetProperty("URL", txtURL.Text)
pConnectionName.ConnectionProperties = pPropSet
Dim pDataLayer As IDataLayer = CType(pWMSLayer, IDataLayer)
'connect to server
Try
pDataLayer.Connect(CType(pConnectionName, IName))
Catch ex As Exception
MsgBox("Error connecting to server: " & ex.Message)
End Try
'get top level group layer from server
Dim pServiceDesc As IWMSServiceDescription = pWMSLayer.WMSServiceDescription
Dim pLayerDesc As IWMSLayerDescription = pServiceDesc.LayerDescription(0)
_WMSGroupLayer = pWMSLayer.CreateWMSGroupLayers(pLayerDesc)
'add layers to map
For i As Integer = 0 To _WMSGroupLayer.Count - 1
Dim pLayer As ILayer = _WMSGroupLayer.Layer(i)
pMap.AddLayer(pLayer)
Next
Both methods add the layers to the map and they are visible in the table of contents with no errors or warnings. I can view layer source (seems correct), extent (also seems correct), some symbology properties, and I can also zoom to the extent of the layer (which changes map zoom), however nothing at all is visible on the map canvas. Scale range isn't the issue as I've tried zooming in far beyond the specified range.
I've come across this page relating to WMS layers not drawing in ArcMap 9, but it isn't offering me any working solutions for 10.2:
I have tried changing coordinate system of data frame (and layers), no to effect. They are all in WGS1984 which is supported by the WMS service.
At this point I don't know what else I can try besides contacting ESRI for assistance. Does anyone have any ideas or similar issues with WMS layers? Thanks.
EDIT: also looks like this person had the same problem but no solution was posted.
Answer
I figured out a few reasons why my WMS layers were not drawing:
- I was adding individual WMS layers to the map - layers will not draw unless the full parent WMS group layer service is added - individual layers can then be turned on/off as desired.
- Folder permissions on our ArcGIS server were set incorrectly for WMS service. I'm not sure why it was letting me connect and add layers but preventing them from drawing. But it's fixed now anyway.
No comments:
Post a Comment