How to automaticaly create a buffer for a line in QGIS












3















I am creating some lines, and I would like to add a 500m buffer around thoses lines. But i need this buffer to automaticaly change if i modify my line around.
Is there any solution to this?










share|improve this question























  • What do you mean by automatically change? Do you mean you are manually modifying the line your buffer is based off of?

    – Trevor J. Smith
    12 hours ago
















3















I am creating some lines, and I would like to add a 500m buffer around thoses lines. But i need this buffer to automaticaly change if i modify my line around.
Is there any solution to this?










share|improve this question























  • What do you mean by automatically change? Do you mean you are manually modifying the line your buffer is based off of?

    – Trevor J. Smith
    12 hours ago














3












3








3








I am creating some lines, and I would like to add a 500m buffer around thoses lines. But i need this buffer to automaticaly change if i modify my line around.
Is there any solution to this?










share|improve this question














I am creating some lines, and I would like to add a 500m buffer around thoses lines. But i need this buffer to automaticaly change if i modify my line around.
Is there any solution to this?







qgis qgis-processing qgis-3.0






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 13 hours ago









ArthurArthur

17711




17711













  • What do you mean by automatically change? Do you mean you are manually modifying the line your buffer is based off of?

    – Trevor J. Smith
    12 hours ago



















  • What do you mean by automatically change? Do you mean you are manually modifying the line your buffer is based off of?

    – Trevor J. Smith
    12 hours ago

















What do you mean by automatically change? Do you mean you are manually modifying the line your buffer is based off of?

– Trevor J. Smith
12 hours ago





What do you mean by automatically change? Do you mean you are manually modifying the line your buffer is based off of?

– Trevor J. Smith
12 hours ago










2 Answers
2






active

oldest

votes


















6














You can create a virtual layer that is linked to your source layer. It has the advantage of creating a new in-memory layer that can easily be turned on/off.



Go to menu layer / add layer / add - edit virtual layer and use the formula



select st_buffer(geometry,500)
from myline;


The buffer distance is in the projection unit, so in meters or degrees.






share|improve this answer
























  • I think it should be select buffer(geometry,500) as geometry from myline. And nice thing that virtual layers now get updated immediately.

    – MrXsquared
    7 hours ago













  • @MrXsquared Virtual Layers are truly awesome! Both buffer syntax are valid, and the alias is not needed (unless you want to run other queries on it). One may have to pan/refresh the map to see the new shape in the virtual layer.

    – JGH
    7 hours ago



















5














One easy solution is to use the geometry generator, the drawback with this solution is that the buffer exists only on the display (not a layer you can reuse) and only in the document where it's configured. Also if you have many lines it may slow down rendering.



If you choose to go this way just go to the symbology tab of the line layer, click the plus to add a symbol layer and choose the Geometry generator type with Polygon/Multipolygon geometry then just type buffer( $geometry,500) as function (this only work if you are working in a CRS in meter, if not you will need to add some reprojection to the function). You could then symbolize the buffer to your liking.



As the buffer is dynamically created on the line geometry it will reflect any change to the line.



