osm2pgrouting (#24) - some bugs (#163) - Message List

some bugs

First post so hi all and thanks for the work. Trying out osm2pgrouting and had a few problems:

Export2DB.cpp line 47 "connection failed". Commented out the function and uncommented the hard coded line, still had "connection failed". Removed the host and port details and it worked ok: mycon =PQconnectdb("user=postgres dbname=routing");

Next is the INSERT section around line 107 in Export2DB.cpp, void Export2DB::exportWay(Way* way) Getting errors like this in the logs: 2008-08-17 19:44:09 CEST ERROR: syntax error at or near "Ouest" at character 294 2008-08-17 19:44:09 CEST STATEMENT: INSERT into ways(gid, class_id, cost, x1, y1, x2, y2, the_geom, name) values(2127, (SELECT id FROM classes WHERE name ='residential'),0.07134268301878004,2.3169354,48.8347257,2.3161887,48.8343133,GeometryFromText?('MULTILINESTRING((2.3169354 48.8347257,2.3161887 48.8343133))', 4326),'Rue de l'Ouest'); Apparently the addslashes() function should work but has its problems, I'll have a go at it but will strip all ' characters from the .osm file if I can't get my head around it as the osm data seems to be in a bad state as regards routing and I'd like to give it a try before going to far. cheers

  • Message #564

    First of all - hi and thank you for the report.

    So far I always tried this with localhost. OK, I'll play around with remote connection to see what's wrong.

    As for quotation marks in name field, I'm going to replace single quotation mark with $$. So, the query should look like

    INSERT into ways(gid, class_id, cost, x1, y1, x2, y2, the_geom, name) values(2127, (SELECT id FROM classes WHERE name ='residential'),0.07134268301878004,2.3169354,48.8347257,2.3161887,48.8343133,GeometryFromText??('MULTILINESTRING((2.3169354 48.8347257,2.3161887 48.8343133))', 4326), $$Rue de l'Ouest$$);

    which should be OK.

    • Message #565

      Thanks for the reply. I'm running the db on localhost (tried '127.0.0.1', hadn't tried 'localhost'), have dumped the db and re-built it as a local user using an osm for all of Ireland (about 25 min on a 1ghz p3) and ran into a few issues with my postgresql instalation and passwords so the problem could well be entirely on my end. One other thing is coming up near th finish:

      2008-08-18 03:39:38 CEST ERROR: column "id" does not exist at character 8 2008-08-18 03:39:38 CEST STATEMENT: SELECT id AS id, PointN(the_geom, 1) AS source, PointN(the_geom, NumPoints?(the_geom)) as target FROM ways ORDER BY id;

      My knowledge of sql is limited to say the least but the id column isn't in ways so I'm guessing I have to create it and re-run the last few commands. Thinking of it as a great opportunity to learn more about sql :) Thanks for the reply, stan

      • Message #566

        Just use gid instead of id. It was id before, but I renamed that field.

        • Message #567

          That worked, made a big difference to the loading time ;) Tried it out and knocked together a script to create track files for gpsdrive. Interesting results, quite a bit of 'leave the motorway, drive through the housing estate, re-join the motorway' but hey, it did say 'shortest route' :) A lot of errors showed up in the osm data too, almost unusable for suburban routing but not too bad for bigger roads, I'm going to have to learn more about the algorithm and database setup.

          On that note I have a few plans on the db setup that I'd like some advice on. I'm focused on mapnik (for gpsdrive in this case) and the osm2pgsql app is very useful for loading the osm data for that. I'm looking at adding the osm2pgrouting functions to osm2pgsql (or vis versa) to have a mapnik db with routing capabilities (god help anyone trying to import the planet map :) ). Is this possible? I notice the lat-long data format is different, are there any issues there? Would it be simpler to modify osm2pgrouting to add the routing data to existing osm2pgsql generated data? Way to many question marks already, but any other thoughts? cheers, stan