本文整理汇总了Python中shapely.geometry.Polygon.__str__方法的典型用法代码示例。如果您正苦于以下问题:Python Polygon.__str__方法的具体用法?Python Polygon.__str__怎么用?Python Polygon.__str__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shapely.geometry.Polygon
的用法示例。
在下文中一共展示了Polygon.__str__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: uniform_random_sampling_with_distance_constraint
# 需要导入模块: from shapely.geometry import Polygon [as 别名]
# 或者: from shapely.geometry.Polygon import __str__ [as 别名]
def uniform_random_sampling_with_distance_constraint(self, sample_count, min_distance):
u"""
Perform sampling by substituting the source polygon with uniformly
distributed and randomized points that are separated from each other by the
given minimum distance.
"""
self.samples = list()
self.triangulate()
self.constrain_triangulation()
buffered_zone = Polygon()
while len(self.samples) < sample_count:
wr = weighted_random_sub(map(attrgetter('area'), self.triangles))
triangle = self.triangles[wr]
sp = self.create_point_in_triangle(triangle)
if buffered_zone.contains(sp):
continue
sp_buffer = sp.buffer(min_distance)
buffered_zone = buffered_zone.union(sp_buffer)
self.samples.append(sp)
else:
open(r"d:\tmp\buf.txt", 'wb').write(buffered_zone.__str__())