Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
pveigadecamargo committed Feb 8, 2024
1 parent 121e41d commit 979b157
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions aequilibrae/project/network/osm/osm_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ def doWork(self):
self.__emit_all(["Value", len(self.polygons)])
self.__emit_all(["text", "Downloading finished. Processing data"])
for lst, table in [(self._links, "links"), (self._nodes, "nodes")]:
df = pd.concat(lst, ignore_index=True).drop_duplicates(subset=["id"]).drop(columns=["type"])
df = pd.DataFrame([])
if len(lst) > 0:
df = pd.concat(lst, ignore_index=True).drop_duplicates(subset=["id"]).drop(columns=["type"])
if table != "links":
df = df.drop(columns=["tags"], errors="ignore")
self.data[table] = df.rename(columns={"id": "osm_id"})
self.data[table] = df.rename(columns={"id": "osm_id"}, errors="ignore")
lst.clear()
gc.collect()

Expand Down
2 changes: 1 addition & 1 deletion tests/aequilibrae/project/test_osm_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_do_work2(self):
o = OSMDownloader([box(-112.185, 36.59, -112.179, 36.60)], ["car"])
o.doWork()

if "elements" not in o.json[0]:
if len(o.json) == 0 or "elements" not in o.json[0]:
return

if len(o.json[0]["elements"]) > 1000:
Expand Down

0 comments on commit 979b157

Please sign in to comment.