In this article you will learn how to make a list of the empty features inside a spatial database using Python in a simple way.
If you need to make a control of the elements contained in the database that you have been developing during the execution of a project, knowing which elements are empty can be very helpful, either to fill or delete them, and as far as I know, there is no way to do this directly in ArcGIS.
How to make a list of empty features in a spatial database (File geodatabase .gdb or Personal geodatabase .mdb)
Step 0: Make a backup of the database (You never know what might happen).
Step 1: Identify the path that represents the database to examine in the operating system explorer.
Step 2: Open ArcMap (A blank mxd file).
Step 3: Open the Python window in the Standard toolbar.
Step 4: Copy in a notepad the following code and replace the text C:\EJEMPLO\EJEMPLO.GDB in line #07 by the path of the database identified in step 1. On the other hand replace in line #05 C:\EJEMPLO by the path where the list will be saved in .txt format. If you want to modify the name of the output file, you can change the word “List” in line #06 by the name of your choice (without removing the quotes).
IMPORTANT NOTE: This script has always given me problems using very long paths so I recommend working in a folder in the root of a storage unit (a).
Step 5: Copy the modified code into the Python window and press the Enter key twice.
Step 6: Once the .txt file is generated (a), open it, select all with CTR+E (b) and copy the text with CTR+C (c).
Step 7: Open an Excel file, in the text import section select as separator the comma character (,) as shown in the following image.
Step 8: Apply a filter in the resulting columns in Excel, the elements that remain in the last column with a zero (0) are the elements that are empty in the database.
NOTES:
- If inside the database there are feature datasets, you must move to the right column the listed elements that are outside the dataset, for example the tables and features that do not belong to a dataset (See next image).
This way you will have a list of the empty elements stored in the GDB, once you have done all your verifications you may need to massively delete several empty elements, for this reason I invite you to go through my article, Delete empty features in the database.
I hope you enjoyed this article, soon I will upload a video explaining the procedure that you can consult in this blog. Save my blog among your favorite links, I will be uploading many more tricks of this style, remember that you can send me your concerns on the contact page or leave your comment, I will be attentive to respond.






