If simplify parameter is supplied, get ST_LineMerge'd versions of segment geom values, then simplify resulting linestrings and multilinestrings.