Hi folks,
I'm working with ArcGIS Pro v 2.8.2 and have encountered a labelling issue that I'm hoping someone out here can help me troubleshoot.
I created a Python script which extracts Survey123 file geodatabase data and stores them in subfolders, per the survey submitted, with separate .xls of the survey information and a file geodatabase file of the boundary drawn using the in-survey mapping application. The script itself works fine, however, the issue is that the feature classes do no label... except for one. Oddly enough, it is the same boundary that will label each time I download a new file geodatabase of the Survey123. This is also the case when another user tested the script and attempted to label. Given this, this is technically no longer the same feature class file but it is the SAME survey from Survey123. Further, I've intentionally excluded this survey from the file geodatabase and I am still unable to label the remaining feature classes. I am at my wits end with this issue...
What would cause some feature classes to label and other to not? In particular, what could be a reason why this issue remains despite factors like different download times, users, file names?
Some things to note:
Any suggestions or tips would be greatly appreciated!
EDIT:
Added python script, the file gdb that labels (ending in 2924) and one that does not label (ending in 2932).
Python Script and File GDBs
I've attached the Python script. Pleas note, it is specific to the survey I made but relies on only two of the survey fields which can be easily reproduced:
The script has three parameters which will need to be set when saving as a tool in a toolbox which you'll see towards the top of the script. Alternatively, the variables can be changed to absolute paths.
Solved! Go to Solution.
My first guess wasn't far off. Though the feature do have geometries, they're corrupted. Recognizable by Shape_Area = 0.
Running RepairGeometry solves the problem:
Don't want to go through the code right now, but inserting something like the line below after you created and filled the feature class should suffice.
https://pro.arcgis.com/en/pro-app/2.7/tool-reference/data-management/repair-geometry.htm
arcpy.management.RepairGeometry(in_features)
Might be a stupid question, but do the features actually have geometries? Can you see them on the map, can you zoom to them?
Could you share the python script and a feature class that doesn't work?
Not a stupid question. Thanks for commenting! All the features have geometries and I am able to change its symbology and produce maps. The attributes display as well.
Python Script and File GDBs
I've attached the Python script. Pleas note, it is specific to the survey I made but relies on only two of the survey fields which can be easily reproduced:
Script is attached as well as the file gdb that can label (ending in ...4924) and one of the file gdb that cannot label (ending in ...2932).
The script has three parameters which will need to be set when saving as a tool in a toolbox which you'll see towards the top of the script. Alternatively, the variables can be changed to absolute paths.
I must state that the data in the file geodatabase do not contain real information. These data were part of the user testing portion of our project. All information entered was randomly selected from the survey drop-downs or randomly entered in open-ended text fields. Thanks!
My first guess wasn't far off. Though the feature do have geometries, they're corrupted. Recognizable by Shape_Area = 0.
Running RepairGeometry solves the problem:
Don't want to go through the code right now, but inserting something like the line below after you created and filled the feature class should suffice.
https://pro.arcgis.com/en/pro-app/2.7/tool-reference/data-management/repair-geometry.htm
arcpy.management.RepairGeometry(in_features)
Hi Johannes,
That seemed to fix the issue! Thanks for the suggestion. I've since updated my script and all works well. I hope you have a great day as well.
Maegan