3

My AddJoin operation is failing:

arcpy.CopyRows_management(lup_file,out_dir+'lup')
try:
    # Perform copy rows on merged csv file
    print 'start'
    aa = arcpy.Raster(SEIMF)
    arcpy.AddJoin_management(aa, "VALUE", out_dir+'lup', "VALUE", "KEEP_ALL")
    print 'end'
    #arcpy.AddJoin_management(gis_dir+SIF, "VALUE", out_dir+'lup', "VALUE", "KEEP_ALL")
except:
    print arcpy.GetMessages()

error messages:

Executing: AddJoin C:\Users\Documents\Projects\AB\Inputs\gis\sif VALUE C:\Users\Documents\Projects\AB\Outputs\C\output\lup VALUE KEEP_ALL
Start Time: Sat Feb 22 02:27:50 2014
Failed to execute. Parameters are not valid.
ERROR 000840: The value is not a Table View.
ERROR 000825: The value is not a layer or table view
ERROR 000840: The value is not a Raster Catalog Layer.
ERROR 000840: The value is not a Mosaic Layer.
WARNING 000970: The join field VALUE in the join table sif is not indexed. To improve performance, we recommend that an index be created for the join field in the join table.
Failed to execute (AddJoin).

Does anyone know what is happening? I get this error only in the python code and can execute AddJoin just fine if I use the ArcGIS manually.

0

1 Answer 1

6

arcpy.AddJoin_management request a layer or a table view, and you are feeding a raster dataset, which is not exactly the same.

Instead of arcpy.Raster, use arcpy.MakeRasterLayer_management. Also make sure that your layer has an attribute table (arcpy.BuildRasterAttributeTable_management), but his does not seem to be the problem in your case.

2
  • Thanks so much! The error is gone. However, when I open the raster in ArcGIS, I do not see any new joined columns. Any ideas on why this might be? I have checked that the table I am joining is not empty.
    – user1186
    Commented Feb 22, 2014 at 17:47
  • 1
    Ah, I wasn't saving the temporary layer. Works now after I save it using SaveToLayerFile_management. Thank you so much again!
    – user1186
    Commented Feb 22, 2014 at 18:44

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