I have a GPS-file with app 8000 positions. I want to create a random point for each of these positions. Each of the random points should have the same ID and DateTime as its corresponding GPS point-point. Only the coordinates should vary.
A sample of the GPS file contents might clarify what you want to do with the existing coordinates and the form of the date-time data
OK, sorry I forgot that!
Is it possible to use field calculator to calculate random XY-coordinates within the GPS dataset (based on its extent) ?
Assuming you don't want to completely randomize the point locations... that would be as easy as assigning random numbers within a range for both X and Y.
But if you just want to randomize their location within a range of values...
... just add new Long/lat fields ie X_rand, Y_rand and you can shuffle your existing coordinates by bit determined by you.
I will use the existing fields in the table rather than having to access the Shape field (which is possible, but has extra baggage)
You just need to do this for the 2 new fields, then add the table back in as an event layer
Python parser, in the expression box
shiffle(!yourfield!, dxdy= "your desired max deviation as a number")
import randomdef shiffle(x_or_y, dxdy=0.2): """randomly shuffle a point""" return x_or_y + random.uniform(-dxdy, dxdy)
Thanks a lot Dan, very good tip! Is it a way that I can do this randomly shuffelling within the extent of the GPS-dataset?
if you know the extents, then the above code could be modified to check for it...
but with every ... BUT .... things get more complicated, so the question would be, how mission-critical is it that things stay within the total extent
If it is an absolute need (ie, gps points falling into water rather than land) then provide your extent values.
If it is 'nice' then I will leave that as a coding exercise for someone
Retrieving data ...