From a3ae1eb330be5b05c746549fcefa4ed9b74191ac Mon Sep 17 00:00:00 2001 From: Al Date: Wed, 17 Aug 2016 15:29:59 -0400 Subject: [PATCH] [intersections] Adding a read classmethod to intersections to read the intermediate JSON file --- scripts/geodata/osm/intersections.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/geodata/osm/intersections.py b/scripts/geodata/osm/intersections.py index 3b5f4d89..c8b76575 100644 --- a/scripts/geodata/osm/intersections.py +++ b/scripts/geodata/osm/intersections.py @@ -156,6 +156,13 @@ class OSMIntersectionReader(object): 'ways': ways} out.write(json.dumps(d) + six.u('\n')) + @classmethod + def read_intersections(cls, infile): + f = open(infile) + for line in f: + data = json.loads(line.rstrip()) + yield data['id'], data['lat'], data['lon'], data['ways'] + if __name__ == '__main__': parser = argparse.ArgumentParser()