I used the following commands (in qgis console) to get the shortest path with astar algorithm. But the result shows just '[]' every time. Why was that? Please help me to find a solution to this problem.
>>> import networkx as nx
>>> G = nx.read_shp(str(iface.mapCanvas().currentLayer().source()))
>>> route = nx.shortest_path(G, G.nodes()[1], G.nodes()[10])
[]
>>> route = nx.shortest_path(G, G.nodes()[20], G.nodes()[30])
[]
--
Visit the InaSAFE project page at http://inasafe.org
Let us know of any issues you encounter at: https://github.com/AIFDR/inasafe/issues
---
You received this message because you are subscribed to the Google Groups "inasafe-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to inasafe-user...@googlegroups.com.
To post to this group, send email to inasaf...@googlegroups.com.
Visit this group at http://groups.google.com/group/inasafe-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/inasafe-users/b33795da-abe8-45ee-b464-8ed330f1b619%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

shortest_path/astar_path) but it always shows, 'no path found' for me. Then I tried using networkx (in qgis console and in code too), and found that it returns nothing. Why is that ? Is that a problem with networkx or my layer?Hi,
I tried that tutorial.Here I wanted to use the A* algorithm since it finds the shortest path avoiding obstacles. I coded the algorithm (without using the direct command-shortest_path/astar_path) but it always shows, 'no path found' for me. Then I tried using networkx (in qgis console and in code too), and found that it returns nothing. Why is that ? Is that a problem with networkx or my layer?
Thank You
On Saturday, May 31, 2014 9:15:11 AM UTC+5:30, Kasun Ramanayake wrote:I used the following commands (in qgis console) to get the shortest path with astar algorithm. But the result shows just '[]' every time. Why was that? Please help me to find a solution to this problem.
>>> import networkx as nx >>> G = nx.read_shp(str(iface.mapCanvas().currentLayer().source())) >>> route = nx.shortest_path(G, G.nodes()[1], G.nodes()[10]) [] >>> route = nx.shortest_path(G, G.nodes()[20], G.nodes()[30]) []
--
Visit the InaSAFE project page at http://inasafe.org
Let us know of any issues you encounter at: https://github.com/AIFDR/inasafe/issues
---
You received this message because you are subscribed to the Google Groups "inasafe-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to inasafe-user...@googlegroups.com.
To post to this group, send email to inasaf...@googlegroups.com.
Visit this group at http://groups.google.com/group/inasafe-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/inasafe-users/296f3bb1-eb5e-4171-b320-4e0efaafc9c2%40googlegroups.com.

--
Visit the InaSAFE project page at http://inasafe.org
Let us know of any issues you encounter at: https://github.com/AIFDR/inasafe/issues
---
You received this message because you are subscribed to the Google Groups "inasafe-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to inasafe-user...@googlegroups.com.
To post to this group, send email to inasaf...@googlegroups.com.
Visit this group at http://groups.google.com/group/inasafe-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/inasafe-users/b0965f16-9393-40a5-9407-86c6ff97b751%40googlegroups.com.
Hi,
I used that code earlier. It worked for me too. But I wanted to use astar algorithm, which finds path by avoiding obstacles.That's why I thought to use networkx. By the way, I found that I can make a new layer by using Geoprocessing tools->difference option. So that I can remove the obstacles or impassable ares on map.Then I could use these algorithms to find a path on new layer. Is there a way to access those Geoprocessing tools in my code?
To view this discussion on the web visit https://groups.google.com/d/msgid/inasafe-users/77818193-f093-4f5f-afad-f6a26bf4cf7c%40googlegroups.com.