0

I have osm data network that I make but in the country of the data there are so many routes is maintenance so distance is wrong how can I out something or boolean in column is_maintenance = true and it will only calculate routes from the other routes which is not is_maintenance = true

SELECT path_id, the_geom 
FROM pgr_ksp('
    SELECT gid as id, source, target, cost, reverse_cost
    FROM network
    WHERE is_maintenance = false', 
    ( 
        SELECT source 
        FROM network 
        ORDER BY the_geom <-> ST_SetSRID(St_point (0.0, 0.0), 4326)
        LIMIT 1
    ), 
    ( 
        SELECT target 
        FROM network 
        ORDER BY the_geom <-> ST_SetSRID(st_point (0.0, 0.0), 4326)
        LIMIT 1
    ),
    1, 
    false
) AS di
JOIN network pt ON (di.edge = pt.gid)
ORDER BY path_id, path_seq;
Daniel Demonceau
  • 178
  • 3
  • 11
BKSO
  • 23
  • 1
  • 5
  • 1
    The second and the third parameters in the `pgr_KSP` function must be the source and the target specified in the SQL query in the first parameter. In your example, the source and the target are the same and are the closest point to the 0,0 coordinate. Is that what you want to do? Also, You don't need to specify `reverse_cost` if you have `directed` set to false. Please have a look here on how to use the function and for examples: https://docs.pgrouting.org/3.0/en/pgr_KSP.html – Daniel Demonceau Oct 11 '20 at 06:24
  • Thank you so much but what I'm looking for is maintenance osm data isn't updated to the data region is it should be so I'm trying to do it myself anyway for that? (To make specific route under maintenance) – BKSO Oct 11 '20 at 13:20
  • If you know what route is under maintenance, you can update it in the osm extract you have (`UPDATE network SET is_maintenance = WHERE gid =`). You can also update it in OSM using the portal as data are editable – Daniel Demonceau Oct 12 '20 at 06:31

0 Answers0