GIS is very useful in analyzing spatial relationship between features.It is important at times to find the features nearest to a feature in GIS.To achieve this, we can use the Distance Matrix that helps in calculating the distances between each point in the dataset.
You can use Vector > Analysis
Tools > Distance Matrix
, and a join to have an output layer that has all the required attributes.
I will use the Towns layer to exemplify. This will help in showing the distances and is quite small for faster processing.
1. Create a distance matrix using your layer as both destination and
Don't forget to tick "Use only the nearest (k) target points" and
set it to 1.
2. Open the CSV with add delimited text layer
|Distance Matrix window|
Choose "Comma" as a delimiter, and set the geometry definition as
|Loading a Comma Delimited layer|
3. Create a join in the
original layer with the newly created table
4. Use Field calculator to populate a field with the desired values
|Adding a join between two layers|
Because of the join, we now have access to the distance table values from
within the towns table of attributes, therefore it quite fairly easy to create
a new field and populate it with our desired values.
5. Grouping the generated town data.
|Populating fields with values|
We can now group the towns depending
on the distances between them. To do that, we write a function to classify the
|Classifying data in columns|
That was a brief task that is very useful when conducting GIS analysis.