Spaces:
Running
Running
Update disambiguation/disambiguate.py
Browse files
disambiguation/disambiguate.py
CHANGED
@@ -94,16 +94,20 @@ def get_coordinates_between(doc, ent, ase, level_1, level_2, level_3, midmid):
|
|
94 |
page = requests.get(request_url, headers=headers, verify=False)
|
95 |
|
96 |
|
97 |
-
request_url = 'https://nominatim.openstreetmap.org/search.php?q=' + ase + '&polygon_geojson=1&accept-language=en&format=jsonv2'
|
98 |
-
headers = {
|
99 |
-
|
100 |
-
}
|
101 |
-
page = requests.get(request_url, headers=headers, verify=False)
|
102 |
|
103 |
-
st.markdown('The IP of this Space is blocked by OpenStreetMap, we are fixing this issue. You can still interact with the second table at the first page.')
|
104 |
-
json_content = json.loads(page.content)
|
105 |
-
all_coordinates = json_content[0]['geojson']['coordinates'][0]
|
106 |
-
centroid = (float(json_content[0]['lon']), float(json_content[0]['lat']))
|
|
|
|
|
|
|
|
|
107 |
for p in all_coordinates:
|
108 |
p2 = (p[0], p[1])
|
109 |
angle = geoutil.calculate_bearing(centroid, p2)
|
|
|
94 |
page = requests.get(request_url, headers=headers, verify=False)
|
95 |
|
96 |
|
97 |
+
# request_url = 'https://nominatim.openstreetmap.org/search.php?q=' + ase + '&polygon_geojson=1&accept-language=en&format=jsonv2'
|
98 |
+
# headers = {
|
99 |
+
# "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3 Safari/605.1.15"
|
100 |
+
# }
|
101 |
+
# page = requests.get(request_url, headers=headers, verify=False)
|
102 |
|
103 |
+
# st.markdown('The IP of this Space is blocked by OpenStreetMap, we are fixing this issue. You can still interact with the second table at the first page.')
|
104 |
+
# json_content = json.loads(page.content)
|
105 |
+
# all_coordinates = json_content[0]['geojson']['coordinates'][0]
|
106 |
+
# centroid = (float(json_content[0]['lon']), float(json_content[0]['lat']))
|
107 |
+
|
108 |
+
res = call_backend(ase)
|
109 |
+
all_coordinates = res[0]
|
110 |
+
centroid = res[1]
|
111 |
for p in all_coordinates:
|
112 |
p2 = (p[0], p[1])
|
113 |
angle = geoutil.calculate_bearing(centroid, p2)
|