HOW TO
Instructions provided describe how to find features with null geometries in ArcMap. The table window allows features to be created that have no geometry; that is, they have a null value for the Shape field.
Note: For more information on creating a UIControl see the ArcGIS Desktop Help topic Creating custom commands with VBA and UI Controls.
Dim pMXd As IMxDocument Set pMXd = ThisDocument Dim pMap As IMap Set pMap = pMXd.FocusMap ' Make sure there is a selected layer in map If pMXd.SelectedItem Is Nothing Then MsgBox "Must have a selected item in map" Exit Sub End If If Not TypeOf pMXd.SelectedItem Is IFeatureLayer Then MsgBox "The selected item must be a layer" Exit Sub End If Dim pDispTab As IDisplayTable Set pDispTab = pMXd.SelectedItem ' create an empty selectionset and open a feature cursor Dim pFCursor As IFeatureCursor Dim pSelSet As ISelectionSet Dim pTable As ITable Dim pFeatCls As IFeatureClass Dim pFeat As IFeature Set pTable = pDispTab.DisplayTable Set pSelSet = pTable.Select(Nothing, esriSelectionTypeHybrid, _ esriSelectionOptionEmpty, Nothing) Set pFeatCls = pTable Set pFCursor = pFeatCls.Search(Nothing, False) ' add all features that are not null to the selection set Set pFeat = pFCursor.NextFeature Do While (Not pFeat Is Nothing) If Not pFeat.Shape Is Nothing Then If pFeat.Shape.IsEmpty Then If pFeat.HasOID Then pSelSet.Add pFeat.OID End If End If End If Set pFeat = pFCursor.NextFeature Loop ' apply the selectionset to the layer Dim pActiveView As IActiveView Dim pFeatSel As IFeatureSelection Set pActiveView = pMap Set pFeatSel = pDispTab pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing Set pFeatSel.SelectionSet = pSelSet pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing
Get help from ArcGIS experts
Download the Esri Support App