From c7828f34a682e229d846d411ded6785fb77ad190 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 8 Nov 2022 12:14:58 +0000 Subject: [PATCH] jsontogeojson: write meta file to disk Helpful for https://github.com/Open-Telecoms-Data/cove-ofds/issues/6 --- cove_ofds/process.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cove_ofds/process.py b/cove_ofds/process.py index a632dac..1ab69fa 100644 --- a/cove_ofds/process.py +++ b/cove_ofds/process.py @@ -231,9 +231,13 @@ def __init__(self, supplied_data): self.spans_file_name = os.path.join( self.supplied_data.data_dir(), "spans.geo.json" ) + self.meta_file_name = os.path.join( + self.supplied_data.data_dir(), "geojson.meta.json" + ) def process(self, process_data: dict) -> dict: - # TODO if original format this, don't bother + # TODO if original format is geojson, don't bother? or do bother? + # because maybe we'll need the meta files for the map? if os.path.exists(self.nodes_file_name): return process_data @@ -250,6 +254,9 @@ def process(self, process_data: dict) -> dict: with open(self.spans_file_name, "w") as fp: json.dump(converter.get_spans_geojson(), fp, indent=4) + with open(self.meta_file_name, "w") as fp: + json.dump(converter.get_meta_json(), fp, indent=4) + return process_data def get_context(self):