def closestStation(): poi = request.args.get('poi') # Return Mock Data for Now if ("Bay" in poi): mock = { 'ID': 7041, 'Name': 'Edward St / Yonge St', 'Latitude': 43.65702, 'Longitude': -79.382249 } return jsonify(mock) else: mock = { 'ID': 7003, 'Name': 'College St / Borden', 'Latitude': 43.657, 'Longitude': -79.4056 } return jsonify(mock) # Real Function if poi is None: return render_template('error.html') station = returnNearestStation(poi) json = { 'ID': station[0], 'Name': station[1], 'Latitude': station[3], 'Longitude': station[4] } return jsonify(json)
def closestToHome(): station = returnNearestStation("45 Ulster, Toronto, ON") return "ID: " + station[0] + " Station: " + station[1]