ST_Union based on attribute

المشرف العام

Administrator
طاقم الإدارة
I have a road network of center lines of MultiLinestrings.They have nodes at every intersection.I try to understand how I can merge roads together that have the same category as attribute (There are about 80 different categories). Roads with the same category is not always connected, So i guess I need to have the result back as a MultiLineString again but grouped on attribute value.

Is there a way to do this?Thanks in advance

Edit:I played around some more and almost got the result I wanted. Simply using

SELECT "category", ((ST_Collect(geom))) as geom FROM s.road GROUP BY "category"But this seem to be returned as a Geometrycollection of Multilinestrings and cannot be loaded into QGIS.Any advice?



أكثر...
 
أعلى