Getting value set in binding input widget in QGIS expression? Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?SVG from QGIS to Illustrator CC gets wrong stroke widthsPlacement for LabelQGIS 2.8.2 - Using spatial expressions in labellingData dependent override on colour and linewidth of line pattern fill not working after upgrade to QGIS 2.12Transparency control in svg symbolsScale color ramp filtered on common layer columns, in QGISHow to show line symbol (arrow) independently of line length in ArcGIS?How to mount an expression for “contain” in QGIS 2.18.14 Atlas/Print Composer?How to create sequential numbers in a field by defining automatically the start, end and interval numbers?How to scale features declining using map units in QGIS

Can two person see the same photon?

How to change the tick of the color bar legend to black

Is there public access to the Meteor Crater in Arizona?

What is the difference between CTSS and ITS?

A term for a woman complaining about things/begging in a cute/childish way

What adaptations would allow standard fantasy dwarves to survive in the desert?

Moving a wrapfig vertically to encroach partially on a subsection title

Understanding p-Values using an example

What does this say in Elvish?

Did Mueller's report provide an evidentiary basis for the claim of Russian govt election interference via social media?

Why not send Voyager 3 and 4 following up the paths taken by Voyager 1 and 2 to re-transmit signals of later as they fly away from Earth?

How to write capital alpha?

Why do early math courses focus on the cross sections of a cone and not on other 3D objects?

What does 丫 mean? 丫是什么意思?

How would you say "es muy psicólogo"?

A proverb that is used to imply that you have unexpectedly faced a big problem

License to disallow distribution in closed source software, but allow exceptions made by owner?

Universal covering space of the real projective line?

Would color changing eyes affect vision?

Resize vertical bars (absolute-value symbols)

Why are vacuum tubes still used in amateur radios?

Why is std::move not [[nodiscard]] in C++20?

How to ternary Plot3D a function

Co-worker has annoying ringtone



Getting value set in binding input widget in QGIS expression?



Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?SVG from QGIS to Illustrator CC gets wrong stroke widthsPlacement for LabelQGIS 2.8.2 - Using spatial expressions in labellingData dependent override on colour and linewidth of line pattern fill not working after upgrade to QGIS 2.12Transparency control in svg symbolsScale color ramp filtered on common layer columns, in QGISHow to show line symbol (arrow) independently of line length in ArcGIS?How to mount an expression for “contain” in QGIS 2.18.14 Atlas/Print Composer?How to create sequential numbers in a field by defining automatically the start, end and interval numbers?How to scale features declining using map units in QGIS



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








3















I would like to set dynamic line width and it should be scaled by the value "Stroke width".



When I set the value to 0.15, it will be less than 0.15 if $length is too small. I need a function to get the value set in "Stroke width" so that I can modify it directly in "Stroke width" instead of in Expression String builder.



CASE
WHEN ($length < 1) THEN ($length * 0.15 / 1)
WHEN ($length >= 1) THEN (0.15)
END


Example



Result










share|improve this question



















  • 1





    you may be interested in scale_linear(val, domain_min, domain_max, range_min, range_max) or scale_exp(val, domain_min, domain_max, range_min, range_max, exponent). Something like scale_linear("Stroke width", min("Stroke width"), max("Stroke width"), 1, 5) in Map Units

    – Taras
    Apr 12 at 7:51


















3















I would like to set dynamic line width and it should be scaled by the value "Stroke width".



When I set the value to 0.15, it will be less than 0.15 if $length is too small. I need a function to get the value set in "Stroke width" so that I can modify it directly in "Stroke width" instead of in Expression String builder.



CASE
WHEN ($length < 1) THEN ($length * 0.15 / 1)
WHEN ($length >= 1) THEN (0.15)
END


Example



Result










share|improve this question



















  • 1





    you may be interested in scale_linear(val, domain_min, domain_max, range_min, range_max) or scale_exp(val, domain_min, domain_max, range_min, range_max, exponent). Something like scale_linear("Stroke width", min("Stroke width"), max("Stroke width"), 1, 5) in Map Units

    – Taras
    Apr 12 at 7:51














3












3








3








I would like to set dynamic line width and it should be scaled by the value "Stroke width".



When I set the value to 0.15, it will be less than 0.15 if $length is too small. I need a function to get the value set in "Stroke width" so that I can modify it directly in "Stroke width" instead of in Expression String builder.



