From 9ec3b2e9802289f710d515021be97d6e3a3d36df Mon Sep 17 00:00:00 2001 From: Ray Miller Date: Fri, 18 Jun 2021 11:56:16 +0100 Subject: [PATCH] Increase the search radius for cafe stops --- pkg/cafes/common.go | 5 ++++- scripts/summarizeRoutes.py | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 scripts/summarizeRoutes.py diff --git a/pkg/cafes/common.go b/pkg/cafes/common.go index e2f21bc..d059b09 100644 --- a/pkg/cafes/common.go +++ b/pkg/cafes/common.go @@ -9,6 +9,9 @@ import ( "github.com/dhconnelly/rtreego" ) +// Size (in metres) of the bounding box around a stop +const stopRectangleSize = 500 + type RefreshmentStop struct { Name string Url string @@ -18,7 +21,7 @@ type RefreshmentStop struct { func (s *RefreshmentStop) Bounds() *rtreego.Rect { p := rtreego.Point{s.Easting, s.Northing} - return p.ToRect(100) + return p.ToRect(stopRectangleSize) } func (s *RefreshmentStop) Contains(p rtreego.Point) bool { diff --git a/scripts/summarizeRoutes.py b/scripts/summarizeRoutes.py new file mode 100644 index 0000000..c18bd4f --- /dev/null +++ b/scripts/summarizeRoutes.py @@ -0,0 +1,21 @@ +#!/usr/bin/python3 + +import csv +import sys + +path = sys.argv[1] + +with open(path) as f: + r = csv.reader(f) + skip = True + for x in r: + if skip: + skip = False + continue + coffee = x[7].strip() + lunch = x[8].strip() + tea = x[9].strip() + if coffee and tea: + print(coffee + ", " + lunch + ", " + tea) + +