当前位置: 首页>>代码示例>>Python>>正文


Python geometry.MultiLineString方法代码示例

本文整理汇总了Python中shapely.geometry.MultiLineString方法的典型用法代码示例。如果您正苦于以下问题:Python geometry.MultiLineString方法的具体用法?Python geometry.MultiLineString怎么用?Python geometry.MultiLineString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在shapely.geometry的用法示例。


在下文中一共展示了geometry.MultiLineString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _line_iterator

# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import MultiLineString [as 别名]
def _line_iterator(obj):
    if isinstance(obj, (sg.LineString)):
        yield obj
    elif isinstance(obj, (sg.MultiLineString)):
        for obj2 in obj.geoms:
            yield obj2
    elif isinstance(obj, (sg.Polygon)):
        yield sg.LineString(obj.exterior)
        for obj2 in obj.interiors:
            yield sg.LineString(obj2)
    elif isinstance(obj, (sg.MultiPolygon)):
        for obj2 in obj.geoms:
            yield sg.LineString(obj2.exterior)
            for obj3 in obj2.interiors:
                yield sg.LineString(obj3)
    else:
        try:
            tup = tuple(obj)
        except TypeError:
            raise TypeError('Could not use type %s' % type(obj))
        else:
            for obj2 in tup:
                for line in _line_iterator(obj2):
                    yield line 
开发者ID:airware,项目名称:buzzard,代码行数:26,代码来源:_footprint.py

示例2: test_cover_geometry_empty_geoms

# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import MultiLineString [as 别名]
def test_cover_geometry_empty_geoms(tiler):
    """Empty geometries should return empty iterators."""
    assert not cover_geometry(tiler, geometry.Point(), 0) == True
    assert not cover_geometry(tiler, geometry.Point(), [0, 1]) == True
    assert not cover_geometry(tiler, geometry.MultiPoint(), 0) == True
    assert not cover_geometry(tiler, geometry.MultiPoint(), [0, 1]) == True
    assert not cover_geometry(tiler, geometry.LineString(), 0) == True
    assert not cover_geometry(tiler, geometry.LineString(), [0, 1]) == True
    assert not cover_geometry(tiler, geometry.MultiLineString(), 0) == True
    assert not cover_geometry(tiler, geometry.MultiLineString(), [0, 1]) == True
    assert not cover_geometry(tiler, geometry.Polygon(), 0) == True
    assert not cover_geometry(tiler, geometry.Polygon(), [0, 1]) == True
    assert not cover_geometry(tiler, geometry.MultiPolygon(), 0) == True
    assert not cover_geometry(tiler, geometry.MultiPolygon(), [0, 1]) == True
    assert not cover_geometry(tiler, geometry.GeometryCollection(), 0) == True
    assert not cover_geometry(tiler, geometry.GeometryCollection(), [0, 1]) == True 
开发者ID:DigitalGlobe,项目名称:tiletanic,代码行数:18,代码来源:test_tilecover.py

示例3: test_cover_geometry_multilinestring2

# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import MultiLineString [as 别名]
def test_cover_geometry_multilinestring2(tiler, mls):
    """A MultiLineString geometry."""
    tiles = [tile for tile in cover_geometry(tiler, mls, 12)]
    assert len(tiles) == 47
    assert set(tiles) == {(2036, 1420, 12), (2036, 1421, 12), (2036, 1422, 12), (2036, 1423, 12),
                          (2036, 1424, 12), (2037, 1421, 12), (2037, 1422, 12), (2038, 1420, 12),
                          (2038, 1421, 12), (2038, 1422, 12), (2038, 1423, 12), (2038, 1424, 12),
                          (2039, 1420, 12), (2039, 1421, 12), (2039, 1422, 12), (2039, 1423, 12),
                          (2039, 1424, 12), (2040, 1420, 12), (2040, 1422, 12), (2040, 1424, 12),
                          (2041, 1420, 12), (2041, 1422, 12), (2041, 1424, 12), (2042, 1420, 12),
                          (2042, 1421, 12), (2042, 1422, 12), (2042, 1423, 12), (2042, 1424, 12),
                          (2043, 1420, 12), (2044, 1420, 12), (2044, 1421, 12), (2044, 1422, 12),
                          (2044, 1423, 12), (2044, 1424, 12), (2045, 1420, 12), (2046, 1420, 12),
                          (2046, 1421, 12), (2046, 1422, 12), (2046, 1423, 12), (2047, 1420, 12),
                          (2047, 1423, 12), (2047, 1424, 12), (2048, 1420, 12), (2048, 1421, 12),
                          (2048, 1422, 12), (2048, 1423, 12), (2048, 1424, 12)} 
