Wednesday 21 September 2016

pyqgis - Computing distance between two points following network and doing it for 100.000 points?


My starting data :



  • a collection of points which are buildings

  • a collection of points which are electrical transformation plant

  • a network of vectors which is the public electric network from an operator

  • buildings are not connected to the electric network


I use QGIS to find which are the buildings which are located less than 250 meters from an electrical transformation plant by following the network. I need this information more 100.000 buildings.


To do it by hand :




  • trace a line between the building and the nearest electrical network segment,

  • compute the distance by the network between this entry point and the nearest tranformation plant. I have found the RoadGraph plugin (http://gis-lab.info/qa/road-graph-eng.html) which works for that

  • add the two distances and check if < 250m.


Now, my question is: how to automatize it for the 99.999 other buildings ? I know Python a lot but I am a beginner with QGIS. I did not find a way to automatically interact with the RoadGraph plugin and source code seems not to be available anymore.


Maybe I am doing it wrong ?


what it looks like




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