Thats my ways.shp file. I loaded this to PostgreSQL DB using PostGIS shape file loader. I ran pgr_anlayzeGraph() on it and found it had a lot of isolated segments.

Next I ran pgr_nodeNetwork() to create a new table 'ways_ways'. I made the topology for it and ran the following query in Qgis sql window.

 SELECT * FROM ways_ways JOIN (SELECT seq, id1 AS node, id2 AS edge, cost FROM 
pgr_astar('SELECT id, source, target, cost, x1, y1, x2, y2 FROM ways_ways', 
1, 108, false, false) )AS route ON ways_ways.id = route.node;

Given below are the screenshots: Original floorplan and the prescribed route 1 query ouput 2

Clearly , I don't have a continuous output. I ran pgr_analyseGraph on ways_ways to find that it has no more isolated segments . It has 51 deadends, which is acceptable.

  1. Did I miss any step in pgrouting?
  2. Is there anyway to see which node has id 1 and id 108 in qgis?
  3. i ran the same query in another map(which i downloaded) and got output for all possible source and target ids. So how can i create a way(a route) that is completely noded?

Your network is not routable. For a routable network, you have to split/break all edges where they intersect. Otherwise pgrouting cannot create a usable topology. This also explains why you got the error about isolated segments.

enter image description here

Possible solutions to split edges include: Split edges at intersections in PostGIS or How to clean such a bad shapefile for routing? (especially v.clean break).

  • how can i break the edges? – 0aslam0 Mar 10 '14 at 18:41
  • 1
    After 2 weeks of agony, I have successfully implemented pgrouting on my map. Thanks a lot underdark. All i had to do was open my shp file in GRASS GUI and use the v.clean option to break the segments and export it as a new shpfile. – 0aslam0 Mar 11 '14 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.