是否有将坐标转换为创建圆形多边形的坐标列表的函数?
Is there a function to convert coordinates to a list of coordinates creating a circular polygon?
示例代码:
def circle_to_polygon(coordinates, radius, edge_count):
list = [[1,2],[3,4],[5,6],[7,8],[9,10]]
return list
基本上我需要围绕一组坐标创建一个具有特定半径的多边形
身材匀称 - https://shapely.readthedocs.io/en/stable/project.html ?
如果需要,您可以创建 point, add a buffer with a radius, take its exterior, control the edge count with simplification 或缓冲区参数,并获取坐标列表。
from shapely.geometry import Point
list(Point(5,5).buffer(1).exterior.simplify(0.05).coords)
[(6.0, 5.0),
(5.923879532511287, 4.61731656763491),
(5.707106781186548, 4.292893218813452),
(5.38268343236509, 4.076120467488713),
(5.0, 4.0),
(4.61731656763491, 4.076120467488713),
(4.292893218813452, 4.292893218813452),
(4.076120467488713, 4.61731656763491),
(4.0, 5.0),
(4.076120467488713, 5.38268343236509),
(4.292893218813452, 5.707106781186548),
(4.6173165676349095, 5.923879532511286),
(5.0, 6.0),
(5.38268343236509, 5.923879532511287),
(5.707106781186547, 5.707106781186548),
(5.923879532511286, 5.3826834323650905),
(6.0, 5.0)]
示例代码:
def circle_to_polygon(coordinates, radius, edge_count):
list = [[1,2],[3,4],[5,6],[7,8],[9,10]]
return list
基本上我需要围绕一组坐标创建一个具有特定半径的多边形
身材匀称 - https://shapely.readthedocs.io/en/stable/project.html ?
如果需要,您可以创建 point, add a buffer with a radius, take its exterior, control the edge count with simplification 或缓冲区参数,并获取坐标列表。
from shapely.geometry import Point
list(Point(5,5).buffer(1).exterior.simplify(0.05).coords)
[(6.0, 5.0),
(5.923879532511287, 4.61731656763491),
(5.707106781186548, 4.292893218813452),
(5.38268343236509, 4.076120467488713),
(5.0, 4.0),
(4.61731656763491, 4.076120467488713),
(4.292893218813452, 4.292893218813452),
(4.076120467488713, 4.61731656763491),
(4.0, 5.0),
(4.076120467488713, 5.38268343236509),
(4.292893218813452, 5.707106781186548),
(4.6173165676349095, 5.923879532511286),
(5.0, 6.0),
(5.38268343236509, 5.923879532511287),
(5.707106781186547, 5.707106781186548),
(5.923879532511286, 5.3826834323650905),
(6.0, 5.0)]