我是osm新手。目前我正在嘗試使用 python 中的 osmnx 包檢索多個城市的建筑多邊形。代碼:place = "Kuala Lumpur, Malaysia"graph = ox.footprints.footprints_from_place(place, footprint_type='building')graph.head()效果很好。但是,如果我想獲得另一個狀態,它會返回錯誤。(如果我想在國家/地區級別檢索它,結果也是相同的 - 在本例中 - place =“馬來西亞”)place = "Selangor, Malaysia"graph = ox.footprints.footprints_from_place(place, footprint_type='building')graph.head()---------------------------------------------------------------------------ValueError Traceback (most recent call last)<ipython-input-20-9e3439b6fc4c> in <module>() 1 place = "Selangor, Malaysia"----> 2 graph = ox.footprints.footprints_from_place(place, footprint_type='building') 3 4 graph.head()5 frames/usr/local/lib/python3.6/dist-packages/shapely/geometry/multipolygon.py in geos_multipolygon_from_polygons(arg) 175 # no implicit flattening. 176 if isinstance(obs[0], MultiPolygon):--> 177 raise ValueError("Sequences of multi-polygons are not valid arguments") 178 179 exemplar = obs[0]ValueError: Sequences of multi-polygons are not valid arguments有人能幫我嗎?謝謝
1 回答

Cats萌萌
TA貢獻1805條經驗 獲得超9個贊
看起來 OSMnx 的footprints
模塊沒有正確處理或忽略復雜(并且可能無效?)的多多邊形幾何形狀。請注意,我們正在努力用更強大、更健壯、更通用的模塊來取代footprints
和模塊。同時,我相信您可以使用如下模塊實現您的目標:pois
geometries
pois
import osmnx as ox
ox.config(use_cache=True, log_console=True)
place = 'Selangor, Malaysia'
gdf = ox.pois_from_place(place, tags={'building': True})
gdf.shape? # (47516, 390)
添加回答
舉報
0/150
提交
取消