Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 am developing a few scripts in Python for QGIS 1.8 to automate some geo-tasks and one of them would be to calculate the shortest distance from a hospital to each building in a town.

I would like to take advantage of the already existing Qgis plugin but, as it is a C++ plugin, I am not sure whether it is possible to access it from Python? Is there a binding or a trick for that?

If not, any further advice would be appreciated! As the base data is OpenStreetMap data stored in a PostGIS DB, I may also try with pgRouting. But the Qgis plugin would be my favourite choice if possible.

Thanks in advance!

PS: this question is close to this one: Is there a way to access QGIS plugins in Python? but I believe it's still different enough to be worth a new thred.

share|improve this question
up vote 3 down vote accepted

gis-lab.info has a tutorial on using the network analysis library in QGIS using Python. It's not in English but Google Translate should be able to make it comprehensible. Good luck!

share|improve this answer
    
Thanks a lot, I will give it a try! – Stéphane Henriod May 1 '13 at 11:49
1  
The Google translation doesn't really help, cause it's a very poor translation. But using your examples of code, I somehow manage to get it through. спасибо – Stéphane Henriod May 2 '13 at 6:19
    
Btw, that wasn't my blog post. I just linked it. Glad to know it helped though. Did it answer your question? – R.K. May 2 '13 at 6:58
    
I'm still working on it but I think it did solve it yes, thx – Stéphane Henriod May 2 '13 at 11:39

There's a tutorial in the QGIS documentation, might help:

https://docs.qgis.org/2.2/en/docs/pyqgis_developer_cookbook/network_analysis.html

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

1  
Could you expand on this a little please.. at the moment the answer is a 'link only' which would be better as a comment. I understand you don't have enough reputation to leave a comment but would like to see a bit more information in an answer. – Michael Miles-Stimson May 26 at 23:57

Your Answer

 
discard

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.