1

I have a very large .gdb (15000+ geodatabase feature classes). I know that's unusually and impractically large, but it's the result of an iterative model, which ran through every block group in NY State to calculate residential percentage based on tax parcel data. Each feature class now has one attribute -its residential percentage.

I now need a table with all of those feature classes' attributes so that I can plug the residential percentages in to an Excel document I have. Normally I would merge them and export to Excel, but of course that's not possible with such a huge .gdb.

What other way can I do this? Is there some way to derive a table from the geodatabase itself?

8
  • Excel 2016 has 'only' 16384 columns. If your shapefiles has even more than one attribute, you aproach will not work. You won't have enough columns to achive what you're trying to.
    – Delonix R.
    Commented Mar 2, 2017 at 17:34
  • 1
    For clarification - You want to put 15000+ shapefile's data into one table by merging? What would be the purpose of this? Could you provide more details about your iterative model, maybe there is a better workflow
    – GISHuman
    Commented Mar 2, 2017 at 17:58
  • 1
    You mean you have 15,000 "geodatabase feature classes"... not shapefiles... Commented Mar 2, 2017 at 17:59
  • 4
    It sure sounds like you should change your model to create just one featureclass, and then write one row to it for each iteration. The featureclass would have two attributes: residential_percentage and block_group (containing whatever string you were using as a featureclassname). Commented Mar 2, 2017 at 18:44
  • 1
    You should probably ask another question on how to modify the model.
    – Bera
    Commented Mar 8, 2017 at 6:47

1 Answer 1

3

You could use python to create a csv. You would need to change the variables to match your situation. This will produce a CSV with two columns: feature class name & the value of each row of the given column(field) name. This assumes the schema is identical for each feature class.

Thanks to Greg for his answer regarding list flattening: https://stackoverflow.com/a/952943/994972

Environment: ArcGIS Desktop 10.3.1 (Advanced License) Python 2.7

import arcpy
import csv
import operator

arcpy.env.workspace = "C:/Users/You/Desktop/Test.gdb"
newCSV = "C:/Users/You/Desktop/TESTCSV.csv"
valueList = []
fieldname ="YourFieldName"

for fc in arcpy.ListFeatureClasses():

    #Will add a list holding your feature class name and the value in the     field
    #example: [featureclassNameXXX,0.34]
    valueList.append([[fc,item[0]] for item in arcpy.da.SearchCursor(fc,fieldname)])
    #merge lists of lists
    flattenList =  reduce(operator.add,valueList)


with open(newCSV,'wb') as csvfile:

    writer = csv.writer(csvfile)
    writer.writerows(flattenList)

Output: Two column CSV with feature class name and desired value from each.

Two column CSV

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.