I know I could shift the points one by one, but there are over 6000 existing points. Is there a way to have them all move so they remain as close as possible to their current location but fall no closer than say, 5m of one another?
Thanks
The quickest way would be to add two new fields to your point table and calculate an Xnew and Ynew field which takes the form of
<SPAN class="keyword token">from</SPAN> random <SPAN class="keyword token">import</SPAN> uniform <SPAN class="keyword token">def</SPAN> <SPAN class="token function">shift</SPAN><SPAN class="punctuation token">(</SPAN>val<SPAN class="punctuation token">,</SPAN> start<SPAN class="operator token">=</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">,</SPAN> end<SPAN class="operator token">=</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"""shift within the range +shifty and -shifty"""</SPAN> jiggle <SPAN class="operator token">=</SPAN> uniform<SPAN class="punctuation token">(</SPAN>start<SPAN class="punctuation token">,</SPAN> end<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">return</SPAN> val <SPAN class="operator token">+</SPAN> jiggle<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Now if val was 10, then you would get numbers in the 9-11 range.
Just repeat for the X and Y coordinates.
The 'val' can be provided from an appropriate X or Y field or you could use !Shape.centroid.X! and !Shape.centroid.Y! instead.
The expression box is
shift(whateverYouUseForVal, start=-1, end=-5) # you can mix up the start and end ranges, they don't need to be equal
EDIT
I failed to state the obvious... add the new x,y data back into arc* and save it as a shapefile/feature class
Fantastic, thank you!
Ellen, if it worked, could you mark the question answered so that people will know that a solution was provided.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.