Monday, December 15, 2014

How to find the distance from multiple points to a single location QGIS with Hub Distance

The following tutorial will review the process of calculating the distance between multiple data points in QGIS utilizing the Hub Distance analysis with the MMQGIS plugin. 
                                                                              


The Canada boundary map was obtained from NaturalEarthIf you have not downloaded the MMQGIS plugin previously, you can find the steps outlined in the previous tutorial.

Here we have geocoded locations for all my family across Canada. Next we'll begin the distance hub analysis to find the distance from Vancouver and Ottawa to our final destination of Toronto.

To begin select the MMQGIS tab, then Create and Hub Distance from the tools available.


You will be prompted to select you source points (in this cause the family point locations in Ottawa and Vancouver) and your destination point (in this cause home which will be Toronto). For Hub Layer Name Attribute I selected the Name column from our point data. For Output Shape Type I chose Line to Hub to easily visualize the line path used for the distance calculation. Being Canadian I selected Kilometers for Measurement Unit; however, there are may different units available, as seen below. You will specify the name of the output shapefile in your working directory. 



The resulting line shapefile demonstrates the distance analysis from Vancouver and Ottawa to our hub Toronto. More importantly we can also find the distance from point to point in the attribute table.

To access the attribute table, select the hub.shp layer and Open Attribute Table.

Then resulting attribute table provides the HubDist variable which is the distance from each point to the hub selected, as seen below.

Hope this was helpful and forward any questions to qgis.tutorial@gmail.com

3 comments:

  1. Hello! I follow the steps mentioned here but I don't get the same results. It shows this message: UnboundLocalError: local variable 'hubdist' referenced before assignment ....
    I have 2 layers, both shapefiles and in same CRS. So I cannot think of any reason why this is happening.

    How can I go about this?? I hope you can give some light about this. Thanks!


    ReplyDelete
  2. I adore each of the threads, I just relished, I have actually like way more advice utilizing this, since it happens to be particularly fulfilling., Be thankful for rendering. distance calculator UK

    ReplyDelete
  3. Excellent information on your blog, thank you for taking the time to share with us. Amazing insight you have on this, it's nice to find a website that details so much information about different artists. benzinkostenrechner

    ReplyDelete