I'm new to the pgRouting engine.

Is it possible to input my own data and get it restricted when I want to find the shortest path between points A and B?

For example I want to height and weight attributes for trucks routing to be restricted.

And how do I call it in code?

This is just a simple example which I have found in tutorial

(sql text, 
source_id integer,
target_id integer,    
directed boolean,    
has_reverse_cost boolean)
RETURNS SETOF path_result

Should I add it like this?

...maxweight double,
maxheight double...

Yes, it is possible. The sql text parameter is the query that will be used to select the segments that will be part of your network.

If there are segment that you do not want to use for routing in your table you can exclude them from routing by setting a where clause in this SQL parameter.

  • Also, the complete list of algorithms and functions are right here: github.com/pgRouting/pgrouting/blob/master/src/… – Fabien Ancelin Feb 9 '17 at 20:42
  • Thanks for utltra fast answer! One more question. Is it possible to show results of my work on my web page where I'm using Leaflet library? – bass Feb 9 '17 at 21:01
  • Yes, You will need to join your routing query result with your network table to fetch the route geometries and all the attribute you will want to show on the map. You will even be able to fetch the geometries as geojson which is really easy to read in javascript: postgis.net/docs/manual-dev/ST_AsGeoJSON.html – Fabien Ancelin Feb 9 '17 at 21:09
  • Once again You cleared up my mind. Thanks! Now I'm starting to work:) – bass Feb 9 '17 at 21:26

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.