I am trying to create a layer style that shows line features that share the same geometry, an exploded view for line Features.

What I have done so far via the Offset expressions in QGIS 3.6

("Length"  -  "Length"  + rand(0,count('Cable_13260270_443e_46e6_9da1_39282a8c86d7',  intersects( $geometry ,@map_extent))))

This is the view with 'Single Line' with multiple Features sharing the same geometry: Single Line View

This is after style with Offset and expressions:

Exploded View

I had to add the "Length"-"Length" to force it to run the Expression for each Feature, if not I ended up with just 1 random number. Perhaps there is a better way?

The issue I am facing is that some of the random numbers repeat, which then hides the line Feature as they then share the exact Offset. I don't mind the changing views when the map changes, as it should based on how many lines are within the map extent. So in a 'busy' area there would be more Offsets and with only 1 line there would be None or just 1 Offset.

How can I make the Offset Expression pull from a list, such as 1,2,3... Array or string or how can the random number be set to non repeating?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.