dijkstra (#16) - (#359) - Message List

 

Hi every one,

im doing a routing in roads, im using the nex sql:

SELECT asText(the_geom) as geom FROM dijkstra_sp('highway', 13747,13738);

for vertexs 13747 to 13738 it work fine but has more than one line that it dont be appear i put a img to see this.

http://204.232.135.228/ar/routing.jpg

please teach me how to remove that line or what sql function must be i use to do this fine.

thaks.

  • Message #1493

    Its other example, the correct routing must be the red, and the query make the black lines.

    what is wrong?

    http://204.232.135.228/ar/routing2.jpg

    • Message #1494

      The second example indeed looks very strange, but pgRouting usually only takes the network it has available. So I assume your network topology is wrong.

      You see there are a lot of roads close to each other, so I assume that your "snapping" tolerance when running the assign_vertex_id was too big and nearby vertexes were merged to one point.

      • Message #1495

        Daniel,

        thanks the code that im using is this:

        SELECT assign_vertex_id('highway', 0.001, 'the_geom', 'gid'); UPDATE victoria SET length = length(the_geom);

        i need to be more things to calculate the edges? im using part of OSM ERSI files to build the network topology maybe a missing one step or what i need to do in order to complete the structure.

        thanks a lot.

        • Message #1496

          I assume your geometry is a projection in degree units. In this case all vertexes closer than 0.001 degree will snap to one. If your data is good quality you can make this value even smaller. Try it once with 0.00001 for example and see if the result looks different.

          • Message #1497

            Daniel, im using degree units, and 0.00001 generate more edges but in some cases the edges dont return data but when it return the problem continue but less than after. when you said ÿour data is good quality" what do you mean? how do i build my road network in order to my short path work?

            please help me.

            thanks.

            • Message #1498

              You use OSM data, don't you? Some OSM mapper don't care much about a valid network when the add roads. Roads are not connected where they should be, but on the rendered map it looks OK.
              For that you can use this snapping tolerance. For example you would have a projection in meter you could set the the tolerance to 1(m) to connect road links that should be connected. Of course it can happen then that you connect roads that shouldn't be connected. But you won't be able to make defective data much better than it is.
              If you for example use Navteq data you should be able to assume that they care about a correct network topology.

              In your case it seems that the OSM road data is not so good, so you need to find a good value for the snapping tolerance.