Shorten leader-line for labels with geometry-generatorTake color from other layer with data-override/expressionCreating leader lines for moved labelsMulti-line labels position and guidelineQGIS 3 Line connecting point to label issue - can not get line to align with label in desired placeHow to change label anchor point - QGIS 3Connect multipart polygon with lines to one labelGeometry Generator - make line to polygon perimiterQGIS geometry generator for marker line

Assembly of PCBs containing a mix of SMT and thru-hole parts?

Subverting the emotional woman and stoic man trope

How do my husband and I get over our fear of having another difficult baby?

Convert a string of digits from words to an integer

How to prevent pickpocketing in busy bars?

Would you write key signatures for non-conventional scales?

Lost passport which have valid student visa but I make new passport unable paste

Does the caster know when a spell with a variable duration ends?

How to realistically describe pain?

One-digit products in a row of numbers

Beyond Futuristic Technology for an Alien Warship?

Do interval ratios take overtones into account or solely the fundamental frequency?

Received a package but didn't order it

What is Weapon Handling?

Two side-by-side squares are inscribed in a semicircle. The diameter of the semicircle is 16. What is the sum of the two squares' areas?

"until mine is on tight" is a idiom?

Does the app TikTok violate trademark?

Smallest number containing the first 11 primes as sub-strings

Is there a concept of "peer review" in Rabbinical Judaism?

My manager quit. Should I agree to defer wage increase to accommodate budget concerns?

Are fuzzy sets appreciated by OR community?

How do we know neutrons have no charge?

What would influence an alien race to map their planet in a way other than the traditional map of the Earth

What happens to a net with the Returning Weapon artificer infusion after it hits?



Shorten leader-line for labels with geometry-generator


Take color from other layer with data-override/expressionCreating leader lines for moved labelsMulti-line labels position and guidelineQGIS 3 Line connecting point to label issue - can not get line to align with label in desired placeHow to change label anchor point - QGIS 3Connect multipart polygon with lines to one labelGeometry Generator - make line to polygon perimiterQGIS geometry generator for marker line






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















QGIS 3.8, Win 10. I have labels that are connected with the points they represent with a leader-line. The line is generated with geometry generator (going from the point-layer to the position where I placed the labels manually):



make_line(make_point($x,$y), make_point( "auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony" ))


The line sometimes continues below the label. How is it possible to shorten the line so that it stops when it touches the label? I tried to mask it with text-buffers. However, this is not an option here (see the link to see why). Changing horizontal/vertical alignement is also no option since I have labels clockwise around a circle - so if it would fix the problem for some of the labels, the problem would consist on the opposit site.



I tried the expression extend with negative value, but it seems it accepts only positive values, making the line longer. I look for a function that is a counterpart-expression (someting like shorten) - how to achieve this?



enter image description here










