A QGIS-plugin for extracting the closest points from one layer to another.
QGIS does not have a simple function to get the closest points from one layer to another layer, although PyQGIS provides such a function. There are some workarounds for calculating the nearest points, but they are not very userfriendly. This plugin provides the missing function with familiar, QGIS-standard interfaces. The functions of the plugin are also available via the processing framework and the toolbox.
The plugin is available in the official plugin repository. After downloading and installing, it is located in the vector menu. It can be called from the toolbox and via the processing framework too.
The plugin offers mutliple functions, which are described in the following paragraphs.
This algorithm iterates over all features of one layer and calculates the closest point for each feature to a second layer. Only one point per input feature will be calculated.
This algorithm iterates over all features of an input layer and calculates the closest points from this features to each feature of a second layer. The count of the closest points will be the product of the feature counts of both layers.
The output will be a point layer and will has four columns:
- id - a unique id field
- from_fid - the fid of the feature to calculate the nearest point from
- to_fid - the fid of the feature to calculate the nearest point to
- distance - the shortest euclidean distance between the both features referenced by the fields from_id and to_id
The fields from_id and to_id can be used to create a join to the input layers.
The plugin calculates the euklidean distance, i.e. it is recommended to use metric coordinate systems.