Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I used extract by points function to extract values from multiple rasters using a point feature class. The output is a couple hundred point feature classes with values associated with those rasters.

I would like to append all the attributes table of feature class (they all have same POINTID) so that I have all the information I want in a single table. What is the best way to do this?

See attached screenshot: Screenshot

I would like to append RASTERVALU of each feature class (SRAD_KRIGXXXXX) to "FOOTPRINT" attribute table (maintaining its file naming structure).

Such that the FootPrint feature class will have field names SRAD_KRIG2007001, SRAD_KRIG2007002, SRAD_KRIG2007003, etc. with values from their RASTERVALU field.

I was wondering if python scripting is what I need. Any help is greatly appreciated. Thanks.

share|improve this question

3 Answers 3

I would make an empty table for output and then iterate over your featureclasses, joining and transferring information from feature classes to your output table as you go.

import arcpy

arcpy.env.workspace = 'C:\wherever your data is'

# create an empty dbf file using a template
arcpy.CreateTable_management("C:/Data/..","SRad_KrigAll.dbf","Template.dbf", "") 

fcList = arcpy.ListFeatureClasses('SRad_Krig*')
tblOut = 'SRad_KrigAll.dbf'

fcFirst = fcList[0]

arcpy.MakeTableView_management(fcList[0], 'tv')
arcpy.TableToDBASE_conversion('tv', tblOut)
arcpy.DeleteField_management(tblOut, 'RASTERVALUE')

arcpy.MakeTableView_management(tblOut, 'tvOut')

for fc in fcList:
    field = 'k' + fcFirst.replace('SRad_Krig', '')
    arcpy.AddField_management(tblOut, field, 'DOUBLE')
    arcpy.MakeTableView_management(fc, 'tv')
    arcpy.AddJoin_management(tblOut, 'OBJECTID', 'tv', 'OBJECTID')
    arcpy.CalculateField_management('tvOut', tblOut + '.' + field, \
    '[' + fc + '.RASTERVALU]')
    arcpy.RemoveJoin_management('tvOut', fc)
share|improve this answer
    
The python code gave output as "TV.dbf" with values from first featureclass. ERROR from Python: Converted tv to C:\Data\SRad_KrigALL.dbf\tv successfully. Unable to Process Failed to execute. Parameters are not valid. ERROR 000310: The Field name must not start with a number Failed to execute (AddField). –  kdekalb Jan 24 at 20:58
    
hmmm...expected tblOut = 'SRad_KrigAll.dbf'. Not sure how it ended up with TV.dbf. Seems my TableToDBASE bit can be dumped if you would rather go w/CreatTable (one should go, tho--redundant). Also, pre-pended a string to the field name based on ERROR 000310. –  Roland Jan 24 at 22:41
    
Process finished with exit code 1. IndexError: list index out of range. Traceback: fcFirst = fcList[0] –  kdekalb Jan 24 at 23:10
    
Sorry, that should be arcpy.ListFeatureClasses('SRad_Krig*') with an asterisk. I'll mod the code. –  Roland Jan 24 at 23:17
    
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Output Folder: Dataset C:/Test/SRad_KrigAll.dbf does not exist or is not supported Failed to execute (TableToDBASE). Is there something wrong with the template I created? How am I supposed to create the template for this? Also, could you please comment on what each syntax is doing for clarity. I would greatly appreciate it. –  kdekalb Jan 25 at 17:30

I know this sounds a little messy, but have you tried joining two tables to start, then exporting the table with the join (so that the join is saved). Then you can repeat and join that table to the 3rd table, and so on.

share|improve this answer
    
Yes, that is best when we have few joins to make. My situation is different, requiring hundreds of attribute tables to be merged at once. –  kdekalb Jan 23 at 3:48

If you're asking what I think you're asking, it would be using the Summarize Data in a Table function on the resulting attribute table of points.

share|improve this answer
    
Thanks, but this is not what I was looking. I will post screen shots so my question becomes more clear. –  kdekalb Jan 23 at 1:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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