diff --git a/analyzer/analyzer.py b/analyzer/analyzer.py index 3319130..25ce8e5 100644 --- a/analyzer/analyzer.py +++ b/analyzer/analyzer.py @@ -1,3 +1,4 @@ +import json from collections import defaultdict from log_analyzer import LogSettings @@ -23,6 +24,11 @@ class LocationAnalyzer(Analyzer): def result(self) -> object: return self.entries + def render(self, format="geojson"): + if format is "geojson": + return json.dumps([entry['location']['coordinates'] for entry in self.entries]) + raise NotImplementedError() + def process(self, entry: dict) -> bool: if entry[self.settings.entry_type] in self.settings.spatials: self.entries.append(entry) diff --git a/log_analyzer.py b/log_analyzer.py index 005e9d6..0e80f02 100644 --- a/log_analyzer.py +++ b/log_analyzer.py @@ -52,4 +52,7 @@ if __name__ == '__main__': break for analyzer in analyzers: print("* Result for " + str(type(analyzer))) - print(analyzer.result()) \ No newline at end of file + print(analyzer.result()) + coords = analyzers[0].render() + with open("test.js", "w") as out: + out.write("coords = "+coords) \ No newline at end of file