![]() ![]() You have to provide the path and shapefile name in line 8 (or I could use the technique that FelixIP uses where the first layer in the current map is used). I will assume all 3-field combination values are unique in the SamplePoint table, but I added the ObjectID to ensure it is unique. The three field values have to be placed in a tuple to act as a key that will sort properly. For all other records you have to skip the dictionary creation to avoid constantly rereading the entire table for each row. You do need to use a cursor to load all of the values to a global dictionary from a sorted list, but only during the calculation of the first record. However, it can be done in the field calculator, provided you use a trick. It is better to run this in a standalone script. This is a two step process, and as a result, the Field Calculator is not well suited to it. Original takes slightly more than 2 minutes Takes 1.5 seconds to complete task on 10000 records. Tbl=arcpy.da.TableToNumPyArray(lr,("oid","A","B"))īs=sorted(tbl, key=lambda x: (x, x)) "Solution" with 2 sorted fields (ascending): mxd = ("CURRENT") ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |