3

Using QGIS, I have two shapefiles:

  • points representing enterprises (about 50k)
  • points representing towers (about 300)

For each enterprise, I need to figure out the three closest towers and their distances in meters.

Is there a script I can run that can calculate this? Or do I need to use the field calculator/select by location tool?

4

To complement the other answer of using Distance Matrix Tool, a worked example is included. For instance, if you have your two point shapefiles loaded as follows (entreprises and towers loaded - nb sample data generated for example): enter image description here

Then open the Distance Matrix tool (Vector --> Analsyis Tools --> Distance Matrix) as follows. First, select the entreprises as your input and specify the unique id for each entreprise feature. Your towers will be the target layer and you can then specify the nearest neighbours as 3:

enter image description here

If it completes successfully, a new point shap file will be loaded to the canvas with the distance results stored between the 3 nearest points: enter image description here

|improve this answer|||||
1

Distance Matrix tool. Input 1 is the enterprise, input 2 is the towers.

|improve this answer|||||
  • Though technically correct, your answer lacks depth. In the future, please add some more details when answer, maybe even a screenshot. – Erik Nov 8 '19 at 11:54

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.