我对以下输出感到困惑:
>>> from shapely.geometry import Polygon, MultiPolygon, mapping
>>> p1 = Polygon([(0,0), (0, 1), (1, 1), (1, 0)])
>>> p2 = Polygon([(0,0), (0, 1), (1, 1), (1, 2)])
>>> mapping(MultiPolygon([p1, p2]).convex_hull)
{'type': 'Polygon', 'coordinates': (((0.0, 0.0), (0.0, 1.0), (1.0, 2.0), (1.0, 0.0), (0.0, 0.0)),)}
>>> mapping(MultiPolygon([MultiPolygon([p1, p2])]).convex_hull)
{'type': 'Polygon', 'coordinates': (((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0), (0.0, 0.0)),)}
我假设如果给我一个MultiPolygon作为输入,则MultiPolygon将返回相同(不一定是相同)的对象。所以我期望
((((0.0,0.0),(0.0,1.0),(1.0,2.0),(1.0,0.0),(0.0,0.0)),)
to而不是返回的输出。