Add a method to clean LineStrings and avoid duplicate geometry

* Added related tests