我正在尝试一些代码来获取巴塞罗那的建筑足迹:
import osmnx as ox
import matplotlib.pyplot as plt
%matplotlib inline
place_name = "Barcelona, Barcelona, Catalonia, Spain"
graph = ox.graph_from_place(place_name)
buildings = ox.footprints_from_place(place_name)
当我运行代码时,它会产生以下错误消息:
TopologicalError: The operation 'GEOSDifference_r' could not be performed. Likely cause is invalidity of the geometry <shapely.geometry.polygon.Polygon object at 0x00000262079B6550>
我试过更新 OSMnx 版本,但似乎不是问题。我该如何解决这个问题?