I've imported my data to database by osm2pgrouting. This tool created network topology which contains vertices and edges between them. Problem is when I need get route to specific point which is not corresponding with any vertices of my database. For example I added screen of my route where you can see that my route is longer as should be. Red dots are vertices generated by osm2pgrouting, and blue point is my required final point by coordinates: enter image description here

I select route with dijsktra algorithm:

SELECT * FROM pgr_dijkstra('
    SELECT gid AS id,
         cost_s AS cost,
         reverse_cost_s AS reverse_cost
        FROM ways',
    directed := true)e
    left join ways w on w.gid = e.edge
    order by e.seq

What is the best and simpliest way to cut it in same level as my required point. Geometry of my route is linestring which is composite of many points.

Is it possible to select some of the points which are nearest to my required point and cut line there?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.