不太清楚您实际上拥有哪种数据结构。另外,您所有的预期结果都是False,因此很难检查。假设使用GeoSeries和GeoDataframes,我可以这样做:
from shapely.geometry import Point, Polygonimport geopandaspolys = geopandas.GeoSeries({ 'foo': Polygon([(5, 5), (5, 13), (13, 13), (13, 5)]), 'bar': Polygon([(10, 10), (10, 15), (15, 15), (15, 10)]),})_pnts = [Point(3, 3), Point(8, 8), Point(11, 11)]pnts = geopandas.GeoDataframe(geometry=_pnts, index=['A', 'B', 'C'])pnts = pnts.assign(**{key: pnts.within(geom) for key, geom in polys.items()})print(pnts)这给了我:
geometry bar fooA POINT (3 3) False FalseB POINT (8 8) False TrueC POINT (11 11) True True



