dijkstra (#16) - Still problem with shortest_path_as_geometry_internal_id (#14) - Message List

Still problem with shortest_path_as_geometry_internal_id

Hello everybody,

I tried the whole weekend to get pgrouting running with my own data, but without success. It is really frustrating in the moment :-(

I would like to use the same function that is running with the kanagawa-example (also with that function: shortest_path_as_geometry_internal_id) but somehow it does not work.

I reduced my database. Now there are just 5 Multilinesegements in, see http:  http://www.selbstverwaltung-bundesweit.de/routing/routing_database.PNG

These 5 segements are connected, see:  http://www.selbstverwaltung-bundesweit.de/routing/routing_screenshot.PNG

In the file sp.html I set the bounding-box of the WHOLE map

........

else {

switch( sel ) {

case 1:

valX = 3430000; valY = 5790000; break;

case 2:

valX = 3440000; valY = 5800000; break;

......

I think these parameteres have no influence to the function "shortest_path_as_geometry_internal_id" (as fas as In can see in the sourcecode) ??

At the formular, to define start and endpoint, I use:

<form name="routing" method="get" action="sp.phtml">

<input type=hidden name="cx1" value=0> <input type=hidden name="cy1" value=0> <input type=hidden name="cx2" value=0> <input type=hidden name="cy2" value=0>

<select name=start onChange="changeVal(1);">

<option value=0 >Choose...</option> <option value=4949 >Punkt 1 OS</option> <option value=4954 >Punkt 2 OS</option>

</select> <br> <br> End_Point<br> <br> <select name=end onChange="changeVal(2)">

<option value=0 >Choose...</option> <option value=4949 >Punkt 1 OS</option> <option value=4954 >Punkt 2 OS</option>

...to grab the gid.

I checked it out with different coordinates, I changed the $delta-value, I tried with different gid, no success....

I loaded in the database the files "routing.sql" and "routing.postgis.sql" from out of the package pgRouting-0.9.8-0_win32 on Windows XP.

But I ALWAYS get an error message in that context:

Warning: Error: msPOSTGISLayerWhichShapes(): Error executing POSTGIS SQL statement (in FETCH ALL): DECLARE mycursor BINARY CURSOR FOR SELECT asbinary(force_collection(force_2d(the_geom)),'NDR'),gid::text from (select gid, the_geom from shortest_path_astar2_as_geometry_internal_id('fridastreets', 4949, 4954, 3428888.88889, 5790000, 3441111.11111, 5800000)) as g WHERE the_geom && setSRID('BOX3D(3428888.88888889 5790000,3441111.11111111 5800000)'::BOX3D, -1 ) -ERROR: Start vertex was not found. CONTEXT: PL/pgSQL function "shortest_path_astar2_as_geometry_internal_id_directed" line 47 at for over execute statement PL/pgSQL function "shortest_path_astar2_as_geometry_internal_id" line 21 at for over execute statement in C:\ms4w\Apache\htdocs\routing\phtmls\sp_os.phtml on line 80

You wrote, that the boundary box is set by two last parameters of shortest_path_astar2_as_geometry_internal_id. In that case it would be 3441111, 5800000, but if I change them the error still occurs. What can I do? Could it have something to do with the data? Thank you very much in advance.......

  • Message #50

    Kai,

    Don't worry, I will try your data today and I hope we will find a solution!

    • Message #51

      Ah, I see!

      Kai, you are using edges ids, but you should use source/target ids for function invocation.

      It should look like

      select * from shortest_path_astar2_as_geometry_internal_id('fridastreets', 1, 5, 3428888.88889, 5790000, 3441111.11111, 5800000);

      But I also don't like your dataset. You have two edges (4954, 4949) with same source and target (5,5 and 1,1) but with different coordinates. You would have a problem here :(

      • Message #52

        Hi anton, great!!! It worked!!! Thank you 1000 times, I`m going to write a tutorial about UMN and pgRouting. Hopefully (Maybe) in a couple of weeks this will be finished. I will sent it to this homepage, could be a help for other peoples.

        Best regards, Kai

        • Message #53

          That's a good idea! :)

  • Message #579

    Hi,

    I need tutorial about dijkstra algortm? like tutorial : http://www.selbstverwaltung-bundesweit.de/mapserver/tutorial_routing_mapserver.zip

    • Message #580

      You can follow Kai's tutorial, just replace A* function call with the function from here - http://pgrouting.postlbs.org/wiki/MapServerOutput.

      • Message #612

        Hi,

        I have problems about to show the name of roads that passed for short path in PgRouting? (I use pgRouting-1.02_pg-8.3.3)and coloured the location that passed for short path in PgRouting?(ex. public facilities)?

        Thank you...

        • Message #613

          It would help a lot if you could post how your query looks like as well as your table attributes.

          • Message #618

            I follow Kai's tutorial : : http://www.selbstverwaltung-bundesweit.de/mapserver/tutorial_routing_mapserver.zip, but in file phtml, especially at call the sql, I use : $sql="the_geom from (SELECT gid, the_geom from ".

            "dijkstra_sp('jalan',".$start.",".$end.")) as g using unique gid using srid=-1";

            for query : SELECT * FROM shortest_path('SELECT gid AS id, source::int4,

            target::int4, length::double precision AS cost,

            FROM jalan',3, 7, false, false);

            • Message #619

              Hi,

              What kind of problem do you have with street names? Can't select them from your database? Or is it a problem with rendering them with MapServer?

              • Message #620

                Hallo,

                The tutorial that I use only for drawing the short path without the name of roads that passed, so how to show the name of the roads that passed in short path in map with mapserver?

                • Message #626

                  I'm sorry but I can't help you much with Kai's tutorial either. If you speak German you could ask for it on the German Mapserver mailing list. I think Kai is reading this list and might be able to help you.

                • Message #623

                  Sorry, it looks like MapServer problem and I don't know much about it. Probably, Daniel can help.