Hot answers tagged pgrouting
Perhaps there's a more elegant way, but the following query should work: with nearest_line as -- put the query to get the nearest line in a CTE -- use the CTE twice (select source, target from segment_table order by (ST_Distance_Sphere(ST_GeomFromText('POINT(lon lat)',4326) limit 1) select id from -- A union query to get the ...
I assume it's running into trouble when you try to route from one part on the network to another part which is disconnected due to closure (e.g. when link 58-47 is removed). Instead of removing these links, try to put their costs really high. That way, you will be able to identify those links which get disconnected by their high cost sums.
You can get the shortest route between two points using PostGIS with ST_Distance (if you want to know the distance) or with ST_MakeLine (for the geometry): http://postgis.net/docs/ST_Distance.html http://postgis.net/docs/ST_MakeLine.html If you want to use the network for routing, then you need a network topology. You could try something like pggraph, ...
I think you want to use pgr_drivingdistance, as per the documentation. To check what pgRouting functions are available (ie. to see if they installed correctly, you can run this query in the database with PGRouting installed: SELECT p.proname FROM pg_catalog.pg_namespace n JOIN pg_catalog.pg_proc p ON p.pronamespace = n.oid WHERE n.nspname = ...
Please make sure your database uses UTF-8 encoding. And it seems there is a bug? in Postgres 9.4 which does not occur in older versions. Now you'll also have to modify your client encoding for psql. Well, you are using 9.2, but it might be the same issue. http://dba.stackexchange.com/questions/71597/postgresql-set-default-psql-client-encoding
The <-> operator stands for "K-nearest-neighbor" (KNN) search, which does not support 3D but only 2D distances: http://postgis.net/docs/manual-dev/geometry_distance_knn.html From PostGIS 2.2 you can use <<->> for 3D distances, but that version is not released yet: http://postgis.net/docs/manual-dev/geometry_distance_centroid_nd.html KNN ...
Only top voted, non community-wiki answers of a minimum length are eligible