I use the "Offset Point Symbol" tool and a geometry generator symbology to create dynamic leader lines. A sample file is available at http://hub.qgis.org/issues/15201 (Add snapping for 'Offset Point Symbol' tool).
Because I need a circle symbology without fill in some projects, I want to shorten the leader lines by the radius of the cirle symbology.
Can anyone help me with the expression? Symbology units are in meter ('Map units').
make_line (
make_point(
$x + regexp_substr("offset", '([^,]*)'),
$y - regexp_substr("offset", '([^,]*$)')
),
$geometry
)
Based on the answer posted by underdark I've created an expression that works properly:
-- radius = 2m
difference(
make_line (
make_point(
$x + regexp_substr("offset", '([^,]*)'),
$y - regexp_substr("offset", '([^,]*$)')
),
$geometry
),
buffer(make_point(
$x + regexp_substr("offset", '([^,]*)'),
$y - regexp_substr("offset", '([^,]*$)')
), 2)
)
Answer
Your requirements seem to be similar to the requirements I had for a flow map a while ago. To shorten the lines at the start and at the end, I used geometric difference functions as shown here:
difference(
difference(
$geometry,
buffer( start_point($geometry), 10000 )
),
buffer( end_point( $geometry), 10000 )
)
No comments:
Post a Comment