I have GPS data which includes “Lon”, “Lat”, and cumulative Time from 0 (sec) as fields. I want to add an integer variable new field, “Trip,” which starts from zero, and is incremented by one after the respondent stopped at some location more than 180 seconds. Hence the “Trip” field may be like (0, 0, 0, 1, 1, 1, 1, 2, 2, …).

I would like to do this on ArcGIS if possible, but could not find effective solutions.


If I understand correctly you want to divide, or at least classify, the track into legs. You've got a couple of issues to face, and this probably can't be solved with a simple field calculation.

If the GPS data has a single coordinate for a stop, then you'd create a variable called count, then start at the first point and iterate through each following point checking whether time - previous time > 180. If not, you put in count value to your trip field and go to the next. If so, you add one to count, put that in, and then go to the next.

But likely the GPS data doesn't have a single coordinate for a stop (I guess it could, but my GPS track data never does). In this case you'd have to decide how far apart two points can be to be considered at the same place, because even should the unit be perfectly stationary you're likely to end up with slight variations due to signal accuracy (which will vary depending on environment). And more likely the unit isn't stationary, but perhaps moving around within a few(?) foot radius. So now you not only have to be checking the time value, but you first have to check that the coordinates of a point or group of points is far enough away from the previous point to actually classify as movement. Some pre-processing of data to simplify it and reduce the number of points within a tolerance could solve that problem without having to account for it in the track division/classification process.

Depending on how much data you have and how often you have to do this, a manual solution might be quicker using GPS software rather than GIS - or perhaps both. With my Garmin software it's relatively simple to scroll through a track and identify clusters of points where I've been stopped for a bit. I could use that to identify the break points, then in GIS select all the records up to that point and manually field calc a leg identifier into a new field.

This type of problem has been discussed before a few times. You might take a look at the following questions for some ideas and additional resources.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.