Sunday 21 June 2015

arcpy - Two fields have same name in attribute table and not possible to get unique values?



I have run multiple processes in arcpy: convert rasters to feature classes, overlay multiple feature classes and intersect layers. I would like to keep all attributes of my data.



However, I've ended up with attribute table, which contain two fields with the same alias: gridcode (as I have converted two rasters to shp and overlaying them). The field names are actually different (gridcode and gridcode_1).


When I try to display my final map, the Symbology in Layer properties reads only gridcode values of one field. Or course, it is not the one I would like to visualize.


Did you experience not redible symbology? is it because of the same name of my fields? if yes, how can I avoid it? I tried to:



  • open the new .mxd document and load data,

  • copy my files to new database and load data,


  • qualify my field names in the arcpy environment settings


    arcpy.env.qualifiedFieldNames = False





All without success in ArcGIS 10.4.


Here is some illustration of the same field names with different values (originated from different rasters):


enter image description here


In Layer Properties -> Symbology I can read only the values of the second field...


enter image description here


If I run print [f.name for f in arcpy.ListFields("iBuffSmkGFW")] I've got back:


>>> [u'OBJECTID', u'Shape', u'FID_GFW_SVK_poly', u'Id', u'gridcode', u'FID_outSMKpoly', u'Id_1', u'gridcode_1', u'FID_buff_erased', u'ID_12', u'PARTS', u'CSZ', u'NAM', u'DTS', u'LEG', u'PSB', u'ZONA', u'VYHLASIL', u'LEGENDA', u'TYP_MCHU', u'ROK_VYHL', u'V_KN', u'POLY_AREA', u'NUM_POINTS', u'ORIG_FID', u'distance', u'Shape_Length', u'Shape_Area']


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...