I'm using ArcMap 10.2.1. I have GPS collar data from which I'm trying to determine the farthest distance moved by an individual each day. Therefore, I need to take the first point recorded in a day and measure it to each location recorded that day. I've investigated using Near and Point Distance, however, these methods either compare all combinations of points or the ones in a self-provided buffer. Any ideas or thoughts?
-
I would use Point Distance if you are licensed for it.– PolyGeo ♦Commented Dec 14, 2016 at 22:10
-
I've tried Point Distance, however, either all combinations are calculated or only those within a specified buffer from the point of interest. I need to calculate those from the same day.– MattCommented Dec 14, 2016 at 22:31
-
Max XY distance in this day's points.– MattCommented Dec 14, 2016 at 23:08
2 Answers
Assuming first point is record that appears first for given date set.
WORKFLOW:
# find coordinates of first point
arcpy.AddField_management("random", "dateText", field_type="TEXT")
arcpy.CalculateField_management("random", "dateText", """!Date!.split(" ")[0]""", expression_type="PYTHON_9.3")
arcpy.AddGeometryAttributes_management("random", "POINT_X_Y_Z_M")
arcpy.Statistics_analysis("random", "D:/Scratch/first.dbf", "POINT_X FIRST;POINT_Y FIRST", case_field="dateText")
# find distances
arcpy.AddField_management("random", "DISTANCE", "DOUBLE")
arcpy.AddJoin_management("random", "dateText", "first", "dateText", "KEEP_ALL")
arcpy.CalculateField_management("random", "random.DISTANCE", "math.hypot( !random.POINT_X! - !first.FIRST_POIN!, !random.POINT_Y!- !first.FIRST_PO_1!)", expression_type="PYTHON_9.3")
arcpy.RemoveJoin_management(in_layer_or_view="random", join_name="")
# summarise by date
arcpy.Statistics_analysis("random", "D:/Scratch/results.dbf", "DISTANCE MAX", case_field="dateText")
Perhaps modify "dateText" in above by concatenation with individual ID
-
The code worked perfectly. As anyone might guess, shapefile and pathway names just needed to the edited. Thanks for your help, FelixIP.– MattCommented Dec 16, 2016 at 19:04
It sounds like you are saying that to determine point distances between all points in your feature class will be too much processing when you only need to do it for the points captured on a single day.
Consequently, I think you should use the Select (Analysis) tool to select out points for that day into a separate (temporary) feature class and just run Point Distance on that.
This will cut the number of permutations that need to be calculated dramatically.
-
Correct. I have anywhere from 400 - 3,000 points per individual over a maximum of 9 months. Separating each day into a separate feature class may be the (long)way around.– MattCommented Dec 14, 2016 at 23:12