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.
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?
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
To use....
Python parser, in the expression box
shiffle(!yourfield!, dxdy= "your desired max deviation as a number")
<SPAN class="keyword token">import</SPAN> random <SPAN class="keyword token">def</SPAN> <SPAN class="token function">shiffle</SPAN><SPAN class="punctuation token">(</SPAN>x_or_y<SPAN class="punctuation token">,</SPAN> dxdy<SPAN class="operator token">=</SPAN><SPAN class="number token">0.2</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"""randomly shuffle a point"""</SPAN> <SPAN class="keyword token">return</SPAN> x_or_y <SPAN class="operator token">+</SPAN> random<SPAN class="punctuation token">.</SPAN>uniform<SPAN class="punctuation token">(</SPAN><SPAN class="operator token">-</SPAN>dxdy<SPAN class="punctuation token">,</SPAN> dxdy<SPAN class="punctuation token">)</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
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) ?
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
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.