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


Python polygon.orient方法代码示例

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


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

示例1: enforce_polygon_winding_order

# 需要导入模块: from shapely.geometry import polygon [as 别名]
# 或者: from shapely.geometry.polygon import orient [as 别名]
def enforce_polygon_winding_order(self, shape, y_coord_down, n_try):
        assert shape.type == 'Polygon'

        def fn(point):
            x, y = point
            return self._round(x), self._round(y)

        exterior = apply_map(fn, shape.exterior.coords)
        rings = None

        if len(shape.interiors) > 0:
            rings = [apply_map(fn, ring.coords) for ring in shape.interiors]

        sign = 1.0 if y_coord_down else -1.0
        oriented_shape = orient(Polygon(exterior, rings), sign=sign)
        oriented_shape = self.handle_shape_validity(
            oriented_shape, y_coord_down, n_try)
        return oriented_shape 
开发者ID:tilezen,项目名称:mapbox-vector-tile,代码行数:20,代码来源:encoder.py

示例2: _orient

# 需要导入模块: from shapely.geometry import polygon [as 别名]
# 或者: from shapely.geometry.polygon import orient [as 别名]
def _orient(shape):
    """
    The Shapely version of the orient function appears to only work on
    Polygons, and fails on MultiPolygons. This is a quick wrapper to allow
    orienting of either.
    """

    assert shape.geom_type in ('Polygon', 'MultiPolygon')

    if shape.geom_type == 'Polygon':
        return orient(shape)

    else:
        polys = []
        for geom in shape.geoms:
            polys.append(orient(geom))
        return MultiPolygon(polys) 
开发者ID:tilezen,项目名称:tilequeue,代码行数:19,代码来源:rawr.py

示例3: buffer

# 需要导入模块: from shapely.geometry import polygon [as 别名]
# 或者: from shapely.geometry.polygon import orient [as 别名]
def buffer(self, distance=None, join_style=2):
        # type: (Optional[float], Optional[int]) -> Polygon2D
        """Returns a representation of all points within a given distance of the polygon.

        :param join_style: The styles of joins between offset segments: 1 (round), 2 (mitre), and 3 (bevel).

        """
        s_poly = SPoly(self.vertices)
        core = orient(s_poly.buffer(distance=distance, join_style=join_style), sign=1.0)
        return Polygon2D(core.boundary.coords) 
开发者ID:jamiebull1,项目名称:geomeppy,代码行数:12,代码来源:polygons.py

示例4: _force_polygon_ccw

# 需要导入模块: from shapely.geometry import polygon [as 别名]
# 或者: from shapely.geometry.polygon import orient [as 别名]
def _force_polygon_ccw(geometry):
    polygon = shape(geometry)
    return mapping(orient(polygon)) 
开发者ID:OpenBounds,项目名称:Processing,代码行数:5,代码来源:fiona_dataset.py


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