我有两个GeoDataFrames-一个由多边形组成,一个由点组成。我想检查每个多边形中是否存在每个点。
两个GeoDataFrames看起来像这样:
多边形地理数据框:
0 (POLYGON ((533118.99658534 6115989.99792342, 5...
1 (POLYGON ((535928.18558342 6116449.18215799, 5...
2 (POLYGON ((582344.60979557 6360821.37795918, 5...
3 (POLYGON ((565979.84052407 6351844.48030166, 5...
4 (POLYGON ((563311.9635688 6349444.93872141, 56...
点地理数据框:
0 POINT (519065.09 6122281.5)
1 POINT (511065.09 6142281.5)
2 POINT (520065.09 6202281.5)
3 POINT (529065.09 6292281.5)
4 POINT (543065.09 6432281.5)
我尝试过
pointFrame['check'] = 'no'
for pt in pointFrame:
point = pt
for poly in polyFrame:
polygon = poly
if pointFrame[pt]['check'] == 'no':
if polygon.contains(point) == True:
pointFrame['check'] = 'yes'
else: pass
else: pass
我希望得到一个看起来像这样的点GeoDataFrame:
0 POINT (519065.09 6122281.5) 'yes'
1 POINT (511065.09 6142281.5) 'no'
2 POINT (520065.09 6202281.5) 'no'
3 POINT (529065.09 6292281.5) 'yes'
4 POINT (543065.09 6432281.5) 'yes'
有人可以向我指出正确的方向代码吗?