Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to make working pgrouting 2 but no luck. Generally it is working but routing table is completely wrong.

I did import osm database using osm2po():

java -Xmx1024m -jar osm2po-core-4.7.7-signed.jar cmd=tjsp prefix=cr tileSize=x czech-republic-latest.osm.pbf

Then i import result sql into postgres table with enabled pgrouting. After that i renamed "id" to "gid" and "geom_way" to "the_geom".

After that i locate start and end point ID's which match what i want ( when i select result GID from cr_2po_4pgr it match extactly the street i'm looking for.

Then i run this:

SELECT seq, id1 AS node, id2 AS to, cost
FROM pgr_astar (
    'SELECT gid as id, source, target, cost, x1, y1,x2, y2 FROM cr_2po_4pgr', $start, $end, false, false
);

where $start and $end is gid of starting and ending street. Result route is completely useless, look like random jumps over maps, visiting streets and cities which are over 200km from start/destionation points.

I assume that "to" field is gid from cr_2po_4pgr or i'm i wrong ?

share|improve this question
    
I add osm2po database into qgis to visualize it and it look like start and destination points are completely wrong. What is correct intput to $start, $end in my previous SQL ? id of record( in this case GID ) or something from the_geom field ? –  Matus Aug 13 '13 at 16:05
    
This is new SQL i use in qgis: SELECT a.seq, a.id1 AS node, a.id2 AS to, a.cost, cr_2po_4pgr.the_geom FROM pgr_bdAstar ('SELECT gid as id, source, target, cost, x1, y1,x2, y2 FROM cr_2po_4pgr', 70385, 8267, false, false) as a left join cr_2po_4pgr on a.id2 = cr_2po_4pgr.gid; –  Matus Aug 13 '13 at 16:11
    
$start and $end are vertices (source and target) not streets. –  Carsten Aug 14 '13 at 19:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.