from shapely import geometry
def if_inPoly(polygon, Points):
line = geometry.LineString(polygon)
point = geometry.Point(Points)
polygon = geometry.Polygon(line)
return polygon.contains(point)
square = [(0,0), (1,0), (1,1), (0,1)] #多边形坐标
pt1 = (2, 2) #点坐标
pt2 = (0.5, 0.5)
print(if_inPoly(square, pt1))
print(if_inPoly(square, pt2))