Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have 2 vector shapefiles (one line, one point), and I have tried at least 4 ways to try to get the distance matrix at one time (and most concern the directions of each river segment)

  1. quantum navigator
  2. GRASS tool -
  3. pgrouting
  4. roadgraph plugin

In the end I think that roadgraph plugin is the one which is the closest to my goal, and it also can set the directions of the river, but I can't modify it to get the distances between all pairs of points(and I want to get this in matrix form).

What/How could I do? Is there any other way to get this distance matrix on qgis?

share|improve this question
up vote 1 down vote accepted

Currently there is no purely QGIS-based solution for this problem.

I think your best bet to create a distance matrix is to use pgRouting. You said you tried it. Why didn't it work for you?

share|improve this answer
After following your guide in, I was stuck in the "Creating a routable road network" state, I open my postgis manager in QGIS, the metadata zone shows some details like connection details, privileges, and PostGIS, but right below the PostGIS label shows "PostGIS support not enabled".If I try loading data to PostGIS directly, I would see the error:Something's wrong:["'shp2pgsql' \xa4\xa3\xacO\xa4\xba\xb3\xa1\xa9\xce\xa5~\xb3\xa1\xa9R\xa5O\xa1B\xa5i\xb0\xf5\x‌​a6\xe6\xaa\xba\xb5{\xa6\xa1\xa9\xce\xa7\xe5\xa6\xb8\xc0\xc9\xa1C\n"] – Heinz Mar 25 '13 at 8:58
@user15633 Sounds like the database is not PostGIS enabled. Did you install PostGIS and create a database that contains the necessary spatial classes and functions? If not, that should be a different question. – underdark Mar 25 '13 at 9:25
thank you, I would try your method later, but I have one question:can pgrouting handle the problem of direction?I mean if point A is downstream to point B in the same stream network, I would like to get the distance from B to A but no A to B, cuz the flow itself would not go from A to B. – Heinz Mar 25 '13 at 9:44
recently I have tried GRASS module to achieve the goal, but I think it's much more efficient using pgRouting to get the distance matrix – Heinz Feb 24 '14 at 14:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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