(self, lines)
return geom_factory(result)
Merges all connected lines from a source

        The source may be a MultiLineString, a sequence of LineString objects,
        or a sequence of objects than can be adapted to LineStrings.  Returns a
        LineString or MultiLineString when lines are not contiguous.
Merges all connected lines from a source
Merges all connected lines from a source
def linemerge(self, lines):
        """Merges all connected lines from a source

        The source may be a MultiLineString, a sequence of LineString objects,
        or a sequence of objects than can be adapted to LineStrings.  Returns a
        LineString or MultiLineString when lines are not contiguous.
        """
        source = None
        if hasattr(lines, 'type') and lines.type == 'MultiLineString':
            source = lines
        elif hasattr(lines, '__iter__'):
            try:
                source = asMultiLineString([ls.coords for ls in lines])
            except AttributeError:
                source = asMultiLineString(lines)
        if source is None:
            raise ValueError("Cannot linemerge %s" % lines)
        result = lgeos.GEOSLineMerge(source._geom)
        return geom_factory(result)
def linemerge ( self , lines ) : source = None if hasattr ( lines , 'type' ) and lines . type == 'MultiLineString' : source = lines elif hasattr ( lines , '__iter__' ) : try : source = asMultiLineString ( [ ls . coords for ls in lines ] ) except AttributeError : source = asMultiLineString ( lines ) if source is None : raise ValueError ( "Cannot linemerge %s" % lines ) result = lgeos . GEOSLineMerge ( source . _geom ) return geom_factory ( result )