Example #1
0
		if nid <= 0:
			return 0
		else:
			return MAX_WEIGHT
	return cur.fetchone()['dist']

def load_segments(filename):
	with open(filename) as segfile:
		return json.load(segfile)["features"]
def load_stops(filename):
	with open(filename) as stopfile:
		return json.load(stopfile)

pidstops = load_stops("pidstops-out.json")
osmstops = load_stops("osmstops-out.json")
pidstops_by_id = {s['pid_id']:s for s in pidstops}


segs = load_segments(SEGMENTS_FILE)

paired = FeatureCollection()
for s in segs:
	if not s['properties']['L_BUS']:
		continue
	p = pair_segment(s)
	if p:
		paired.append(p)

with open("segments-paired.json","w") as out:
	paired.dump(out)