Improve osm map parsing

main
Bob Mottram 2022-06-16 11:54:58 +01:00
parent ac6d4f4f57
commit 86f0bf388e
1 changed files with 4 additions and 2 deletions

View File

@ -18,10 +18,12 @@ from utils import save_json
def _geocoords_from_osm_link(url: str, osm_domain: str) -> (int, float, float):
"""Returns geocoordinates from an OSM map link
"""
if osm_domain + '#map=' not in url:
if osm_domain not in url:
return None, None, None
if '#map=' not in url:
return None, None, None
coords_str = url.split(osm_domain + '#map=')[1]
coords_str = url.split('#map=')[1]
if '/' not in coords_str:
return None, None, None