I would like to join linestrings which are connected to each other. The preferred output is a longer linestring based on all joined single linestings! The table that holds my single linestrings is called “traffic_roads_temp”. Each linestring has the attribute ref. Ref describes in my table the affiliation to a certain motorway or road.
As you can see in the picture below the motorway A 2 and A 7 could be easily joined by using something like this:
select ref, st_linemerge(st_collect(way)) from traffic_roads_temp group by ref
One of the problem is, that the output seems to be a multilinestring and not a linestring.
The main problem is the motorway A 39. It consists out of two separated road segments. Therefor I would like to generate two linestrings of the A 39 --> A 39.1 and A 39.2 All other motorways could be stored in one linestring per motorway.
Maybe somebody of the experts in this forum could help me to solve this problem(s):
Generate long linestrings from single smaller linestring. (No multilinestring)
I case of the motorway A 39 which consists out of two spread road parts – I would like to generate something like a series: A 39.1 and A 39.2