github-actions[bot] commited on
Commit
204c72a
·
1 Parent(s): 7649e08

Sync with https://github.com/mozilla-ai/osm-ai-helper

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  from pathlib import Path
2
  from shutil import move
3
 
@@ -98,13 +100,17 @@ def download_results(output_path):
98
  "\nYou can then import the file in [any of the supported editors](https://wiki.openstreetmap.org/wiki/OsmChange#Editors) format."
99
  )
100
 
101
- changeset = convert_polygons(
102
- results_dir=output_path / "keep",
 
 
 
 
103
  tags={"leisure": "swimming_pool", "access": "private", "location": "outdoor"},
104
  )
105
  st.download_button(
106
  label="Download all polygons in `keep`",
107
- data=changeset,
108
  file_name="exported_results.osc",
109
  mime="type/xml",
110
  )
 
1
+ import json
2
+ import xml.etree.ElementTree as ET
3
  from pathlib import Path
4
  from shutil import move
5
 
 
100
  "\nYou can then import the file in [any of the supported editors](https://wiki.openstreetmap.org/wiki/OsmChange#Editors) format."
101
  )
102
 
103
+ lon_lat_polygons = [
104
+ json.loads(result.read_text())
105
+ for result in (output_path / "keep").glob("*.json")
106
+ ]
107
+ osmchange = convert_polygons(
108
+ lon_lat_polygons=lon_lat_polygons,
109
  tags={"leisure": "swimming_pool", "access": "private", "location": "outdoor"},
110
  )
111
  st.download_button(
112
  label="Download all polygons in `keep`",
113
+ data=ET.tostring(osmchange, "utf-8"),
114
  file_name="exported_results.osc",
115
  mime="type/xml",
116
  )