enter image description here






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/3.0/"u003ecc by-sa 3.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%2f309150%2fhow-to-automaticaly-create-a-buffer-for-a-line-in-qgis%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    6














    You can create a virtual layer that is linked to your source layer. It has the advantage of creating a new in-memory layer that can easily be turned on/off.



    Go to menu layer / add layer / add - edit virtual layer and use the formula



    select st_buffer(geometry,500)
    from myline;


    The buffer distance is in the projection unit, so in meters or degrees.






    share|improve this answer
























    • I think it should be select buffer(geometry,500) as geometry from myline. And nice thing that virtual layers now get updated immediately.

      – MrXsquared
      7 hours ago













    • @MrXsquared Virtual Layers are truly awesome! Both buffer syntax are valid, and the alias is not needed (unless you want to run other queries on it). One may have to pan/refresh the map to see the new shape in the virtual layer.

      – JGH
      7 hours ago
















    6














    You can create a virtual layer that is linked to your source layer. It has the advantage of creating a new in-memory layer that can easily be turned on/off.



    Go to menu layer / add layer / add - edit virtual layer and use the formula



    select st_buffer(geometry,500)
    from myline;


    The buffer distance is in the projection unit, so in meters or degrees.






    share|improve this answer
























    • I think it should be select buffer(geometry,500) as geometry from myline. And nice thing that virtual layers now get updated immediately.

      – MrXsquared
      7 hours ago













    • @MrXsquared Virtual Layers are truly awesome! Both buffer syntax are valid, and the alias is not needed (unless you want to run other queries on it). One may have to pan/refresh the map to see the new shape in the virtual layer.

      – JGH
      7 hours ago














    6












    6








    6







    You can create a virtual layer that is linked to your source layer. It has the advantage of creating a new in-memory layer that can easily be turned on/off.



    Go to menu layer / add layer / add - edit virtual layer and use the formula



    select st_buffer(geometry,500)
    from myline;


    The buffer distance is in the projection unit, so in meters or degrees.






    share|improve this answer













    You can create a virtual layer that is linked to your source layer. It has the advantage of creating a new in-memory layer that can easily be turned on/off.



    Go to menu layer / add layer / add - edit virtual layer and use the formula



    select st_buffer(geometry,500)
    from myline;


    The buffer distance is in the projection unit, so in meters or degrees.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 12 hours ago









    JGHJGH

    11.9k21134




    11.9k21134













    • I think it should be select buffer(geometry,500) as geometry from myline. And nice thing that virtual layers now get updated immediately.

      – MrXsquared
      7 hours ago













    • @MrXsquared Virtual Layers are truly awesome! Both buffer syntax are valid, and the alias is not needed (unless you want to run other queries on it). One may have to pan/refresh the map to see the new shape in the virtual layer.

      – JGH
      7 hours ago



















    • I think it should be select buffer(geometry,500) as geometry from myline. And nice thing that virtual layers now get updated immediately.

      – MrXsquared
      7 hours ago













    • @MrXsquared Virtual Layers are truly awesome! Both buffer syntax are valid, and the alias is not needed (unless you want to run other queries on it). One may have to pan/refresh the map to see the new shape in the virtual layer.

      – JGH
      7 hours ago

















    I think it should be select buffer(geometry,500) as geometry from myline. And nice thing that virtual layers now get updated immediately.

    – MrXsquared
    7 hours ago







    I think it should be select buffer(geometry,500) as geometry from myline. And nice thing that virtual layers now get updated immediately.

    – MrXsquared
    7 hours ago















    @MrXsquared Virtual Layers are truly awesome! Both buffer syntax are valid, and the alias is not needed (unless you want to run other queries on it). One may have to pan/refresh the map to see the new shape in the virtual layer.

    – JGH
    7 hours ago





    @MrXsquared Virtual Layers are truly awesome! Both buffer syntax are valid, and the alias is not needed (unless you want to run other queries on it). One may have to pan/refresh the map to see the new shape in the virtual layer.

    – JGH
    7 hours ago













    5














    One easy solution is to use the geometry generator, the drawback with this solution is that the buffer exists only on the display (not a layer you can reuse) and only in the document where it's configured. Also if you have many lines it may slow down rendering.



    If you choose to go this way just go to the symbology tab of the line layer, click the plus to add a symbol layer and choose the Geometry generator type with Polygon/Multipolygon geometry then just type buffer( $geometry,500) as function (this only work if you are working in a CRS in meter, if not you will need to add some reprojection to the function). You could then symbolize the buffer to your liking.



    As the buffer is dynamically created on the line geometry it will reflect any change to the line.



    enter image description here






    share|improve this answer






























      5














      One easy solution is to use the geometry generator, the drawback with this solution is that the buffer exists only on the display (not a layer you can reuse) and only in the document where it's configured. Also if you have many lines it may slow down rendering.



      If you choose to go this way just go to the symbology tab of the line layer, click the plus to add a symbol layer and choose the Geometry generator type with Polygon/Multipolygon geometry then just type buffer( $geometry,500) as function (this only work if you are working in a CRS in meter, if not you will need to add some reprojection to the function). You could then symbolize the buffer to your liking.



      As the buffer is dynamically created on the line geometry it will reflect any change to the line.



      enter image description here






      share|improve this answer




























        5












        5








        5







        One easy solution is to use the geometry generator, the drawback with this solution is that the buffer exists only on the display (not a layer you can reuse) and only in the document where it's configured. Also if you have many lines it may slow down rendering.



        If you choose to go this way just go to the symbology tab of the line layer, click the plus to add a symbol layer and choose the Geometry generator type with Polygon/Multipolygon geometry then just type buffer( $geometry,500) as function (this only work if you are working in a CRS in meter, if not you will need to add some reprojection to the function). You could then symbolize the buffer to your liking.



        As the buffer is dynamically created on the line geometry it will reflect any change to the line.



        enter image description here






        share|improve this answer















        One easy solution is to use the geometry generator, the drawback with this solution is that the buffer exists only on the display (not a layer you can reuse) and only in the document where it's configured. Also if you have many lines it may slow down rendering.



        If you choose to go this way just go to the symbology tab of the line layer, click the plus to add a symbol layer and choose the Geometry generator type with Polygon/Multipolygon geometry then just type buffer( $geometry,500) as function (this only work if you are working in a CRS in meter, if not you will need to add some reprojection to the function). You could then symbolize the buffer to your liking.



        As the buffer is dynamically created on the line geometry it will reflect any change to the line.



        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 12 hours ago









        lambertj

        1,8631623




        1,8631623










        answered 12 hours ago









        J.RJ.R

        3,083221




        3,083221






























            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%2f309150%2fhow-to-automaticaly-create-a-buffer-for-a-line-in-qgis%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

            SQL Server 17 - Attemping to backup to remote NAS but Access is denied

            Always On Availability groups resolving state after failover - Remote harden of transaction...

            Restoring from pg_dump with foreign key constraints