【发布时间】:2016-08-13 07:07:16
【问题描述】:
我正在尝试从 Shapely 中的多面体中提取多边形。我可以使用来自 Shapely 的 MultiPolygon 将多边形列表转换为多面体。
>>> Multi = MultiPolygon([shape(pol['geometry']) for pol in fiona.open('data.shp')])
还有,
>>> Multi.wkt
'MULTIPOLYGON (((249744.2315302934148349 142798.1643468967231456, 250113.7910872535139788 142132.9571443685272243, 250062.6213024436729029 141973.7622582934272941, 249607.7787708004761953 141757.7120557629095856, 249367.7742475979903247 142304.6840291862317827, 249367.7742475979903247 142304.6840291862317827, 249744.2315302934148349 142798.1643468967231456)),
((249175.7899173096520826 142292.5352640640921891, 249367.7742475979903247 142304.6840291862317827, 249607.7787708004761953 141757.7120557629095856, 249014.4539607730694115 141876.1348429077770561, 249175.7899173096520826 142292.5352640640921891)))'
有谁知道我怎样才能扭转这个过程,即给定一个多面体,我怎样才能将它转换为单独的多边形?
【问题讨论】:
-
你试过
polygons = [polygon for polygon in Multi]吗? -
我尝试了您的解决方案,但出现此错误
TypeError: string indices must be integers。你有想法吗?