I have a big line shapefile data (over 2 millions features) showing animal movements.
Simplified example:
ID Year st_time end_time stX stY enX enY
1 2018 070505 070603 5857000 461000 5848000 380000
2 2018 070603 070705 5848000 380000 5907100 379000
3 2018 070742 070852 5929000 359100 5936000 364000
4 2018 070852 070915 5936000 364000 5890700 363500
etc.
Each feature has attributes including start and end time and most of the features form continuous set of lines (the end time of the previous feature is the start time of the next feature, eg. between IDs 1 and 2 in the example) but occasionally there are some caps that I would need to find and fix (eg. between IDs 2 and 3 in the example) by drawing the missing line, eg.
ID Year st_time end_time stX stY enX enY
1 2018 070505 070603 5857000 461000 5848000 380000
2 2018 070603 070705 5848000 380000 5907100 379000
5 2018 070705 070742 5907100 379000 5929000 359100
3 2018 070742 070852 5929000 359100 5936000 364000
4 2018 070852 070915 5936000 364000 5890700 363500
etc.
I have divided the data based on years which means I now have over 30 files that I would need to do the following to:
- Check if the ID n+1 start time matches with ID n end time (or alternatively use coordinates).
- If not, create a new line feature where
start time = ID n end time, and
end time = ID n+1 start time
These attributes are definitely necessary with the new features
I'm working with ArcGIS Pro 2.3.3 and would like to use ModelBuilder or Python coding to do this. I assume Pandas would be the package for database management but I don't know quite how to approach finding the caps and especially creating the new features with appropriate attributes.
I know about XY to line -tool in the Arcpy package but to use it I would first need to create the table with the new feature rows (previous step).