I have the following query which does a self join with a table and outputs all the points of intersections between lines.
insert into road_intersection
select nextval('road_intersection_id_seq'), a.road_id, b.road_id, st_intersection(a.road, b.road), st_centroid(st_intersection(a.road, b.road))
from polygon_road a, polygon_road b
where st_intersects(a.road, b.road) AND a.road_id!=b.road_id
BUT it outputs duplicate values for each point of intersection since it computes the point of intersection for each road. EG:
70;71;POINT_OF_INTERSECTION
71;70;POINT_OF_INTERSECTION
70
AND 71
are both id
values of two distinct roads. As you can see the point of intersection has been computed twice for the same two roads.
Any suggestions how i can solve this issue and only one point of intersection would be computed?