Created
September 21, 2024 00:51
-
-
Save darrenwiens/f00d57f68ee79a1bbccb48c9ebc0849f to your computer and use it in GitHub Desktop.
QGIS Geometry Generator for SimCity Style Bridges
This file contains hidden or 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
-- add this to a road LINE layer that also has | |
-- a geometry geometry applied that buffers it | |
-- by 1000m. That's wide, I know! | |
-- change the reference to your water layer below. | |
-- all layers must be in a projected crs. | |
collect_geometries( | |
array_foreach( | |
geometries_to_array( | |
intersection( | |
nodes_to_points( | |
densify_by_distance( | |
collect_geometries( | |
array_foreach( | |
geometries_to_array( | |
segments_to_lines( $geometry) | |
), | |
if( | |
line_interpolate_angle(@element, 100)>180 AND | |
line_interpolate_angle(@element, 100)<360, | |
offset_curve( @element, 1000), | |
offset_curve( @element, -1000) | |
) | |
) | |
), | |
2000 | |
) | |
), | |
collect_geometries( | |
overlay_intersects( | |
layer:= 'ADD_REFERENCE_TO_WATER_LAYER_HERE', | |
expression:= @geometry | |
) | |
) | |
) | |
), | |
make_line(@element, translate(@element, 0, -1000)) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment