ExtendTable ... permanent joins... arcpy and numpy play nice

1090
0
10-31-2017 07:44 PM
Labels (1)
DanPatterson_Retired
MVP Emeritus
1 0 1,090

Look

Code as verbose as possible.  Based on a generic function that I use.

Rules

  1. Do not have Pro or Map open
  2. Run your code
  3. Open the project when you are done.
  4. Review rules 1-3
  5. You can sort using multiple fields or a single field.  You can reverse sort by just slicing and reversing at the same time... arr_sort = arr_sort[::-1] way quicker than trying to get all the options on a dialog.  This can be done on a column or multiple columns basis.
  6. Still too confusing? .... attach the code to a new script in a toolbox... it doesn't need any parameters, but you have to substitute the paths.  ExtendTable requires a close tie to Pro even if your external python IDE is the editing IDE default when you set up Pro.

ExtendTable will do a permanent join if the script is run from a tool within ArcToolbox, making it a nice alternative to the standard join procedure.  

Numpy has functionality within the recfunctions module located at https://github.com/numpy/numpy/blob/master/numpy/lib/recfunctions.py 

These would include

__all__ = [
'append_fields', 'drop_fields', 'find_duplicates',
'get_fieldstructure', 'join_by', 'merge_arrays',
'rec_append_fields', 'rec_drop_fields', 'rec_join',
'recursive_fill_fields', 'rename_fields', 'stack_arrays',
]

So you have options to do your work within or without Arc* depending on what is the easiest in the workflow

Less than 1000 words too.

PythonArcGIS Pro

About the Author
Retired Geomatics Instructor at Carleton University. I am a forum MVP and Moderator. Current interests focus on python-based integration in GIS. See... Py... blog, my GeoNet blog...
Labels