示例#1
0
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
示例#2
0
 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)
示例#3
0
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)