當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。