add render() to LocationAnalyzer
parent
3c5e6c3ce3
commit
e59e1647ac
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -52,4 +52,7 @@ if __name__ == '__main__':
|
|||
break
|
||||
for analyzer in analyzers:
|
||||
print("* Result for " + str(type(analyzer)))
|
||||
print(analyzer.result())
|
||||
print(analyzer.result())
|
||||
coords = analyzers[0].render()
|
||||
with open("test.js", "w") as out:
|
||||
out.write("coords = "+coords)
|
||||
Loading…
Reference in New Issue