Select to view content in your preferred language

Identify Feature Classes with 64-bit ObjectID

885
18
Jump to solution
08-27-2024 09:03 AM
ModernElectric
Frequent Contributor

Is there an easy way to identify all Feature Class(s) within a File Geodatabase that have a 64-bit Object ID, as in constructing a Python script? Versus going thru the properties over hundreds of different Feature Class(s) and a number of different GDBs?

1 Solution

Accepted Solutions
SSWoodward
Esri Contributor

@ModernElectric 

If you'd like another way to check you can always use a schema report.  I left this response to @Bud 's linked Idea but I'll put it in here as well for good measure:

The 'Field' worksheet of the schema report will give you information about every field in the geodatabase. To use it to make sure there are no 64-bit OIDs in your workspace, you can try the following.

1. Generate an Excel schema report of your geodatabase by right-clinging in the catalog pane and selecting 'Generate Schema Report'

2.  Navigate to the 'Field' worksheet in the produced XLSX report.  This sheet contains the property information for all fields in the geodatabase.

3. Sort the table by field type to group all Object ID fields together.

4. Take note of whether the OID field length is 4 ( standard OID ) or 8 ( 64 bit OID )

View solution in original post

18 Replies
Bud
by
Esteemed Contributor

I submitted a related idea: List of all columns in FGDB using SQL query

0 Kudos
Bud
by
Esteemed Contributor

Could you explain why you want to do this? Are there issues with 64-bit Object IDs we should watch out for when upgrading to the latest version of Pro, Enterprise/Portal, etc?

 

0 Kudos
ModernElectric
Frequent Contributor

From my research, Hosted Feature Layers that come from a File GDB feature class with an ObjectID 64-bit does not work well with AGOL and Workforce on the auto-sync process. I am working on trying different things thru the process of elimination. 

MarcoBoeringa
MVP Regular Contributor

Due to a historic Javascript and Node.js limitation, 64-bit is actually currently 53-bit support for some applications and uses in the ESRI product line. This might change in the future:

https://blog.logrocket.com/how-to-represent-large-numbers-node-js-app/

https://v8.dev/features/bigint

Not that you are likely to hit 53-bit ObjectIDs anytime soon, but see the "Caution" remark in this ESRI Help page.

 

SSWoodward
Esri Contributor

You'll want to use:

 

arcpy.Describe(feature_class).hasOID64

 


Describe Documentation 

SSWoodward
Esri Contributor

if you want to find all objects in your geodatabase with a 64-bit OID you can:

 

desc = arcpy.Describe(workspace)

oid64_classes = [
    child for child in desc.children if getattr(child, 'hasOID64', False)
]

 

 

I will note that you will need some extra logic if there are feature datasets present, as this will not dig into them.

0 Kudos
ModernElectric
Frequent Contributor

Note, I am using Python Idle to run the query, if that makes a difference. If nothing is returned, does that mean it is not identifying any features with a 64-bit ObjectID? 

0 Kudos
SSWoodward
Esri Contributor

Correct.  If you have classes in feature datasets, they will not be included since they are children of children.  Here is logic that includes feature datasets.

 

geodatabase = 'c:\temp\my_gdb.gdb'
oid64 = list()

for workspace in arcpy.da.Walk(geodatabase):
    desc = arcpy.Describe(workspace[0])
    oid64.extend([
        child for child in desc.children if getattr(child, 'hasOID64', False) 
        ]
    )

# If you want something more explicit you could do something like
# replacing line 7 with:
  
(child.name, getattr(child, 'hasOID64', False)) 

# It will return something for every class though so you'd 
# either need to inspect manually or build another list from it.
# to confirm no classes with OID64

 

ModernElectric
Frequent Contributor

@SSWoodward 

Thank you. I will work with these and see. Each File GDB I input into the script, the Idle Shell screen comes back clear. That must tell me that none of the Feature Classes has the 64-bit Object ID and they ALL should be 32-bit. 

0 Kudos