QGIS: use geometry from different layer in symbology expression












5















I have a project with multiple layers.
The purple dots are from a pointfile with the symbology-expression:
z($geometry)> '14.5'. (so it only displays a purple dot when the Z-value is more than 14.5m).



I have a second layer with polygons, visible as the partly-transparent arc-area in red.



The next step i want to make in my project is to:
have the purple dots appear only if:
z($geometry)>'14.5' AND
the x-y of that spot is within the geographical extent of the polygon from the second layer



What step do i have to take to get this done.



example without last step










share|improve this question





























    5















    I have a project with multiple layers.
    The purple dots are from a pointfile with the symbology-expression:
    z($geometry)> '14.5'. (so it only displays a purple dot when the Z-value is more than 14.5m).



    I have a second layer with polygons, visible as the partly-transparent arc-area in red.



    The next step i want to make in my project is to:
    have the purple dots appear only if:
    z($geometry)>'14.5' AND
    the x-y of that spot is within the geographical extent of the polygon from the second layer



    What step do i have to take to get this done.



    example without last step










    share|improve this question



























      5












      5








      5


      2






      I have a project with multiple layers.
      The purple dots are from a pointfile with the symbology-expression:
      z($geometry)> '14.5'. (so it only displays a purple dot when the Z-value is more than 14.5m).



      I have a second layer with polygons, visible as the partly-transparent arc-area in red.



      The next step i want to make in my project is to:
      have the purple dots appear only if:
      z($geometry)>'14.5' AND
      the x-y of that spot is within the geographical extent of the polygon from the second layer



      What step do i have to take to get this done.



      example without last step










      share|improve this question
















      I have a project with multiple layers.
      The purple dots are from a pointfile with the symbology-expression:
      z($geometry)> '14.5'. (so it only displays a purple dot when the Z-value is more than 14.5m).



      I have a second layer with polygons, visible as the partly-transparent arc-area in red.



      The next step i want to make in my project is to:
      have the purple dots appear only if:
      z($geometry)>'14.5' AND
      the x-y of that spot is within the geographical extent of the polygon from the second layer



      What step do i have to take to get this done.



      example without last step







      qgis symbology z-value






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 2 at 21:25









      Matthias Kuhn

      19k14890




      19k14890










      asked Mar 2 at 21:17









      CaptainAhabCaptainAhab

      807




      807






















          1 Answer
          1






          active

          oldest

          votes


















          8














          Your question is very similar to what I've done here recently.



          I used expression:



          if(
          within($geometry,geometry(get_feature(layer,attribute,value))),
          result_when_true,
          result_when_false
          )


          In your case step 1: filter data table by



          z($geometry)> '14.5'


          step 2: paste expression in point symbology layer (see gif to find where)



          if(
          within($geometry,geometry(get_feature('your_polygon_layer_name','the_layers_field','feature_data'))),
          1,
          0
          )


          You can use the same expression for labels but must change 1 and 0 values to "label_field_name" and to null.



          That's it.



          enter image description here






          share|improve this answer


























          • Good answer! Would it work to drop the if-part completely and just use within(...)?

            – Matthias Kuhn
            Mar 2 at 23:41











          • Nope it wouldn't.

            – Vitruvius
            Mar 3 at 5:28











          • That's surprising... Did you try?

            – Matthias Kuhn
            Mar 3 at 7:04











          • Is it possible that this doesn' t work in rule-based symbology? I can get it work in a test environment, but not in my project. I used if( within($geometry,geometry(get_feature('bronpolygonen_4a087198_dafa_4185_a358_d410ed1a980e','TYPECTRL','MONITOR HOOFD VERLICHT'))), 1, 0 )

            – CaptainAhab
            Mar 4 at 16:54













          • Or is it possible that my dataset is just to big (626000 features)?

            – CaptainAhab
            Mar 4 at 17:29











          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%2f314167%2fqgis-use-geometry-from-different-layer-in-symbology-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









          8














          Your question is very similar to what I've done here recently.



          I used expression:



          if(
          within($geometry,geometry(get_feature(layer,attribute,value))),
          result_when_true,
          result_when_false
          )


          In your case step 1: filter data table by



          z($geometry)> '14.5'


          step 2: paste expression in point symbology layer (see gif to find where)



          if(
          within($geometry,geometry(get_feature('your_polygon_layer_name','the_layers_field','feature_data'))),
          1,
          0
          )


          You can use the same expression for labels but must change 1 and 0 values to "label_field_name" and to null.



          That's it.



          enter image description here






          share|improve this answer


























          • Good answer! Would it work to drop the if-part completely and just use within(...)?

            – Matthias Kuhn
            Mar 2 at 23:41











          • Nope it wouldn't.

            – Vitruvius
            Mar 3 at 5:28











          • That's surprising... Did you try?

            – Matthias Kuhn
            Mar 3 at 7:04











          • Is it possible that this doesn' t work in rule-based symbology? I can get it work in a test environment, but not in my project. I used if( within($geometry,geometry(get_feature('bronpolygonen_4a087198_dafa_4185_a358_d410ed1a980e','TYPECTRL','MONITOR HOOFD VERLICHT'))), 1, 0 )

            – CaptainAhab
            Mar 4 at 16:54













          • Or is it possible that my dataset is just to big (626000 features)?

            – CaptainAhab
            Mar 4 at 17:29
















          8














          Your question is very similar to what I've done here recently.



          I used expression:



          if(
          within($geometry,geometry(get_feature(layer,attribute,value))),
          result_when_true,
          result_when_false
          )


          In your case step 1: filter data table by



          z($geometry)> '14.5'


          step 2: paste expression in point symbology layer (see gif to find where)



          if(
          within($geometry,geometry(get_feature('your_polygon_layer_name','the_layers_field','feature_data'))),
          1,
          0
          )


          You can use the same expression for labels but must change 1 and 0 values to "label_field_name" and to null.



          That's it.



          enter image description here






          share|improve this answer


























          • Good answer! Would it work to drop the if-part completely and just use within(...)?

            – Matthias Kuhn
            Mar 2 at 23:41











          • Nope it wouldn't.

            – Vitruvius
            Mar 3 at 5:28











          • That's surprising... Did you try?

            – Matthias Kuhn
            Mar 3 at 7:04











          • Is it possible that this doesn' t work in rule-based symbology? I can get it work in a test environment, but not in my project. I used if( within($geometry,geometry(get_feature('bronpolygonen_4a087198_dafa_4185_a358_d410ed1a980e','TYPECTRL','MONITOR HOOFD VERLICHT'))), 1, 0 )

            – CaptainAhab
            Mar 4 at 16:54













          • Or is it possible that my dataset is just to big (626000 features)?

            – CaptainAhab
            Mar 4 at 17:29














          8












          8








          8







          Your question is very similar to what I've done here recently.



          I used expression:



          if(
          within($geometry,geometry(get_feature(layer,attribute,value))),
          result_when_true,
          result_when_false
          )


          In your case step 1: filter data table by



          z($geometry)> '14.5'


          step 2: paste expression in point symbology layer (see gif to find where)



          if(
          within($geometry,geometry(get_feature('your_polygon_layer_name','the_layers_field','feature_data'))),
          1,
          0
          )


          You can use the same expression for labels but must change 1 and 0 values to "label_field_name" and to null.



          That's it.



          enter image description here






          share|improve this answer















          Your question is very similar to what I've done here recently.



          I used expression:



          if(
          within($geometry,geometry(get_feature(layer,attribute,value))),
          result_when_true,
          result_when_false
          )


          In your case step 1: filter data table by



          z($geometry)> '14.5'


          step 2: paste expression in point symbology layer (see gif to find where)



          if(
          within($geometry,geometry(get_feature('your_polygon_layer_name','the_layers_field','feature_data'))),
          1,
          0
          )


          You can use the same expression for labels but must change 1 and 0 values to "label_field_name" and to null.



          That's it.



          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 2 at 23:19

























          answered Mar 2 at 22:02









          VitruviusVitruvius

          489210




          489210













          • Good answer! Would it work to drop the if-part completely and just use within(...)?

            – Matthias Kuhn
            Mar 2 at 23:41











          • Nope it wouldn't.

            – Vitruvius
            Mar 3 at 5:28











          • That's surprising... Did you try?

            – Matthias Kuhn
            Mar 3 at 7:04











          • Is it possible that this doesn' t work in rule-based symbology? I can get it work in a test environment, but not in my project. I used if( within($geometry,geometry(get_feature('bronpolygonen_4a087198_dafa_4185_a358_d410ed1a980e','TYPECTRL','MONITOR HOOFD VERLICHT'))), 1, 0 )

            – CaptainAhab
            Mar 4 at 16:54













          • Or is it possible that my dataset is just to big (626000 features)?

            – CaptainAhab
            Mar 4 at 17:29



















          • Good answer! Would it work to drop the if-part completely and just use within(...)?

            – Matthias Kuhn
            Mar 2 at 23:41











          • Nope it wouldn't.

            – Vitruvius
            Mar 3 at 5:28











          • That's surprising... Did you try?

            – Matthias Kuhn
            Mar 3 at 7:04











          • Is it possible that this doesn' t work in rule-based symbology? I can get it work in a test environment, but not in my project. I used if( within($geometry,geometry(get_feature('bronpolygonen_4a087198_dafa_4185_a358_d410ed1a980e','TYPECTRL','MONITOR HOOFD VERLICHT'))), 1, 0 )

            – CaptainAhab
            Mar 4 at 16:54













          • Or is it possible that my dataset is just to big (626000 features)?

            – CaptainAhab
            Mar 4 at 17:29

















          Good answer! Would it work to drop the if-part completely and just use within(...)?

          – Matthias Kuhn
          Mar 2 at 23:41





          Good answer! Would it work to drop the if-part completely and just use within(...)?

          – Matthias Kuhn
          Mar 2 at 23:41













          Nope it wouldn't.

          – Vitruvius
          Mar 3 at 5:28





          Nope it wouldn't.

          – Vitruvius
          Mar 3 at 5:28













          That's surprising... Did you try?

          – Matthias Kuhn
          Mar 3 at 7:04





          That's surprising... Did you try?

          – Matthias Kuhn
          Mar 3 at 7:04













          Is it possible that this doesn' t work in rule-based symbology? I can get it work in a test environment, but not in my project. I used if( within($geometry,geometry(get_feature('bronpolygonen_4a087198_dafa_4185_a358_d410ed1a980e','TYPECTRL','MONITOR HOOFD VERLICHT'))), 1, 0 )

          – CaptainAhab
          Mar 4 at 16:54







          Is it possible that this doesn' t work in rule-based symbology? I can get it work in a test environment, but not in my project. I used if( within($geometry,geometry(get_feature('bronpolygonen_4a087198_dafa_4185_a358_d410ed1a980e','TYPECTRL','MONITOR HOOFD VERLICHT'))), 1, 0 )

          – CaptainAhab
          Mar 4 at 16:54















          Or is it possible that my dataset is just to big (626000 features)?

          – CaptainAhab
          Mar 4 at 17:29





          Or is it possible that my dataset is just to big (626000 features)?

          – CaptainAhab
          Mar 4 at 17:29


















          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%2f314167%2fqgis-use-geometry-from-different-layer-in-symbology-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

          How to change which sound is reproduced for terminal bell?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

          Can I use Tabulator js library in my java Spring + Thymeleaf project?