QGIS Algorithm provided by QGIS (native c++) Shortest line between features (native:shortestline). This algorithm creates a line layer as the shortest line between the source and the destination layer. By default only the first nearest feature of the destination layer is taken into account. The n-nearest neighboring features number can be specified. If a maximum distance is specified, then only features which are closer than this distance will be considered. The output features will contain all the source layer attributes, all the attributes from the n-nearest feature and the additional field of the distance. This algorithm uses purely Cartesian calculations for distance, and does not consider geodetic or ellipsoid properties when determining feature proximity. The measurement and output coordinate system is based on the coordinate system of the source layer.

qgis_shortestline(
  SOURCE = qgisprocess:::qgis_default_value(),
  DESTINATION = qgisprocess:::qgis_default_value(),
  METHOD = qgisprocess:::qgis_default_value(),
  NEIGHBORS = qgisprocess:::qgis_default_value(),
  DISTANCE = qgisprocess:::qgis_default_value(),
  OUTPUT = qgisprocess:::qgis_default_value(),
  ...,
  .complete_output = .complete_output_option(),
  .quiet = .quiet_option(),
  .messages = .message_option()
)

Arguments

SOURCE

source - Source layer. Path to a vector layer.

DESTINATION

source - Destination layer. Path to a vector layer.

METHOD

enum of ("Distance to Nearest Point on feature", "Distance to Feature Centroid") - Method. Number of selected option, e.g. '1'. Comma separated list of options, e.g. '1,3'.

NEIGHBORS

number - Maximum number of neighbors. A numeric value. field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field. expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression.

DISTANCE

distance - Maximum distance. A numeric value. field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field. expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression.

OUTPUT

sink - Shortest lines. Path for new vector layer.

...

further parameters passed to qgisprocess::qgis_run_algorithm()

.complete_output

logical specifying if complete out of qgisprocess::qgis_run_algorithm() should be used (TRUE) or first output (most likely the main) should read (FALSE). Default value is TRUE.

.quiet

logical specifying if parameter .quiet for qgisprocess::qgis_run_algorithm() Default value is TRUE.

.messages

logical specifying if messages from qgisprocess::qgis_run_algorithm() should be printed (TRUE) or not (FALSE). Default value is FALSE.

Details

Outputs description

  • OUTPUT - outputVector - Shortest lines