4

I have 2 different point layers that I want to use as origins (Company offices) and a separate layer with 500+ points in it (Client Stores) I also have a road network layer.

For each of the 500+ stores I would like to have a field in the attribute table showing the distance along the road network back to each of the Offices.

I currently use QGIS.

  • Welcome to gis.stackexchange! Please note that a good question on this site is expected to show some degree of research on your part, i.e. what you have tried and - if applicable - code so far. For more info, you can check our faq. – underdark Oct 4 '16 at 17:16
3

There are a large number of potential answers to this question, but for a QGIS only solution, I would look at using the net functions in Grass, which should be accessible if you install Grass 7 (you may already have it). Please note you may encounter a bug where the path to your Grass 7 files is not properly defined - to fix this just go to Processing->Options->Providers->Grass GIS 7 commands and then set the folder correctly.

Have a look here - you can get to this function by looking for v.net.path in the processing toolbox (Ctrl-Alt-T if it's not on).

Then define your road network (you will need to have a point layer for nodes and a line layer split at these nodes) and tolerances (how far each link can be away from the node to be considered part of the network). There will be some work to do depending on how your dataset is organised, but you could also look at v.net to see if that can help.

Then you can define the routes you want to calculate in a json file which apparently has to be in the format id start_point_x start_point_y end_point_x end_point_y. You then pass this to "Name of file containing start and end points" parameter in the Grass tool and hopefully you will have some results. More likely you will have problems along the way, but at least this might point you in the right direction.

Other options not involving QGIS include pgRouting (based on postgis / postgres), spatialite_network or graphopper. There are of course commercial offerings as well, which will most likely be slightly easier to use for you.

  • Hi' I've tried your exact suggestion, using a JSON file with those headings, example (UTM coordinates): [ { "id": 0, "start_point_x": 902378, "start_point_y": 9369919, "end_point_x": 902061, "end_point_y": 9369880 }, { "id": 1, "start_point_x": 902350, "start_point_y": 9369817, "end_point_x": 902061, "end_point_y": 9369880 },... But the output I get is empty. The log says 'Wrong input format' for each of of the JSON entries. Could it be that it accepts something other than JSON? I wasn't able to find anything in the documentation. – 15Step Dec 11 '17 at 16:26
  • I don't think it accepts JSON, I just think you add space-delimited text in that format, so your string would be: 0 902378 9369919 902061 9369880 \n 1 [etc..] – Stev_k Dec 12 '17 at 0:02
  • That actually worked! To be specific, with a tab-delimited file (Simply copy-pasted from CSV file to a .txt. file. Thanks @Stev_k! – 15Step Dec 12 '17 at 8:37
  • @15Step glad to hear it. You can always upvote the answer if you feel so inclined! – Stev_k Dec 17 '17 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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