如何在Python中围绕点创建偏移区域

2024-04-16 04:38:55 发布

您现在位置:Python中文网/ 问答频道 /正文

在shapefile中有一些点,我想在它们周围创建一个偏移区域。特别是,我要做的是:

import shapefile
sf = shapefile.Reader(path+'Data/One_Road_Segment/one_segment_road')
shapes = sf.shapes()
x = list()
y = list()
for i in range(0,len(shapes)):
    for j in range(0,len(shapes[i].points)):
        X = shapes[i].points[j][0]
        Y = shapes[i].points[j][1]
        x.append(X)
        y.append(Y)
plt.scatter(x,y)

这样我就有了下面的地图。你知道吗

enter image description here

我想做的是在这些点周围创建一个区域,以便将来检查其他点是否在该区域中。我想要以下的东西:

enter image description here


Tags: pathinimport区域fordatalenrange