【问题标题】:TopologicalError: The operation 'GEOSDifference_r' could not be performed拓扑错误:无法执行操作“GEOSDifference_r”
【发布时间】:2020-01-08 08:03:21
【问题描述】:

我正在尝试一些代码来获取巴塞罗那的建筑足迹:

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 版本,但似乎不是问题。 我该如何解决这个问题?

【问题讨论】:

    标签: python-3.x topology osmnx


    【解决方案1】:

    解决方案发布在以下 github 存储库中:

    https://github.com/gboeing/osmnx/blob/5176d4a2f86fd2adaf523d3d9bd0bed9b9b1d6ec/osmnx/footprints.py

    您应该使用更新的代码更改footprints.py 文件。 为此,您可以: -打开osmnx包中的文件粘贴,删除其内容并复制更新的内容,

    -或者新建一个文件,然后在osmnx包粘贴中替换。

    【讨论】:

      猜你喜欢
      • 2021-01-05
      • 1970-01-01
      • 2016-11-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-20
      • 2016-04-16
      相关资源
      最近更新 更多