CASE
WHEN ($length < 1) THEN ($length * 0.15 / 1)
WHEN ($length >= 1) THEN (0.15)
END


Example



Result










share|improve this question
















I would like to set dynamic line width and it should be scaled by the value "Stroke width".



When I set the value to 0.15, it will be less than 0.15 if $length is too small. I need a function to get the value set in "Stroke width" so that I can modify it directly in "Stroke width" instead of in Expression String builder.



CASE
WHEN ($length < 1) THEN ($length * 0.15 / 1)
WHEN ($length >= 1) THEN (0.15)
END


Example



Result







qgis line expression






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 12 at 7:55









Taras

2,3703730




2,3703730










asked Apr 12 at 7:39









Fang ZheFang Zhe

162




162







  • 1





    you may be interested in scale_linear(val, domain_min, domain_max, range_min, range_max) or scale_exp(val, domain_min, domain_max, range_min, range_max, exponent). Something like scale_linear("Stroke width", min("Stroke width"), max("Stroke width"), 1, 5) in Map Units

    – Taras
    Apr 12 at 7:51













  • 1





    you may be interested in scale_linear(val, domain_min, domain_max, range_min, range_max) or scale_exp(val, domain_min, domain_max, range_min, range_max, exponent). Something like scale_linear("Stroke width", min("Stroke width"), max("Stroke width"), 1, 5) in Map Units

    – Taras
    Apr 12 at 7:51








1




1





you may be interested in scale_linear(val, domain_min, domain_max, range_min, range_max) or scale_exp(val, domain_min, domain_max, range_min, range_max, exponent). Something like scale_linear("Stroke width", min("Stroke width"), max("Stroke width"), 1, 5) in Map Units

– Taras
Apr 12 at 7:51






you may be interested in scale_linear(val, domain_min, domain_max, range_min, range_max) or scale_exp(val, domain_min, domain_max, range_min, range_max, exponent). Something like scale_linear("Stroke width", min("Stroke width"), max("Stroke width"), 1, 5) in Map Units

– Taras
Apr 12 at 7:51











1 Answer
1






active

oldest

votes


















1














You refer to "stroke width" in double quotation marks, which makes it seem like your attribute table has a field called "stroke width." If that's the case, you can use this field in an expression, and scale the line width based on the value in the stroke width field.



enter image description hereenter image description here




If, as I suspect, you're actually talking about the stroke width box in the layer styling panel enter image description here, then you can't do what you're asking for. QGIS just isn't designed that way. The value set in the stroke width box is not available in the expression builder. The Data-Defined Override setting will always override the value you enter into the stroke width box. See the second and third definitions of "override" from dictionary.com:




  1. to disregard, set aside, or nullify; countermand

  2. to take precedence over; preempt or supersede




What you can do instead is define a custom variable in the layer properties. Eg, you could call your variable default_stroke_width. Once the variable is defined, you can use it in the expression builder with @default_stroke_width.



enter image description here



enter image description here



Even though this variable has the words "stroke width" in its name, it's not connected to the stroke width box in the style panel. When you want to change the default_stroke_width value, you'll have to go back into layer properties and edit the variable. This is probably less convenient than editing the expression itself.






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%2f318563%2fgetting-value-set-in-binding-input-widget-in-qgis-expression%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









    1














    You refer to "stroke width" in double quotation marks, which makes it seem like your attribute table has a field called "stroke width." If that's the case, you can use this field in an expression, and scale the line width based on the value in the stroke width field.



    enter image description hereenter image description here




    If, as I suspect, you're actually talking about the stroke width box in the layer styling panel enter image description here, then you can't do what you're asking for. QGIS just isn't designed that way. The value set in the stroke width box is not available in the expression builder. The Data-Defined Override setting will always override the value you enter into the stroke width box. See the second and third definitions of "override" from dictionary.com:




    1. to disregard, set aside, or nullify; countermand

    2. to take precedence over; preempt or supersede




    What you can do instead is define a custom variable in the layer properties. Eg, you could call your variable default_stroke_width. Once the variable is defined, you can use it in the expression builder with @default_stroke_width.



    enter image description here



    enter image description here



    Even though this variable has the words "stroke width" in its name, it's not connected to the stroke width box in the style panel. When you want to change the default_stroke_width value, you'll have to go back into layer properties and edit the variable. This is probably less convenient than editing the expression itself.






    share|improve this answer





























      1














      You refer to "stroke width" in double quotation marks, which makes it seem like your attribute table has a field called "stroke width." If that's the case, you can use this field in an expression, and scale the line width based on the value in the stroke width field.



      enter image description hereenter image description here




      If, as I suspect, you're actually talking about the stroke width box in the layer styling panel enter image description here, then you can't do what you're asking for. QGIS just isn't designed that way. The value set in the stroke width box is not available in the expression builder. The Data-Defined Override setting will always override the value you enter into the stroke width box. See the second and third definitions of "override" from dictionary.com:




      1. to disregard, set aside, or nullify; countermand

      2. to take precedence over; preempt or supersede




      What you can do instead is define a custom variable in the layer properties. Eg, you could call your variable default_stroke_width. Once the variable is defined, you can use it in the expression builder with @default_stroke_width.



      enter image description here



      enter image description here



      Even though this variable has the words "stroke width" in its name, it's not connected to the stroke width box in the style panel. When you want to change the default_stroke_width value, you'll have to go back into layer properties and edit the variable. This is probably less convenient than editing the expression itself.






      share|improve this answer



























        1












        1








        1







        You refer to "stroke width" in double quotation marks, which makes it seem like your attribute table has a field called "stroke width." If that's the case, you can use this field in an expression, and scale the line width based on the value in the stroke width field.



        enter image description hereenter image description here




        If, as I suspect, you're actually talking about the stroke width box in the layer styling panel enter image description here, then you can't do what you're asking for. QGIS just isn't designed that way. The value set in the stroke width box is not available in the expression builder. The Data-Defined Override setting will always override the value you enter into the stroke width box. See the second and third definitions of "override" from dictionary.com:




        1. to disregard, set aside, or nullify; countermand

        2. to take precedence over; preempt or supersede




        What you can do instead is define a custom variable in the layer properties. Eg, you could call your variable default_stroke_width. Once the variable is defined, you can use it in the expression builder with @default_stroke_width.



        enter image description here



        enter image description here



        Even though this variable has the words "stroke width" in its name, it's not connected to the stroke width box in the style panel. When you want to change the default_stroke_width value, you'll have to go back into layer properties and edit the variable. This is probably less convenient than editing the expression itself.






        share|improve this answer















        You refer to "stroke width" in double quotation marks, which makes it seem like your attribute table has a field called "stroke width." If that's the case, you can use this field in an expression, and scale the line width based on the value in the stroke width field.



        enter image description hereenter image description here




        If, as I suspect, you're actually talking about the stroke width box in the layer styling panel enter image description here, then you can't do what you're asking for. QGIS just isn't designed that way. The value set in the stroke width box is not available in the expression builder. The Data-Defined Override setting will always override the value you enter into the stroke width box. See the second and third definitions of "override" from dictionary.com:




        1. to disregard, set aside, or nullify; countermand

        2. to take precedence over; preempt or supersede




        What you can do instead is define a custom variable in the layer properties. Eg, you could call your variable default_stroke_width. Once the variable is defined, you can use it in the expression builder with @default_stroke_width.



        enter image description here



        enter image description here



        Even though this variable has the words "stroke width" in its name, it's not connected to the stroke width box in the style panel. When you want to change the default_stroke_width value, you'll have to go back into layer properties and edit the variable. This is probably less convenient than editing the expression itself.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 12 at 18:42

























        answered Apr 12 at 18:27









        cskcsk

        10.1k1135




        10.1k1135



























            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%2f318563%2fgetting-value-set-in-binding-input-widget-in-qgis-expression%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

            រឿង រ៉ូមេអូ និង ហ្ស៊ុយលីយេ សង្ខេបរឿង តួអង្គ បញ្ជីណែនាំ

            QGIS export composer to PDF scale the map [closed] Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Print Composer QGIS 2.6, how to export image?QGIS 2.8.1 print composer won't export all OpenCycleMap base layer tilesSave Print/Map QGIS composer view as PNG/PDF using Python (without changing anything in visible layout)?Export QGIS Print Composer PDF with searchable text labelsQGIS Print Composer does not change from landscape to portrait orientation?How can I avoid map size and scale changes in print composer?Fuzzy PDF export in QGIS running on macSierra OSExport the legend into its 100% size using Print ComposerScale-dependent rendering in QGIS PDF output

            PDF-ში გადმოწერა სანავიგაციო მენიუproject page