Monday 3 July 2017

postgis - How to route between lat/lon pairs in pgRouting?


I have set up Postgresql, PostGIS and pgrouting on Ubuntu. I have imported an osm for wales using the following command:


./osm2pgrouting -file wales.osm \
-conf mapconfig.xml \
-dbname routing \

-user postgres \
-clean

All I now want to do is execute something to give me the fastest route between 2 Latitude/Longitude points.


Start: 51.499954,-3.571651
End: 53.386809,-4.445

The route has to be in the format of a series of latitude/longitude positions that make up the route.


Is this even possible? If not, what would it take to make it possible.


If it is possible, what sql do I need to execute?



I have been looking everywhere for an answer to no avail.


Further to Steve Horn's recommendation. I have now managed to get 5000 points coming back using this sql:


SELECT gid, AsText(the_geom) AS the_geom FROM dijkstra_sp('ways', 15522, 26857);


However, the points all seem to be ignoring the road type. (When I run it using Google Directions, the route mainly follows the main roads). What have I done wrong?




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...