Select to view content in your preferred language

Get feature class/raster file size in file geodatabase from standalone script

1553
2
Jump to solution
08-07-2023 11:58 AM
NicolasRacine
Occasional Contributor

Hello everyone, I'm currently trying to make a standalone script to list the file size of data present in a file geodatabase such as feature classes and rasters. I know this information is available when in the catalog view of ArcGIS Pro where one of the column shows the size of datasets in kilobytes.

I've began looking at acquiring this information via arcpy but from my research it seems this type of information can only be acquired via the sdk.

So far I've found this property https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic27573.html  but, correct me if I'm wrong, it seems to be only accessible when executing code as an add-in and not as a standalone script.

My question would thus be if I'm on the right path or there's another way to get file sizes of datasets in a file geodatabase.

0 Kudos
1 Solution

Accepted Solutions
Wolf
by Esri Regular Contributor
Esri Regular Contributor

You are correct, those classes that you need are only available through ArcGIS Pro API assemblies that are accessible via Add-ins.   When you create a Pro SDK console standalone application (referred to as a CoreHost application) the assemblies you need are not accessible.   Corehost applications only have access to the ArcGIS.Core and ArcGIS.CoreHost assemblies.  

View solution in original post

2 Replies
Wolf
by Esri Regular Contributor
Esri Regular Contributor

You are correct, those classes that you need are only available through ArcGIS Pro API assemblies that are accessible via Add-ins.   When you create a Pro SDK console standalone application (referred to as a CoreHost application) the assemblies you need are not accessible.   Corehost applications only have access to the ArcGIS.Core and ArcGIS.CoreHost assemblies.  

MattWilkie3
Frequent Contributor

I wrote (with LLM) something up for this using python and Fiona library. It does not rely on arcpy or arcgis sdk - so no warranties, YMMV, etc. It works for me and is much lighter and faster than using native esri tooling.

uv run GDB/get-fgdb-stats.py "D:\work\Nat_Hydro_Network\yt_nhn-nov-2025.gdb" --csv original_inventory.csv
Scanning D:\work\Nat_Hydro_Network\yt_nhn-nov-2025.gdb...

  Name                             Type                             Geometry   Date Modified              Size KB 
 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  NHN_HD_SLWATER_1                 File Geodatabase Feature Class   Line       2025-11-25 08:52:41 AM   2,722,484
  NHN_TO_NAMEDFEA_2                File Geodatabase Feature Class   Polygon    2025-11-25 08:52:41 AM   2,334,932
  NHN_HD_MANMADE_1                 File Geodatabase Feature Class   Line       2025-11-25 08:52:41 AM   1,757,635
  ...
  NHN_HN_DELIMITER_1               File Geodatabase Feature Class   Line       2025-11-25 08:52:41 AM          12
  NHN_HE_OBSTACLEPT_6              File Geodatabase Feature Class   None       2025-11-25 08:52:40 AM           8
  NHN_HE_MANMADEPT_6               File Geodatabase Feature Class   None       2025-11-25 08:52:40 AM           6

 If I ever update it, the change is most likely to show up in https://github.com/maphew/mhwcode/tree/master/gis

Edit: apparently I'm not allowed to attach a script even if it ends .txt, here's a direct link: https://github.com/maphew/mhwcode/blob/master/gis/get-fgdb-stats.py 

0 Kudos