Select to view content in your preferred language

HELP! Labels not showing for feature classes

2850
5
Jump to solution
12-07-2021 02:22 PM
MaeganSalinas1
Occasional Contributor

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: 

  • All fields display in the feature class.
  • Feature classes have been added to other workspaces - label does not work
  • Feature classes have been exported as shapefiles - label does not work
  • No other labels are turned on in the workspace. 
  • The boundary to be labeled is no more then 10 acres of land and the other files in the map project are base layers that do not take long to load.
  • Label properties are not advanced. I've tested labelling the "ObjectID" and it does not appear.

 

 

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:

  1. Field name "ca_county", alias "California county where grown"
    • This is a string field ranging between 01 - 58. Aliases are the California county names in alphabetic order (Alameda - Yuba). However, this field can be any range. It just needs to have the exact field name and alias as listed. 
  2. Field name "PQ", alias "PQ Number" 
    • This is a string field for a unique timestamp (this is alphanumeric, no spaces, no symbols). The script takes whatever alphanumeric characters are in this field. There are no constraints beyond what is in the parentheses above so it can be anything you type. Similar to above, this can be any combination of alphanumeric characters, it just needs to have the exact field and alias names as listed.

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. 

0 Kudos
1 Solution

Accepted Solutions
JohannesLindner
MVP Frequent Contributor

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:

JohannesLindner_1-1639060956096.png

 

JohannesLindner_2-1639060968192.png

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)

 


Have a great day!
Johannes

View solution in original post

5 Replies
JohannesLindner
MVP Frequent Contributor

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?

JohannesLindner_0-1638958302210.pngJohannesLindner_1-1638958313904.png

 


Have a great day!
Johannes
MaeganSalinas1
Occasional Contributor

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:

  1. Field name "ca_county", alias "California county where grown"
    • This is a string field ranging between 01 - 58. Aliases are the California county names in alphabetic order (Alameda - Yuba). However, this field can be any range. It just needs to have the exact field name and alias as listed. 
  2. Field name "PQ", alias "PQ Number" 
    • This is a string field for a unique timestamp (this is alphanumeric, no spaces, no symbols). The script takes whatever alphanumeric characters are in this field. There are no constraints beyond what is in the parentheses above so it can be anything you type. Similar to above, this can be any combination of alphanumeric characters, it just needs to have the exact field and alias names as listed.

 

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. 

0 Kudos
MaeganSalinas1
Occasional Contributor

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!

0 Kudos
JohannesLindner
MVP Frequent Contributor

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:

JohannesLindner_1-1639060956096.png

 

JohannesLindner_2-1639060968192.png

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)

 


Have a great day!
Johannes
MaeganSalinas1
Occasional Contributor

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

0 Kudos