added ability to specify path where to save geojson file

pull/10/head
tomasz t 2021-12-07 01:50:20 +01:00
rodzic e2131bebc1
commit 11c4154c44
1 zmienionych plików z 4 dodań i 1 usunięć

Wyświetl plik

@ -1,5 +1,6 @@
import requests
import json
import sys
def geojson_point_feature(lat: float, lon: float, properties: dict) -> dict:
@ -63,5 +64,7 @@ for element in elements:
geojson_point_feature(lat=latitude, lon=longitude, properties=tags)
)
with open(file='src/aed_poland.geojson', mode='w', encoding='utf-8') as f:
file_path = sys.argv[1] if len(sys.argv) == 2 else 'src/aed_poland.geojson'
with open(file=file_path, mode='w', encoding='utf-8') as f:
json.dump(geojson, f, allow_nan=False)