Select to view content in your preferred language

Query features in a WMSLayer?  code sample?

996
2
01-18-2012 06:50 PM
JerryGarcia
Frequent Contributor
Can someone provide a code sample which queries features in a WMS layer in ArcMap?

All I need to know is if the layer contains any map features.

Thanks!
0 Kudos
2 Replies
JerryGarcia
Frequent Contributor
I'm trying to remove layers which have zero map features.  Unfortunately, the returned array from IIdentify::Identify is always null.

                IWMSGroupLayer wmsGroupLayer = (IWMSGroupLayer)wmsMapLayer.Layer[0];
                for (int layerCount = 0; layerCount < wmsGroupLayer.Count; layerCount++)
                {
                    ILayer lyr = (ILayer)wmsGroupLayer.Layer[layerCount];

                    ESRI.ArcGIS.Geodatabase.IGeoDataset geoDS = (ESRI.ArcGIS.Geodatabase.IGeoDataset) lyr;
                
                    IIdentify id = (IIdentify) lyr;
                    IArray idArray = (IArray)id.Identify(geoDS.Extent);
                    if (idArray == null)
                    {
                        Log(lyr.Name + "; Feat Count: null (zero)");
                        //wmsGroupLayer.Delete(lyr);
                        //layerCount -= 1;
                    }
                    else
                    {
                        Log(lyr.Name + "; Feat Count: " + idArray.Count);
                    }
                }
0 Kudos
JerryGarcia
Frequent Contributor
I guess this is a bug: IIdentify::Identify is always null.

Can anyone provide a code sample which shows differently?
0 Kudos