Dim pSF As ISpatialFilter pSF.Geometry = pFeat.Shape pSF.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects
Solved! Go to Solution.
While Not pFeat Is Nothing comReleaser.ManageLifetime(pFeat) nNumAdjacent = 0 nCurRecNo = nCurRecNo + 1 'MsgBox(pFeat.OID) With pSpFltr .Geometry = pFeat.Shape 'EDGAR pPolygon .SpatialRel = esriSpatialRelEnum.esriSpatialRelTouches .OutputSpatialReference("Shape") = pSpRef 'm_pfc.Fields.Field(nShpFieldNDX).GeometryDef.SpatialReference .SubFields = "Shape" .GeometryField = "Shape" End With Dim intFeatCount As Integer = m_pfc.FeatureCount(pSpFltr) 'MsgBox(intFeatCount) pFeat.Value(lFld) = intFeatCount pFeatCur.UpdateFeature(pFeat) 'pFeat.Store() My.ArcMap.Application.StatusBar.Message(0) = nCurRecNo.ToString & "/" & n.ToString & " records complete." Me.ProgressBar1.Value = nCurRecNo ' GC.Collect() GC.WaitForPendingFinalizers() Marshal.ReleaseComObject(pFeat) 'comReleaser.ReleaseCOMObject(pFeat) pFeat = pFeatCur.NextFeature Application.DoEvents() End While
Dim gp As IGeoProcessor = New GeoProcessor Dim strParam As IVariantArray = New VarArray gp.OverwriteOutput = True gp.SetEnvironmentValue("Workspace", m_gdbPath) 'set the parameters for the select layer by location tool strParam.Add(pNewFLayer.Name) strParam.Add("SHARE_A_LINE_SEGMENT_WITH") 'execute the select layer by location tool Dim results As IGeoProcessorResult = CType(gp.Execute("SelectLayerByLocation_Management",strParam, Nothing), IGeoProcessorResult) If results.Status <> ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded Then MsgBox("Failed to execute select by layer!", MsgBoxStyle.Information, "frmSelectLayer_btnRun_click") results = Nothing gp = Nothing Exit Sub End If gp = Nothing
Dim gp As IGeoProcessor = New GeoProcessor Dim strParam As IVariantArray = New VarArray gp.OverwriteOutput = True strParam.Add(m_pFLay.Name) strParam.Add("SHARE_A_LINE_SEGMENT_WITH") 'execute the select layer by location tool Dim results As IGeoProcessorResult = CType(gp.Execute("SelectLayerByLocation_Management", strParam, Nothing), IGeoProcessorResult) If results.Status <> ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded Then MsgBox("Failed to execute select by layer!", MsgBoxStyle.Information, "frmSelectLayer_btnRun_click") results = Nothing gp = Nothing Exit Sub End If
Dim pQF As IQueryFilter = New QueryFilter Dim pMxDoc As IMxDocument = My.ArcMap.Document Dim pActView As IActiveView = pMxDoc.ActiveView Dim gp As IGeoProcessor = New GeoProcessor Dim strParam As IVariantArray = New VarArray gp.OverwriteOutput = True strParam.Add(m_pFLay.Name) strParam.Add("SHARE_A_LINE_SEGMENT_WITH") pFeat = pFeatCur.NextFeature While Not pFeat Is Nothing '----------------test changes-------------------------------- pQF.WhereClause = "OBJECTID = " & pFeat.OID Dim pSel As ISelectionSet = m_pFLay.FeatureClass.Select(pQF, esriSelectionType.esriSelectionTypeSnapshot, esriSelectionOption.esriSelectionOptionNormal, pWorkspace) pMxDoc.CurrentContentsView.Refresh(Nothing) pActView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing) 'execute the select layer by location tool Dim results As IGeoProcessorResult = CType(gp.Execute("SelectLayerByLocation_Management", strParam, Nothing), IGeoProcessorResult) If results.Status <> ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded Then MsgBox("Failed to execute select by layer!", MsgBoxStyle.Information, "frmSelectLayer_btnRun_click") results = Nothing gp = Nothing Exit Sub End If end while '-----------------end test changes----------------------------------------------
What results are you getting? Error message?
pQF.WhereClause = "OBJECTID = " & pFeat.OID Dim pSel As ISelectionSet = m_pFLay.FeatureClass.Select(pQF, esriSelectionType.esriSelectionTypeIDSet, esriSelectionOption.esriSelectionOptionNormal, pWorkspace) strParam.Add(m_pFLay.Name) strParam.Add("NEW_SELECTION") strParam.Add(pQF.WhereClause) ''execute the select layer by attribute tool Dim results2 As IGeoProcessorResult = CType(gp.Execute("SelectLayerByAttribute_Management", strParam, Nothing), IGeoProcessorResult) If results2.Status <> ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded Then MsgBox("Failed to execute select by attribute!", MsgBoxStyle.Information, "frmSelectLayer_btnRun_click") results2 = Nothing gp = Nothing Exit Sub End If pActView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing) pMxDoc.CurrentContentsView.Refresh(Nothing) pMxDoc.ActiveView.Refresh() 'now execute the select layer by location tool strParam.RemoveAll() gp.OverwriteOutput = True strParam.Add(m_pFLay.Name) strParam.Add("SHARE_A_LINE_SEGMENT_WITH") strParam.Add("") strParam.Add("") strParam.Add("NEW_SELECTION") ''execute the select layer by location tool Dim results As IGeoProcessorResult = CType(gp.Execute("SelectLayerByLocation_Management", strParam, Nothing), IGeoProcessorResult) If results.Status <> ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded Then MsgBox("Failed to execute select by layer!", MsgBoxStyle.Information, "frmSelectLayer_btnRun_click") results = Nothing gp = Nothing Exit Sub End If strParam.RemoveAll() strParam.Add(m_pFLay.Name) Dim results3 As IGeoProcessorResult = CType(gp.Execute("GetCount_Management", strParam, Nothing), IGeoProcessorResult) 'MsgBox(results3) strParam.RemoveAll()