Created
May 12, 2020 10:23
-
-
Save hamishcampbell/62d4fd39cc231dfcaf66b5390a12fe35 to your computer and use it in GitHub Desktop.
QGIS Geometry Generator expression to approximate rock outcroppings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with_variable( | |
'segment_len', | |
11, -- the length of each segment | |
collect_geometries( | |
array_foreach( | |
generate_series( | |
0, length(boundary($geometry)) - @segment_len, @segment_len | |
), | |
with_variable('offset_inner', | |
offset_curve( | |
make_line( | |
line_interpolate_point(boundary($geometry), @element), | |
line_interpolate_point(boundary($geometry), @element + @segment_len) | |
), | |
rand(1,11), -- range offset of the inner boundaries | |
1 | |
), | |
with_variable('offset_outer', | |
offset_curve( | |
make_line( | |
line_interpolate_point(boundary($geometry), @element), | |
line_interpolate_point(boundary($geometry), @element + @segment_len) | |
), | |
rand(12,30), -- range offset of the outer boundaries | |
1 | |
), | |
collect_geometries( | |
@offset_outer, | |
make_line( | |
start_point(@offset_inner), | |
start_point(@offset_outer) | |
), | |
make_line( | |
end_point(@offset_inner), | |
end_point(@offset_outer) | |
) | |
) | |
) | |
) | |
) | |
) | |
) |
Update: It was my version of QGIS in the end. Upgraded to 3.14 (I wish they'd use leading zeros) and it worked without issue. Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Been looking in to this again recently; and can't get this to render anything with the LINZ rock data in QGIS 3.2.3. Other than changing the geometry type to linestring is there something else I'm missing?