代码适合矩形或者多边形是不是和另一个多边形有重叠
from shapely.geometry import Point, LineString from shapely.geometry import Polygon,MultiPoint #多边形 import matplotlib.pyplot as plt point = Point(4, 4) poly1 =Polygon([(0, 0), (1,1),(2, 0), (2, 2), (0, 2)]) poly = Polygon([(0, 0), (2,2),(3, 0), (3, 3), (0, 3)]) print(poly.area) print(poly.intersects(poly1)) ax = plt.gca() #获取到当前坐标轴信息 ax.xaxis.set_ticks_position('top') #将X坐标轴移到上面 ax.invert_yaxis() #反转Y坐标轴 plt.plot(*poly.exterior.xy) plt.plot(*poly1.exterior.xy) plt.show()