How can I use line vectors to alter my DEM?











up vote
1
down vote

favorite












I'm trying to use vector lines to change the height of the areas of my DEM that they overlay. They trace rivers, and i'm hoping to assign arbitrarily high values to the rivers so that my least-cost path analyses using r.walk don't constantly try to follow the riverbeds.



What's the best way to do this?










share|improve this question


















  • 1




    GDAL_Rasterize will create a raster from your lines.. are they 3d lines? If not how is your arbitrarily high value stored?
    – Michael Stimson
    4 hours ago










  • They aren't 3d lines. I just added an attribute to the table named "elevation" and set it to 9999. <br> I rasterized the line vectors, but now can't seem to merge it with the existing DEM successfully. What should I be doing to make this happen?
    – BogBody
    4 hours ago












  • You could try GDAL_Merge but it's not immediately clear which raster takes precedence where two or more overlap or use the raster calculator docs.qgis.org/2.8/en/docs/user_manual/working_with_raster/… with an expression that selects where your rivers is nodata docs.qgis.org/2.8/en/docs/training_manual/processing/… then use the DEM otherwise use the rivers.
    – Michael Stimson
    4 hours ago

















up vote
1
down vote

favorite












I'm trying to use vector lines to change the height of the areas of my DEM that they overlay. They trace rivers, and i'm hoping to assign arbitrarily high values to the rivers so that my least-cost path analyses using r.walk don't constantly try to follow the riverbeds.



What's the best way to do this?










share|improve this question


















  • 1




    GDAL_Rasterize will create a raster from your lines.. are they 3d lines? If not how is your arbitrarily high value stored?
    – Michael Stimson
    4 hours ago










  • They aren't 3d lines. I just added an attribute to the table named "elevation" and set it to 9999. <br> I rasterized the line vectors, but now can't seem to merge it with the existing DEM successfully. What should I be doing to make this happen?
    – BogBody
    4 hours ago












  • You could try GDAL_Merge but it's not immediately clear which raster takes precedence where two or more overlap or use the raster calculator docs.qgis.org/2.8/en/docs/user_manual/working_with_raster/… with an expression that selects where your rivers is nodata docs.qgis.org/2.8/en/docs/training_manual/processing/… then use the DEM otherwise use the rivers.
    – Michael Stimson
    4 hours ago















up vote
1
down vote

favorite









up vote
1
down vote

favorite











I'm trying to use vector lines to change the height of the areas of my DEM that they overlay. They trace rivers, and i'm hoping to assign arbitrarily high values to the rivers so that my least-cost path analyses using r.walk don't constantly try to follow the riverbeds.



What's the best way to do this?










share|improve this question













I'm trying to use vector lines to change the height of the areas of my DEM that they overlay. They trace rivers, and i'm hoping to assign arbitrarily high values to the rivers so that my least-cost path analyses using r.walk don't constantly try to follow the riverbeds.



What's the best way to do this?







qgis dem






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 4 hours ago









BogBody

617




617








  • 1




    GDAL_Rasterize will create a raster from your lines.. are they 3d lines? If not how is your arbitrarily high value stored?
    – Michael Stimson
    4 hours ago










  • They aren't 3d lines. I just added an attribute to the table named "elevation" and set it to 9999. <br> I rasterized the line vectors, but now can't seem to merge it with the existing DEM successfully. What should I be doing to make this happen?
    – BogBody
    4 hours ago












  • You could try GDAL_Merge but it's not immediately clear which raster takes precedence where two or more overlap or use the raster calculator docs.qgis.org/2.8/en/docs/user_manual/working_with_raster/… with an expression that selects where your rivers is nodata docs.qgis.org/2.8/en/docs/training_manual/processing/… then use the DEM otherwise use the rivers.
    – Michael Stimson
    4 hours ago
















  • 1




    GDAL_Rasterize will create a raster from your lines.. are they 3d lines? If not how is your arbitrarily high value stored?
    – Michael Stimson
    4 hours ago










  • They aren't 3d lines. I just added an attribute to the table named "elevation" and set it to 9999. <br> I rasterized the line vectors, but now can't seem to merge it with the existing DEM successfully. What should I be doing to make this happen?
    – BogBody
    4 hours ago












  • You could try GDAL_Merge but it's not immediately clear which raster takes precedence where two or more overlap or use the raster calculator docs.qgis.org/2.8/en/docs/user_manual/working_with_raster/… with an expression that selects where your rivers is nodata docs.qgis.org/2.8/en/docs/training_manual/processing/… then use the DEM otherwise use the rivers.
    – Michael Stimson
    4 hours ago










1




1




GDAL_Rasterize will create a raster from your lines.. are they 3d lines? If not how is your arbitrarily high value stored?
– Michael Stimson
4 hours ago




GDAL_Rasterize will create a raster from your lines.. are they 3d lines? If not how is your arbitrarily high value stored?
– Michael Stimson
4 hours ago












They aren't 3d lines. I just added an attribute to the table named "elevation" and set it to 9999. <br> I rasterized the line vectors, but now can't seem to merge it with the existing DEM successfully. What should I be doing to make this happen?
– BogBody
4 hours ago






