From 11c4154c44fd130425780a522bdab5cbfe387a06 Mon Sep 17 00:00:00 2001 From: tomasz t Date: Tue, 7 Dec 2021 01:50:20 +0100 Subject: [PATCH] added ability to specify path where to save geojson file --- src/download_data.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/download_data.py b/src/download_data.py index 366032d..b42d66a 100644 --- a/src/download_data.py +++ b/src/download_data.py @@ -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)