本文整理汇总了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))