3

I have a layer with point geometry with a field STREETCODE that represents the entry number of each house. On the other hand, I have, a layer with line geometry with the field STREETCODE, representing the centerline axis of each street.

My objective is to use an expression to obtain a graphical representation to identify to which street axis each house entrance belongs.

For the demonstration I use a layer of line symbols from the Geometry Generator on my points layer:

shortest_line($geometry,aggregate('LINESTREETS','collect',$geometry))

When I test the expression it works fine for most cases. However, for some cases it would be necessary to force it to draw the shortest_line according to the STREETCODE = STREETCODE.

shortest lines issues on QGIS canvas

2
  • 3
    Something like : shortest_line($geometry, aggregate('LINESTREETS', 'collect', $geometry, "STREETCODE" = attribute(@parent, 'STREETCODE'))) ? May 3 at 9:00
  • 1
    Yes, I confirm that it works May 3 at 9:40

1 Answer 1

3

Solved from J. Monticolo comment:

shortest_line($geometry, aggregate('LINESTREETS', 'collect', $geometry, "STREETCODE" = attribute(@parent, 'STREETCODE')))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.