I have a new polyline and need to remove duplicating parts from it. New polyline is compared to other polylines stored in PostGIS table.
I have a query that removes duplicates from line newTrack comparing it to existTrack.
SELECT ST_AsGeoJSON(ST_Difference(newTrack.newGeo::geometry, existTrack.existGeo::geometry)) FROM (SELECT geography as newGeo FROM binndr_road WHERE id = 39267) as newTrack, (SELECT geography as existGeo FROM binndr_road WHERE id = 39274) as existTrack;
But I have no idea how to compare newTrack with all lines stored in the table.