dhattis333

Basic Join Question

Discussion created by dhattis333 on Jun 18, 2011
Latest reply on Jun 19, 2011 by dhattis333
Hi Everyone,

I am trying to do a basic join between a table and a shapefile in a Python script.  When I perform the join with a python script, the resulting shapefile loses all of the field names.  The resulting shapefile has fields like this: "census20_1", "census_20_2", etc. instead of the original field names.  However, when I do the exact same process within ArcGIS (with the same "Add Join" tool) using point and click, the field names are preserved.  Below is my code:

import arcpy, arcview

Census_Shapefile=r'C:\Desktop\Program_Notes\Python\census2000blockgroups_poly.shp'
table=r'C:\Desktop\Program_Notes\Python\education_attainment_by_gender_age.dbf'
Census_Shapefile_Joined=r'C:\Desktop\Program_Notes\Python\Census_Shapefile_Joined.shp'

arcpy.MakeFeatureLayer_management(Census_Shapefile, "Census_Shapefile")

arcpy.AddJoin_management("Census_Shapefile", "LOGRECNO", table, "LOGRECNO")

arcpy.CopyFeatures_management("Census_Shapefile", Census_Shapefile_Joined)


Is it possible to perform a join using Python that preserves the field names without using an ArcInfo tool?

Thanks

Outcomes