# Method of moving-window smoothing

Discussion created by fiendniu on Mar 7, 2012
Hi, all

I am trying to implement the moving window smoothing. The data I have is GPS points (includes, x, y, direction) stored in a point feature class"Section11_SplitedTrips".  Please feel free to comment on my steps.

I want:

A 4m circle is placed on each GPS point, whose location will be changed to the average location of all the GPS points covered by the circle after the smoothing process.

if a GPS point does not have any other point within a searchRadius of 4m it will remain.

My Plan is :
Step 1: use arcpy.GenerateNearTable_analysis(fc,fc,output,searchRadius,local,angl,closest) to find near pts around every point.

Step 2: Modification of the moving-window smoothing by classifying points into two opposite directional groups. In a moving window (creating 4m-radius circle for each point, e.g. si), for example, there are m (6) points within the range of 8m. The pesudocode is:
```Count m
Assign num of searching point (n = m-1)
Create two arrays, C1 & C2
Assign P0 in C1
for Pi in range (n):
if cos(dirP0 ??? dirPn-i)>0
append Pn-i in C1
else if cos(dirP0 ??? dirPn-i) < 0
append Pn-i in C2
else
cos(dirP0 ??? dirPn-i) = 0
if Si  in C1
calculated centroid and average direction of C1 and then assign them to point Si
else
calculated centroid and average direction of C2 and then assign them to point Si
```

Step3: the location of each GPS point may be changed to the average location of all the GPS points covered by its circle. and its direction also be changed to the average direction.