开发者ID:DigitalGlobe,项目名称:tiletanic,代码行数:18,代码来源:test_tilecover.py

示例4: _round_multilinestring_coords

# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import MultiLineString [as 别名]
def _round_multilinestring_coords(mls, precision):
    """
    Round the coordinates of a shapely MultiLineString to some decimal precision.

    Parameters
    ----------
    mls : shapely.geometry.MultiLineString
        the MultiLineString to round the coordinates of
    precision : int
        decimal precision to round coordinates to

    Returns
    -------
    shapely.geometry.MultiLineString
    """
    return MultiLineString([_round_linestring_coords(ls, precision) for ls in mls]) 
开发者ID:gboeing,项目名称:osmnx,代码行数:18,代码来源:utils_geo.py

示例5: shapely_to_paths

# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import MultiLineString [as 别名]
def shapely_to_paths(g):
    if isinstance(g, geometry.Point):
        return []
    elif isinstance(g, geometry.LineString):
        return [list(g.coords)]
    elif isinstance(g, (geometry.MultiPoint, geometry.MultiLineString, geometry.MultiPolygon, geometry.collection.GeometryCollection)):
        paths = []
        for x in g:
            paths.extend(shapely_to_paths(x))
        return paths
    elif isinstance(g, geometry.Polygon):
        paths = []
        paths.append(list(g.exterior.coords))
        for interior in g.interiors:
            paths.extend(shapely_to_paths(interior))
        return paths
    else:
        raise Exception('unhandled shapely geometry: %s' % type(g)) 
开发者ID:fogleman,项目名称:axi,代码行数:20,代码来源:osm.py

示例6: _explode_lines

# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import MultiLineString [as 别名]
def _explode_lines(shape):
    """
    Return a list of LineStrings which make up the shape.
    """

    if shape.geom_type == 'LineString':
        return [shape]

    elif shape.geom_type == 'MultiLineString':
        return shape.geoms

    elif shape.geom_type == 'GeometryCollection':
        lines = []
        for geom in shape.geoms:
            lines.extend(_explode_lines(geom))
        return lines

    return [] 
开发者ID:tilezen,项目名称:tilequeue,代码行数:20,代码来源:rawr.py

示例7: to_shapely

# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import MultiLineString [as 别名]
def to_shapely(self):
        return geometry.MultiLineString(self.paths) 
开发者ID:fogleman,项目名称:xy,代码行数:4,代码来源:drawing.py

示例8: _get_flat_poly_iter

# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import MultiLineString [as 别名]
def _get_flat_poly_iter(cls, poly):
        if (isinstance(poly, shgeo.MultiPolygon) or
                isinstance(poly, shgeo.MultiLineString) or
                isinstance(poly, shgeo.GeometryCollection)):
            yield from poly
        else:
            yield poly 
开发者ID:ucb-art,项目名称:BAG_framework,代码行数:9,代码来源:template.py

示例9: multilinestring

# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import MultiLineString [as 别名]
def multilinestring():
    return geometry.MultiLineString([((0, 0), (1, 1)), ((-1, 0), (1, 0))]) 
开发者ID:fitodic,项目名称:centerline,代码行数:4,代码来源:conftest.py

示例10: test_creating_centerline_from_polygon_returns_centerline

# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import MultiLineString [as 别名]
def test_creating_centerline_from_polygon_returns_centerline(simple_polygon):
    centerline = Centerline(simple_polygon)
    assert isinstance(centerline, Centerline)
    assert isinstance(centerline, geometry.MultiLineString) 
开发者ID:fitodic,项目名称:centerline,代码行数:6,代码来源:test_geometry.py

示例11: test_creating_centerline_from_complex_polygon_returns_centerline

# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import MultiLineString [as 别名]
def test_creating_centerline_from_complex_polygon_returns_centerline(
    complex_polygon,
):
    centerline = Centerline(complex_polygon)

    assert isinstance(centerline, Centerline)
    assert isinstance(centerline, geometry.MultiLineString) 
开发者ID:fitodic,项目名称:centerline,代码行数:9,代码来源:test_geometry.py

示例12: test_creating_centerline_from_multipolygon_returns_centerline

# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import MultiLineString [as 别名]
def test_creating_centerline_from_multipolygon_returns_centerline(
    multipolygon,
):
    centerline = Centerline(multipolygon)
    assert isinstance(centerline, Centerline)
    assert isinstance(centerline, geometry.MultiLineString) 
开发者ID:fitodic,项目名称:centerline,代码行数:8,代码来源:test_geometry.py

示例13: test_creating_centerline_using_too_large_interp_dist_raises_runtimeerror

# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import MultiLineString [as 别名]
def test_creating_centerline_using_too_large_interp_dist_raises_runtimeerror(
    create_polygon,
):
    polygon = create_polygon(exterior=[[0, 0], [10, 0], [10, 10], [0, 10]])
    with pytest.raises(TooFewRidgesError):
        Centerline(polygon, 10)

    centerline = Centerline(polygon, 5)
    assert isinstance(centerline, Centerline)
    assert isinstance(centerline, geometry.MultiLineString) 
开发者ID:fitodic,项目名称:centerline,代码行数:12,代码来源:test_geometry.py

示例14: mls

# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import MultiLineString [as 别名]
def mls():
    return geometry.shape({'type': 'MultiLineString', 'coordinates': (((-0.9709167480468749, 35.18840002173177), (-0.9832763671875, 34.83296838321102), (-0.954437255859375, 35.02774729487063), (-0.850067138671875, 35.02662273458687), (-0.833587646484375, 34.838604318635014), (-0.8074951171874999, 35.185032937998294)), ((-0.0823974609375, 35.191766965947394), (-0.111236572265625, 34.83071390101431), (0.048065185546875, 34.829586636768205), (0.067291259765625, 35.192889249680945), (-0.06591796875, 35.191766965947394)), ((-0.28564453125, 35.19064466671118), (-0.34606933593749994, 34.84085858477277), (-0.18402099609375, 34.831841149828676)), ((-0.48614501953124994, 35.183910545750834), (-0.517730712890625, 34.854382885097905), (-0.391387939453125, 34.84874803007872)), ((-0.553436279296875, 35.183910545750834), (-0.7347106933593749, 35.185032937998294), (-0.751190185546875, 35.05922870088872), (-0.591888427734375, 35.0502352513963), (-0.758056640625, 35.03336986422378), (-0.767669677734375, 34.86227103378598), (-0.597381591796875, 34.85550980979319)))}) 
开发者ID:DigitalGlobe,项目名称:tiletanic,代码行数:4,代码来源:test_tilecover.py

示例15: test_cover_geometry_multilinestring1

# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import MultiLineString [as 别名]
def test_cover_geometry_multilinestring1(tiler, mls):
    """A MultiLineString geometry."""
    tiles = [tile for tile in cover_geometry(tiler, mls, 8)]
    assert len(tiles) == 4
    assert set(tiles) == {(127, 88, 8), (127, 89, 8), (128, 88, 8), (128, 89, 8)} 
开发者ID:DigitalGlobe,项目名称:tiletanic,代码行数:7,代码来源:test_tilecover.py


注:本文中的shapely.geometry.MultiLineString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。