ArcGIS and ACCESS table
I'm new to Python in combination with ArcGIS. I have a shape file with different regions A,B and C and an Access table :
开发者_运维知识库feature region
1 A
1 B
2 C
3 A
3 B
Now I'm trying to select one of the features and corresponding regions to give same a different color. Is there a good way doing this with python? Thanks a lot for any idea.
cheers eactor
I think I got it by my own. Here are some important hints:
1)Join the table and shape file with the corresponding row:
arcpy.AddJoin_management("regionsshape","NAME","region_table","NAME")
2)Loop over the table and do selection:
rows = arcpy.SearchCursor("region_table")
for row in rows:
arcpy.SelectLayerByAttribute_management("regionsshape","NEW_SELECTION","FEATURE_NAME='" + row.getValue("NAME") + "'")
now you only have to include what you want to do with the selection in my case produce a layer file:
arcpy.MakeFeatureLayer_management("regions",row.getValue("id"))
arcpy.SaveToLayerFile_management(row.getValue("id"),"C:/temp/"+row.getValue("id")e+".lyr","ABSOLUTE")
精彩评论