They aren't 3d lines. I just added an attribute to the table named "elevation" and set it to 9999. <br> I rasterized the line vectors, but now can't seem to merge it with the existing DEM successfully. What should I be doing to make this happen?
– BogBody
4 hours ago














You could try GDAL_Merge but it's not immediately clear which raster takes precedence where two or more overlap or use the raster calculator docs.qgis.org/2.8/en/docs/user_manual/working_with_raster/… with an expression that selects where your rivers is nodata docs.qgis.org/2.8/en/docs/training_manual/processing/… then use the DEM otherwise use the rivers.
– Michael Stimson
4 hours ago






You could try GDAL_Merge but it's not immediately clear which raster takes precedence where two or more overlap or use the raster calculator docs.qgis.org/2.8/en/docs/user_manual/working_with_raster/… with an expression that selects where your rivers is nodata docs.qgis.org/2.8/en/docs/training_manual/processing/… then use the DEM otherwise use the rivers.
– Michael Stimson
4 hours ago












1 Answer
1






active

oldest

votes

















up vote
2
down vote













First of all, it is quite logic that r.walk guide you along the riverbed. This is usually the path to walk along. If you change the rivers values to 9999, you will create artificial cliff that will be difficult to cross, and if you climb on it you will try to stay on it. Otherwise, you will just follow the riverbed with one pixel shift. I would instead suggest to use the rasterized river as a friction layer or to play with some parameters of r.walk



That being said, you can achieve what you want to do by combining the two comments to your question.




1) use gdal_rasterize to convert your lines to raster based on your attribute field that contains the 9999 values.



2) use the raster calculator to update your DEM with the new raster value




("yourrivers@1" < 9999) * "yourdem@1" + ("yourrivers@1" >= 9999) * 9999





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',
    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%2f305513%2fhow-can-i-use-line-vectors-to-alter-my-dem%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








    up vote
    2
    down vote













    First of all, it is quite logic that r.walk guide you along the riverbed. This is usually the path to walk along. If you change the rivers values to 9999, you will create artificial cliff that will be difficult to cross, and if you climb on it you will try to stay on it. Otherwise, you will just follow the riverbed with one pixel shift. I would instead suggest to use the rasterized river as a friction layer or to play with some parameters of r.walk



    That being said, you can achieve what you want to do by combining the two comments to your question.




    1) use gdal_rasterize to convert your lines to raster based on your attribute field that contains the 9999 values.



    2) use the raster calculator to update your DEM with the new raster value




    ("yourrivers@1" < 9999) * "yourdem@1" + ("yourrivers@1" >= 9999) * 9999





    share|improve this answer



























      up vote
      2
      down vote













      First of all, it is quite logic that r.walk guide you along the riverbed. This is usually the path to walk along. If you change the rivers values to 9999, you will create artificial cliff that will be difficult to cross, and if you climb on it you will try to stay on it. Otherwise, you will just follow the riverbed with one pixel shift. I would instead suggest to use the rasterized river as a friction layer or to play with some parameters of r.walk



      That being said, you can achieve what you want to do by combining the two comments to your question.




      1) use gdal_rasterize to convert your lines to raster based on your attribute field that contains the 9999 values.



      2) use the raster calculator to update your DEM with the new raster value




      ("yourrivers@1" < 9999) * "yourdem@1" + ("yourrivers@1" >= 9999) * 9999





      share|improve this answer

























        up vote
        2
        down vote










        up vote
        2
        down vote









        First of all, it is quite logic that r.walk guide you along the riverbed. This is usually the path to walk along. If you change the rivers values to 9999, you will create artificial cliff that will be difficult to cross, and if you climb on it you will try to stay on it. Otherwise, you will just follow the riverbed with one pixel shift. I would instead suggest to use the rasterized river as a friction layer or to play with some parameters of r.walk



        That being said, you can achieve what you want to do by combining the two comments to your question.




        1) use gdal_rasterize to convert your lines to raster based on your attribute field that contains the 9999 values.



        2) use the raster calculator to update your DEM with the new raster value




        ("yourrivers@1" < 9999) * "yourdem@1" + ("yourrivers@1" >= 9999) * 9999





        share|improve this answer














        First of all, it is quite logic that r.walk guide you along the riverbed. This is usually the path to walk along. If you change the rivers values to 9999, you will create artificial cliff that will be difficult to cross, and if you climb on it you will try to stay on it. Otherwise, you will just follow the riverbed with one pixel shift. I would instead suggest to use the rasterized river as a friction layer or to play with some parameters of r.walk



        That being said, you can achieve what you want to do by combining the two comments to your question.




        1) use gdal_rasterize to convert your lines to raster based on your attribute field that contains the 9999 values.



        2) use the raster calculator to update your DEM with the new raster value




        ("yourrivers@1" < 9999) * "yourdem@1" + ("yourrivers@1" >= 9999) * 9999






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 3 hours ago

























        answered 3 hours ago









        radouxju

        39.4k140112




        39.4k140112






























            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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2f305513%2fhow-can-i-use-line-vectors-to-alter-my-dem%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

            What visual should I use to simply compare current year value vs last year in Power BI desktop

            Alexandru Averescu

            Trompette piccolo