IPropertySet connProps = new PropertySet(); connProps.SetProperty("Url", "http://www3.multco.us/ArcGIS/Services"); AGSServerConnectionFactory agsSCFac = new AGSServerConnectionFactory(); IAGSServerConnection agsSConn = agsSCFac.Open(connProps, 0); IAGSEnumServerObjectName pEnum = agsSConn.ServerObjectNames; IAGSServerObjectName pSOName = pEnum.Next(); while (pSOName != null) { Console.WriteLine(pSOName.Name); if (pSOName.Name.Equals("BaseMap/Taxlots")) break; pSOName = pEnum.Next(); } if (pSOName != null) { IName pName = pSOName as IName; IMapServer pMapServer = pName.Open(); IMapServerInfo pMapServerInfo = pMapServer.GetServerInfo(pMapServer.DefaultMapName); IMapDescription pMD = pMapServerInfo.DefaultMapDescription; IPoint pnt = new Point(); pnt.SpatialReference = pMD.SpatialReference; pnt.PutCoords(7682600.809, 681343.674); ISpatialFilter pSpatFilter = new SpatialFilter(); pSpatFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; pSpatFilter.Geometry = pnt; pSpatFilter.WhereClause = "PROPID = 'R311157'"; IRecordSet records = pMapServer.QueryFeatureData(pMD.Name, 0, pSpatFilter); Console.WriteLine("Found " + records.Table.RowCount(null) + " records"); ICursor pCur = records.get_Cursor(true); IFeature pFeat = pCur.NextRow() as IFeature; if (pFeat != null) { Console.WriteLine("SUCCESS! Found Property: " + pFeat.Value[pFeat.Fields.FindField("PROPID")]); } }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.