6

I'm a complete noob to QGIS.

I am working with New Zealand Topo 1:50.000 data from LINZ. I have snow polygons and over them contour lines. Where the lines cross the polygons I want to change the colour of the contour lines from orange to blue.

i.e. Where the contours cross the permanent snow/ice polygons in the image below, the contour lines should be displayed in blue tones. As you can see below, they are in the default orange I assigned.

How do I achieve this?

Ruapehu Crater Lake

Taras
  • 32,823
  • 4
  • 66
  • 137
  • Good question! A style expression sounds like the way to go, but ONLY styling the pieces of geometry that are inside of the poly probably means you will need to geoprocess your data before hand, to split it into line segments that within each poly. Once you have individual pieces of geometry, a style expression will work much easier. Interested to see if other users have a more dynamic way of doing this. – nr_aus Sep 08 '20 at 04:29

1 Answers1

2

I think, you can use geometry generator in symbology.

Contour lines' structure should be like this; enter image description here

In geometry generator, geometry type will be linestring/multilinestring and expression is

intersection(collect($geometry),aggregate('poli','collect',$geometry,intersects($geometry,geometry(@parent))))

With this expression, geometry generator gets intersections.

This answer inspired me.

berkayoruc
  • 116
  • 6
  • Basically works but is very slow. I guess that's just the volume of contour data to process as there are far fewer snow polygons. – Carl Knight Sep 09 '20 at 05:54