File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -151,11 +151,18 @@ from (
151151-- **********************************************************
152152-- Now delete all waypoints which already exist in the waypoint table
153153
154+ -- Delete all duplicate waypoints that are at the same position having same name, region and type
155+ -- 1 deg manhattan distance about 60-100 nm at the equator
154156delete from waypoint_temp where waypoint_id in (
155- select w1 .waypoint_id from waypoint_temp w1
156- join waypoint w2 on w1 .ident = w2 .ident and
157- w1 .region = w2 .region and
158- (abs(w1 .lonx - w2 .lonx ) + abs(w1 .laty - w2 .laty )) < 0 .00000001 );
157+ select distinct w1 .waypoint_id
158+ from waypoint_temp w1
159+ join waypoint_temp w2 on w1 .ident = w2 .ident and w1 .region = w2 .region and w1 .type = w2 .type
160+ where w1 .waypoint_id < w2 .waypoint_id and (abs(w1 .lonx - w2 .lonx ) + abs(w1 .laty - w2 .laty )) < 0 .00000001 );
161+
162+ delete from waypoint_temp where waypoint_id in (
163+ select w1 .waypoint_id from waypoint_temp w1
164+ join waypoint w2 on w1 .ident = w2 .ident and w1 .region = w2 .region and w1 .type = w2 .type
165+ where (abs(w1 .lonx - w2 .lonx ) + abs(w1 .laty - w2 .laty )) < 0 .00000001 );
159166
160167-- **********************************************************
161168-- Copy all waypoints from temp table to waypoint table
You can’t perform that action at this time.
0 commit comments