alus-it / AirspaceConverter

Tool to convert airspace files between different formats: OpenAir, openAIP, KML/KMZ, Polish and Garmin
https://www.alus.it/AirspaceConverter
GNU General Public License v3.0
37 stars 10 forks source link

Adjacent duplicated lines #95

Closed maxbelloni closed 5 years ago

maxbelloni commented 5 years ago

OpenAir files sometimes contains duplicated adjacent lines. Is it possible to verify their existence (and maybe eliminate them, keeping the same format, but also just a warning when the fie is read could be enough). Thanks!

alus- commented 5 years ago

Yes we can make the converter to print a warning about a duplicate consecutive point while reading an OpenAir files and the duplicate point will be then ignored. This will also detect the case of a point equal to the end of an arc defined on the previous line.

To remove duplicate consecutive lines from an OpenAir file (or any txt file) I would recommend to use "find and replace" in a text editor like Notepad++ looking for the following regular expression: ^(.*?)$\s+?^(?=.*^\1$) and replacing it with nothing.