pysal.explore.spaghetti.snap_points_on_segments

pysal.explore.spaghetti.snap_points_on_segments(points, segments)[源代码]

将点放在一组分段中的壁橱分段上

参数:
points : 双关语

以点ID为键,以(x,y)坐标为值

segments : 列表

元素的类型为pysal.lib.cg.shapes.chain**注意**每个元素都是一个段,表示为具有 one head and one tail node 换句话说,只有一个链接。

返回:
p2s : 双关语

键[点ID(见参数中的点)];值[两元组((头、尾)、点),其中(头、尾)是目标段,点是段上的捕捉位置。

实例

>>> import pysal.explore.spaghetti as spgh
>>> from pysal.lib.cg.shapes import Point, Chain
>>> points = {0: Point((1,1))}
>>> segments = [Chain([Point((0,0)), Point((2,0))])]
>>> spgh.util.snap_points_on_segments(points, segments)
{0: ([(0.0, 0.0), (2.0, 0.0)], array([1., 0.]))}