QGIS Algorithm provided by QGIS (native c++) Random points on lines (native:randompointsonlines). pThis algorithm creates a point layer, with points placed randomly on the lines of the iInput line layer/i. The default behavior is that the generated point features inherit the attributes of the line feature on which they were was generated./ppParameters / options:/p ul liFor each feature in the ibInput line layer/b/i, the algorithm attempts to add the specified ibNumber of points for each feature/b/i to the output layer./li liA ibMinimum distance between points/b/i and a ibGlobal minimum distance between points/b/i can be specified. A point will not be added if there is an already generated point within this (Euclidean) distance from the generated location. With iMinimum distance between points/i, only points on the same line feature are considered, while for iGlobal minimum distance between points/i all previously generated points are considered. If the iGlobal minimum distance between points/i is set larger than the (local) iMinimum distance between points/i, the latter has no effect.br If the iMinimum distance between points/i is too large, it may not be possible to generate the specified iNumber of points for each feature/i./li liThe ibMaximum number of attempts per point/b/i is only relevant if iMinimum distance between points/i or iGlobal minimum distance between points/i is greater than 0. The total number of points will bebr bnumber of input features/b * bNumber of points for each feature/ibr if there are no misses and all features have proper geometries./li liThe seed for the random generator can be provided (iRandom seed/i - integer, greater than 0)./li liThe user can choose not to ibInclude line feature attributes/b/i in the generated point features./li /ul pOutput from the algorithm:/p ul li A point layer containing the random points (codeOUTPUT/code)./li li The number of generated features (codePOINTS_GENERATED/code)./li li The number of missed points (codePOINTS_MISSED/code)./li li The number of features with non-empty geometry and missing points (codeLINES_WITH_MISSED_POINTS/code)./li li The number of features with an empty or no geometry (codeLINES_WITH_EMPTY_OR_NO_GEOMETRY/code)./li /ul

qgis_randompointsonlines(
  INPUT = qgisprocess:::qgis_default_value(),
  POINTS_NUMBER = qgisprocess:::qgis_default_value(),
  MIN_DISTANCE = qgisprocess:::qgis_default_value(),
  MIN_DISTANCE_GLOBAL = qgisprocess:::qgis_default_value(),
  MAX_TRIES_PER_POINT = qgisprocess:::qgis_default_value(),
  SEED = qgisprocess:::qgis_default_value(),
  INCLUDE_LINE_ATTRIBUTES = qgisprocess:::qgis_default_value(),
  OUTPUT = qgisprocess:::qgis_default_value(),
  ...,
  .complete_output = .complete_output_option(),
  .quiet = .quiet_option(),
  .messages = .message_option()
)

Arguments

INPUT

source - Input line layer. Path to a vector layer.

POINTS_NUMBER

number - Number of points for each feature. 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.

MIN_DISTANCE

distance - Minimum distance between points. 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.

MIN_DISTANCE_GLOBAL

distance - Global minimum distance between points. 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.

MAX_TRIES_PER_POINT

number - Maximum number of search attempts (for Min. dist. 0). 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.

SEED

number - Random seed. 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.

INCLUDE_LINE_ATTRIBUTES

boolean - Include line attributes. 1 for true/yes. 0 for false/no. 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 - Random points on 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

  • FEATURES_WITH_EMPTY_OR_NO_GEOMETRY - outputNumber - Number of features with empty or no geometry

  • LINES_WITH_MISSED_POINTS - outputNumber - Number of features with missed points

  • OUTPUT - outputVector - Random points on lines

  • OUTPUT_POINTS - outputNumber - Total number of points generated

  • POINTS_MISSED - outputNumber - Number of missed points