'Flask Restful API nearest_node
I am trying to set up an API rest in Flask using inside osmnx and a function named nearest_node but doesn't work . The code I'm using is :
import networkx as nx
import osmnx as ox
from matplotlib import pyplot as plt
from flask import Flask
app = Flask(__name__)
G = ox.load_graphml('my.graphml')
orig_node = ox.distance.nearest_nodes(G,[40.670724], [16.597054])
dest_node = ox.distance.nearest_nodes(G,[40.669731], [16.606796])
@app.route('/')
def dijkstra():
route = nx.shortest_path(G,orig_node,dest_node,weight='length')
route_map = ox.plot_route_folium(G, route)
route_map.save('route.html')
return plt.show(route_map)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=9090)
I haven't sintax error but on my homepage site I can't see nothing . There is someone that can help me ? Max
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
