Wednesday 22 April 2015

postgresql - Correct routing on osm2po table


What is the best way to use routing table generated by osm2po? When I apply osm2po on my *.osm.pbf file, the generated table looks like this:


enter image description here



Here is my routing script:


SELECT d.seq, d.path_seq, d.edge, d.cost, h.osm_name, h.kmh, h.x1, h.y1, h.x2, h.y2, h.geom_way  FROM pgr_dijkstra('
SELECT id,
source,
target,
cost,
reverse_cost
FROM hh_2po_4pgr',
(select source from hh_2po_4pgr h order by st_makepoint(h.x1, h.y1) <-> (select st_makepoint(lon, lat) from fnc_geocode('my source address')) limit 1),
(select target from hh_2po_4pgr h order by st_makepoint(h.x2, h.y2) <-> (select st_makepoint(lon, lat) from fnc_geocode('my target address')) limit 1),

directed := false) d
left join hh_2po_4pgr h on d.edge = h.id

When I display route in Geoserver target is not correct, as you can see on the picture: enter image description here


Can you tell me what I am doing wrong? I need my route to end on the blue point. I am using osm2po 5.1.0. Function fnc_geocode('xxx'). It has a function that returns coordinates of the entered address. With osm2pgrouting it works fine. Now we have more data, so this is the reason why I decided to use the osm2po tool instead.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...