def test_route(begin, end): network = load_network() router = Router(network) path = router.enroute(network.node(begin), network.node(end)) if path is None: print 'Cannot find path between %s and %s' % (begin, end) else: print path
def get(self): origin = self.request.get('origin') destination = self.request.get('destination') if origin is None or destination is None: self.send_json({'status': 'fail'}) else: router = Router(test_routing.load_network()) path = Path.as_geojson(router.enroute(origin, destination)) self.send_json(path)
def geojson_test(begin='Cuatro Caminos', end='Juanacatlan'): network = load_network() router = Router(network) path = router.enroute(network.node(begin), network.node(end)) print Path.as_geojson(path)