本文整理匯總了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
示例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)
示例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)
示例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))