I am trying to calculate hub distance for enumeration areas within a shapefile of a country using QGIS 2.18. The create hub distance in QGIS calculates this based on the distance to the nearest hub. As a result some hub lines cross over into another state from their original state. Is there any way I can do this without having having to create a shapefile for each of the states as they are more than 40 states in my shapefile.

  • Can you add some images showing what output you have now, and what you want the output to look like? – csk May 21 '18 at 19:04
  • In QGIS 3.0, the Distance to nearest hub tool has the option to use only selected features. So you could run the tool once for each state without having to create a separate shapefile for each state. – csk May 21 '18 at 19:20
  • @csk 40 would be about my limit of tediousness for manual processing - that would be the point where I'd probably write a python script to loop over states, select hubs and spoke points, and call the algorithm. – Spacedman May 22 '18 at 16:15
  • Another solution - compute all the hub-spoke point distances to create a big matrix of hub-id, spoke-id, distance, then load that into Excel or LibreOffice together with the database from the shapefiles and find the nearest hub in the same state for each spoke-id. Or use R. – Spacedman May 22 '18 at 16:17
  • I ended up creating a shapefile for each of the states. They are 37 in number. Now I need to calculate the distances from these Enumeration areas to a satellite location in each of the state. The challenge now is that the spokes are calculated as the crow flies and does not take into consideration rivers, difficult terrains and the like. Is there any automated way of going about this as I have have over 4,000 enumeration areas to map their distance (by road) to the satellite location in each state? – user118372 May 23 '18 at 14:49

Your Answer

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

Browse other questions tagged or ask your own question.