Skip to main content
added 7 characters in body
Source Link
Babel
  • 74.9k
  • 15
  • 87
  • 227

You can use overlay_nearest() function that has an optional filter condition. The filter is a bit tricky, but you can use a variable @value based on the attribute value and than introduce it into the filter condition by concatenating it as a string and than convert it back to a function with eval().

Red arrowheads show the direction in whicht points are connected: 7 is linked to 5 and 5 to 7; 11 is linked to 7, too ("outgoing"), but 11 has no "incoming" connection: enter image description here

You can use the expression with Geometry Generator (for visualization) or Geometry by Expression (for actual lines) - see here for differences.

The expression looks like this: you can freely change the percentage in line 3. Be sure to introduce the name of your point layer in line 11:

with_variable(
    'percentage',
    50,  -- change this value
    make_line (
        $geometry,
        with_variable (
            'value',
            value,
            eval(
                'overlay_nearest (
                    ''points'',   -- change to the name of your points layer
                    $geometry,
                    limit:=11,
                    filter:="value">=' || (@value/100*@percentage100*(100-@percentage)) || ' and "value" <=' || (@value* @value * (100+@percentage)/100 ) || ')'
            )
        )[1]
    )
)

You can use overlay_nearest() function that has an optional filter condition. The filter is a bit tricky, but you can use a variable @value based on the attribute value and than introduce it into the filter condition by concatenating it as a string and than convert it back to a function with eval().

Red arrowheads show the direction in whicht points are connected: 7 is linked to 5 and 5 to 7; 11 is linked to 7, too ("outgoing"), but 11 has no "incoming" connection: enter image description here

You can use the expression with Geometry Generator (for visualization) or Geometry by Expression (for actual lines) - see here for differences.

The expression looks like this: you can freely change the percentage in line 3. Be sure to introduce the name of your point layer in line 11:

with_variable(
    'percentage',
    50,  -- change this value
    make_line (
        $geometry,
        with_variable (
            'value',
            value,
            eval(
                'overlay_nearest (
                    ''points'',   -- change to the name of your points layer
                    $geometry,
                    limit:=11,
                    filter:="value">=' || (@value/100*@percentage) || ' and "value" <=' || (@value* (100+@percentage)/100 ) || ')'
            )
        )[1]
    )
)

You can use overlay_nearest() function that has an optional filter condition. The filter is a bit tricky, but you can use a variable @value based on the attribute value and than introduce it into the filter condition by concatenating it as a string and than convert it back to a function with eval().

Red arrowheads show the direction in whicht points are connected: 7 is linked to 5 and 5 to 7; 11 is linked to 7, too ("outgoing"), but 11 has no "incoming" connection: enter image description here

You can use the expression with Geometry Generator (for visualization) or Geometry by Expression (for actual lines) - see here for differences.

The expression looks like this: you can freely change the percentage in line 3. Be sure to introduce the name of your point layer in line 11:

with_variable(
    'percentage',
    50,  -- change this value
    make_line (
        $geometry,
        with_variable (
            'value',
            value,
            eval(
                'overlay_nearest (
                    ''points'',   -- change to the name of your points layer
                    $geometry,
                    limit:=11,
                    filter:="value">=' || (@value/100*(100-@percentage)) || ' and "value" <=' || ( @value * (100+@percentage)/100) || ')'
            )
        )[1]
    )
)
added 403 characters in body
Source Link
Babel
  • 74.9k
  • 15
  • 87
  • 227

You can use overlay_nearest()overlay_nearest() function that has an optional filter condition. The filter is a bit tricky, but you can use a variable @value based on the attribute value and than introduce it into the filter condition by concatenating it as a string and than convert it back to a function with eval()eval().

Red arrowheads show the direction in whicht points are connected: 7 is linked to 5 and 5 to 7; 11 is linked to 7, too ("outgoing"), but 11 has no "incoming" connection: enter image description here

You can use the expression with Geometry Generator or Geometry Geometry Generator (for visualization) by expressionor Geometry by Expression (for actual lines) - see here for differencessee here for differences.

The expression looks like this: you can freely change the percentage in line 3. Be sure to introduce the name of your point layer in line 11:

with_variable(
    'percentage',
    50,  -- change this value
    make_line (
        $geometry,
        with_variable (
            'value',
            value,
            eval(
                'overlay_nearest (
                    ''points'',   -- change to the name of your points layer
                    $geometry,
                    limit:=11,
                    filter:="value">=' || (@value/100*@percentage) || ' and "value" <=' || (@value* (100+@percentage)/100 ) || ')'
            )
        )[1]
    )
)

You can use overlay_nearest() function that has an optional filter condition. The filter is a bit tricky, but you can use a variable @value based on the attribute value and than introduce it into the filter condition by concatenating it as a string and than convert it back to a function with eval().

You can use the expression with Geometry Generator or Geometry (for visualization) by expression (for actual lines) - see here for differences.

The expression looks like this: you can freely change the percentage in line 3. Be sure to introduce the name of your point layer in line 11:

with_variable(
    'percentage',
    50,  -- change this value
    make_line (
        $geometry,
        with_variable (
            'value',
            value,
            eval(
                'overlay_nearest (
                    ''points'',   -- change to the name of your points layer
                    $geometry,
                    limit:=11,
                    filter:="value">=' || (@value/100*@percentage) || ' and "value" <=' || (@value* (100+@percentage)/100 ) || ')'
            )
        )[1]
    )
)

You can use overlay_nearest() function that has an optional filter condition. The filter is a bit tricky, but you can use a variable @value based on the attribute value and than introduce it into the filter condition by concatenating it as a string and than convert it back to a function with eval().

Red arrowheads show the direction in whicht points are connected: 7 is linked to 5 and 5 to 7; 11 is linked to 7, too ("outgoing"), but 11 has no "incoming" connection: enter image description here

You can use the expression with Geometry Generator (for visualization) or Geometry by Expression (for actual lines) - see here for differences.

The expression looks like this: you can freely change the percentage in line 3. Be sure to introduce the name of your point layer in line 11:

with_variable(
    'percentage',
    50,  -- change this value
    make_line (
        $geometry,
        with_variable (
            'value',
            value,
            eval(
                'overlay_nearest (
                    ''points'',   -- change to the name of your points layer
                    $geometry,
                    limit:=11,
                    filter:="value">=' || (@value/100*@percentage) || ' and "value" <=' || (@value* (100+@percentage)/100 ) || ')'
            )
        )[1]
    )
)
Source Link
Babel
  • 74.9k
  • 15
  • 87
  • 227

You can use overlay_nearest() function that has an optional filter condition. The filter is a bit tricky, but you can use a variable @value based on the attribute value and than introduce it into the filter condition by concatenating it as a string and than convert it back to a function with eval().

You can use the expression with Geometry Generator or Geometry (for visualization) by expression (for actual lines) - see here for differences.

The expression looks like this: you can freely change the percentage in line 3. Be sure to introduce the name of your point layer in line 11:

with_variable(
    'percentage',
    50,  -- change this value
    make_line (
        $geometry,
        with_variable (
            'value',
            value,
            eval(
                'overlay_nearest (
                    ''points'',   -- change to the name of your points layer
                    $geometry,
                    limit:=11,
                    filter:="value">=' || (@value/100*@percentage) || ' and "value" <=' || (@value* (100+@percentage)/100 ) || ')'
            )
        )[1]
    )
)