From 4c9fbbeaf1a53f02035bb2df15fdff715e3a3591 Mon Sep 17 00:00:00 2001 From: Ian Dees Date: Fri, 1 Sep 2023 10:21:44 -0500 Subject: [PATCH] Fix iterating over geojson-ld --- openaddr/slippymap.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/openaddr/slippymap.py b/openaddr/slippymap.py index 98e03574..eba1ad27 100644 --- a/openaddr/slippymap.py +++ b/openaddr/slippymap.py @@ -61,9 +61,18 @@ def iterate_file_features(filename): open_file = open(filename, 'r') elif suffix == '.zip': open_file = open(filename, 'rb') + elif suffix == '.geojson': + open_file = open(filename, 'r') + else: + raise ValueError('Unknown file type: {}'.format(filename)) with open_file as file: - if suffix == '.csv': + if suffix == '.geojson': + for line in file: + feature = json.loads(line) + yield feature + return + elif suffix == '.csv': csv_file = file elif suffix == '.zip': zip = ZipFile(file)