share|improve this question


























  • It's not a direct answer - but qgis 3.10 includes native callout support which doesn't suffer this issue.

    – ndawson
    8 hours ago











  • You can try something like this: difference(make_line(make_point($x,$y), buffer(make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony",0.001)))) modify 0.001 based on your needs.

    – ahmadhanb
    8 hours ago











  • @ahmadhanb: the expression does not work. I guess it is because the syntax of make_line expects two points - with buffer(), you don't get a point, but the buffer of a point (thus something like a polygon, I guess)?

    – babel
    8 hours ago

















1















QGIS 3.8, Win 10. I have labels that are connected with the points they represent with a leader-line. The line is generated with geometry generator (going from the point-layer to the position where I placed the labels manually):



make_line(make_point($x,$y), make_point( "auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony" ))


The line sometimes continues below the label. How is it possible to shorten the line so that it stops when it touches the label? I tried to mask it with text-buffers. However, this is not an option here (see the link to see why). Changing horizontal/vertical alignement is also no option since I have labels clockwise around a circle - so if it would fix the problem for some of the labels, the problem would consist on the opposit site.



I tried the expression extend with negative value, but it seems it accepts only positive values, making the line longer. I look for a function that is a counterpart-expression (someting like shorten) - how to achieve this?



enter image description here










share|improve this question


























  • It's not a direct answer - but qgis 3.10 includes native callout support which doesn't suffer this issue.

    – ndawson
    8 hours ago











  • You can try something like this: difference(make_line(make_point($x,$y), buffer(make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony",0.001)))) modify 0.001 based on your needs.

    – ahmadhanb
    8 hours ago











  • @ahmadhanb: the expression does not work. I guess it is because the syntax of make_line expects two points - with buffer(), you don't get a point, but the buffer of a point (thus something like a polygon, I guess)?

    – babel
    8 hours ago













1












1








1








QGIS 3.8, Win 10. I have labels that are connected with the points they represent with a leader-line. The line is generated with geometry generator (going from the point-layer to the position where I placed the labels manually):



make_line(make_point($x,$y), make_point( "auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony" ))


The line sometimes continues below the label. How is it possible to shorten the line so that it stops when it touches the label? I tried to mask it with text-buffers. However, this is not an option here (see the link to see why). Changing horizontal/vertical alignement is also no option since I have labels clockwise around a circle - so if it would fix the problem for some of the labels, the problem would consist on the opposit site.



I tried the expression extend with negative value, but it seems it accepts only positive values, making the line longer. I look for a function that is a counterpart-expression (someting like shorten) - how to achieve this?



enter image description here










share|improve this question
















QGIS 3.8, Win 10. I have labels that are connected with the points they represent with a leader-line. The line is generated with geometry generator (going from the point-layer to the position where I placed the labels manually):



make_line(make_point($x,$y), make_point( "auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony" ))


The line sometimes continues below the label. How is it possible to shorten the line so that it stops when it touches the label? I tried to mask it with text-buffers. However, this is not an option here (see the link to see why). Changing horizontal/vertical alignement is also no option since I have labels clockwise around a circle - so if it would fix the problem for some of the labels, the problem would consist on the opposit site.



I tried the expression extend with negative value, but it seems it accepts only positive values, making the line longer. I look for a function that is a counterpart-expression (someting like shorten) - how to achieve this?



enter image description here







qgis labeling geometry-generator






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 8 hours ago







babel

















asked 8 hours ago









babelbabel

6003 silver badges10 bronze badges




6003 silver badges10 bronze badges















  • It's not a direct answer - but qgis 3.10 includes native callout support which doesn't suffer this issue.

    – ndawson
    8 hours ago











  • You can try something like this: difference(make_line(make_point($x,$y), buffer(make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony",0.001)))) modify 0.001 based on your needs.

    – ahmadhanb
    8 hours ago











  • @ahmadhanb: the expression does not work. I guess it is because the syntax of make_line expects two points - with buffer(), you don't get a point, but the buffer of a point (thus something like a polygon, I guess)?

    – babel
    8 hours ago

















  • It's not a direct answer - but qgis 3.10 includes native callout support which doesn't suffer this issue.

    – ndawson
    8 hours ago











  • You can try something like this: difference(make_line(make_point($x,$y), buffer(make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony",0.001)))) modify 0.001 based on your needs.

    – ahmadhanb
    8 hours ago











  • @ahmadhanb: the expression does not work. I guess it is because the syntax of make_line expects two points - with buffer(), you don't get a point, but the buffer of a point (thus something like a polygon, I guess)?

    – babel
    8 hours ago
















It's not a direct answer - but qgis 3.10 includes native callout support which doesn't suffer this issue.

– ndawson
8 hours ago





It's not a direct answer - but qgis 3.10 includes native callout support which doesn't suffer this issue.

– ndawson
8 hours ago













You can try something like this: difference(make_line(make_point($x,$y), buffer(make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony",0.001)))) modify 0.001 based on your needs.

– ahmadhanb
8 hours ago





You can try something like this: difference(make_line(make_point($x,$y), buffer(make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony",0.001)))) modify 0.001 based on your needs.

– ahmadhanb
8 hours ago













@ahmadhanb: the expression does not work. I guess it is because the syntax of make_line expects two points - with buffer(), you don't get a point, but the buffer of a point (thus something like a polygon, I guess)?

– babel
8 hours ago





@ahmadhanb: the expression does not work. I guess it is because the syntax of make_line expects two points - with buffer(), you don't get a point, but the buffer of a point (thus something like a polygon, I guess)?

– babel
8 hours ago










1 Answer
1






active

oldest

votes


















3
















Thanks to ahmadhanb's proposal, I found a solution, using the intersection-function to create a point where the line intersects the buffer. Expression looks scary, however is not so complicated to understand:



make_line(($geometry),make_point(x ( intersection( (buffer (make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony"), 0.25)), (make_line(make_point($x,$y), make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony"))))), y( intersection( (buffer (make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony"), 0.25)), (make_line(make_point($x,$y), make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony")))))))


Looking for QGIS 3.10!



Edited: found yet another way to accomplish the same aim: duplicate the layer with the points/labels, so that there are two identical layers. The first layer (on top) shows only the points and the label (inscription). The last layer (no. 2, at the bottom) shows the line only, created with geometry-generator: no points, no labels. On the top layer, the layer-background-tab is set to show a background (or again using text-buffer). It is this background or buffer that masks the line in the layer below.






share|improve this answer





























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "79"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f336632%2fshorten-leader-line-for-labels-with-geometry-generator%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3
















    Thanks to ahmadhanb's proposal, I found a solution, using the intersection-function to create a point where the line intersects the buffer. Expression looks scary, however is not so complicated to understand:



    make_line(($geometry),make_point(x ( intersection( (buffer (make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony"), 0.25)), (make_line(make_point($x,$y), make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony"))))), y( intersection( (buffer (make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony"), 0.25)), (make_line(make_point($x,$y), make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony")))))))


    Looking for QGIS 3.10!



    Edited: found yet another way to accomplish the same aim: duplicate the layer with the points/labels, so that there are two identical layers. The first layer (on top) shows only the points and the label (inscription). The last layer (no. 2, at the bottom) shows the line only, created with geometry-generator: no points, no labels. On the top layer, the layer-background-tab is set to show a background (or again using text-buffer). It is this background or buffer that masks the line in the layer below.






    share|improve this answer































      3
















      Thanks to ahmadhanb's proposal, I found a solution, using the intersection-function to create a point where the line intersects the buffer. Expression looks scary, however is not so complicated to understand:



      make_line(($geometry),make_point(x ( intersection( (buffer (make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony"), 0.25)), (make_line(make_point($x,$y), make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony"))))), y( intersection( (buffer (make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony"), 0.25)), (make_line(make_point($x,$y), make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony")))))))


      Looking for QGIS 3.10!



      Edited: found yet another way to accomplish the same aim: duplicate the layer with the points/labels, so that there are two identical layers. The first layer (on top) shows only the points and the label (inscription). The last layer (no. 2, at the bottom) shows the line only, created with geometry-generator: no points, no labels. On the top layer, the layer-background-tab is set to show a background (or again using text-buffer). It is this background or buffer that masks the line in the layer below.






      share|improve this answer





























        3














        3










        3









        Thanks to ahmadhanb's proposal, I found a solution, using the intersection-function to create a point where the line intersects the buffer. Expression looks scary, however is not so complicated to understand:



        make_line(($geometry),make_point(x ( intersection( (buffer (make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony"), 0.25)), (make_line(make_point($x,$y), make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony"))))), y( intersection( (buffer (make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony"), 0.25)), (make_line(make_point($x,$y), make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony")))))))


        Looking for QGIS 3.10!



        Edited: found yet another way to accomplish the same aim: duplicate the layer with the points/labels, so that there are two identical layers. The first layer (on top) shows only the points and the label (inscription). The last layer (no. 2, at the bottom) shows the line only, created with geometry-generator: no points, no labels. On the top layer, the layer-background-tab is set to show a background (or again using text-buffer). It is this background or buffer that masks the line in the layer below.






        share|improve this answer















        Thanks to ahmadhanb's proposal, I found a solution, using the intersection-function to create a point where the line intersects the buffer. Expression looks scary, however is not so complicated to understand:



        make_line(($geometry),make_point(x ( intersection( (buffer (make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony"), 0.25)), (make_line(make_point($x,$y), make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony"))))), y( intersection( (buffer (make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony"), 0.25)), (make_line(make_point($x,$y), make_point("auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony")))))))


        Looking for QGIS 3.10!



        Edited: found yet another way to accomplish the same aim: duplicate the layer with the points/labels, so that there are two identical layers. The first layer (on top) shows only the points and the label (inscription). The last layer (no. 2, at the bottom) shows the line only, created with geometry-generator: no points, no labels. On the top layer, the layer-background-tab is set to show a background (or again using text-buffer). It is this background or buffer that masks the line in the layer below.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 5 hours ago

























        answered 8 hours ago









        babelbabel

        6003 silver badges10 bronze badges




        6003 silver badges10 bronze badges































            draft saved

            draft discarded















































            Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f336632%2fshorten-leader-line-for-labels-with-geometry-generator%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            ParseJSON using SSJSUsing AMPscript with SSJS ActivitiesHow to resubscribe a user in Marketing cloud using SSJS?Pulling Subscriber Status from Lists using SSJSRetrieving Emails using SSJSProblem in updating DE using SSJSUsing SSJS to send single email in Marketing CloudError adding EmailSendDefinition using SSJS

            Кампала Садржај Географија Географија Историја Становништво Привреда Партнерски градови Референце Спољашње везе Мени за навигацију0°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.340°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.34МедијиПодациЗванични веб-сајту

            19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу