Combining popup info from overlapping polygons in Mapbox Studio?Combining popup info from overlapping...

Is a tag line useful on a cover?

Prove that NP is closed under karp reduction?

To string or not to string

What would happen to a modern skyscraper if it rains micro blackholes?

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)

What do you call a Matrix-like slowdown and camera movement effect?

"to be prejudice towards/against someone" vs "to be prejudiced against/towards someone"

Languages that we cannot (dis)prove to be Context-Free

Finding angle with pure Geometry.

Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?

How can I make my BBEG immortal short of making them a Lich or Vampire?

Font hinting is lost in Chrome-like browsers (for some languages )

Why can't I see bouncing of a switch on an oscilloscope?

Is it important to consider tone, melody, and musical form while writing a song?

Can a Warlock become Neutral Good?

Theorems that impeded progress

Why doesn't H₄O²⁺ exist?

Why doesn't Newton's third law mean a person bounces back to where they started when they hit the ground?

What do the dots in this tr command do: tr .............A-Z A-ZA-Z <<< "JVPQBOV" (with 13 dots)

Why don't electron-positron collisions release infinite energy?

What does it mean to describe someone as a butt steak?

Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?

can i play a electric guitar through a bass amp?

Is it legal for company to use my work email to pretend I still work there?



Combining popup info from overlapping polygons in Mapbox Studio?


Combining popup info from overlapping polygons in Mapbox GL JSProblems with features, popups and strategy with OpenLayersOverride Mapbox Studio minzoomLabel orientation in Mapbox Studio or Mapbox GL JSMapbox Studio tileset is missing the bottom corner of polygon after upload to studioExporting vector tiles from Mapbox Studio?Popup in Mapbox Studiomapbox studio large shapefile datasetCombining popup info from overlapping polygons in Mapbox GL JSSymbolizing field with many values in Mapbox Studio?Popups offset from points Mapbox GL JS






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







1















I'm trying to display popup information from overlapping polygons similar to this question, but instead of a click, I'm using the mouse over to identify my popup. In areas that have overlapping polygons, I'd like to display the Name and Description from all polygons. I'm trying to incorporate the correct answer to my particular case, but I'm just not understanding the logic.



My Original Code



   //change info window on hover
map.on('mousemove', function(e) {
var neighborhood = map.queryRenderedFeatures(e.point, {
layers: ['Neighborhood_layer']
});

if (neighborhood.length > 0) {
document.getElementById('pd').innerHTML =
"<p><em>Name: " + neighborhood[0].properties.Name +
"<p><em>Name: " + neighborhood[0].properties.Description +
"</em></p>";
} else {
document.getElementById('pd').innerHTML = '<p>Hover over a Neighborhood</p>';
}
});
});


My Attempt



  //change info window on hover
map.on('mousemove', function(e) {
var neighborhood = map.queryRenderedFeatures(e.point, {
layers: ['Neighborhood_layer']
setHTML(e.features.map(function(neighborhood) { return feature.properties.Name; }).join(', '))
setHTML(e.features.map(function(neighborhood) { return feature.properties.Description; }).join(', '))
});

if (neighborhood.length > 0) {
document.getElementById('pd').innerHTML =
"<p><em>Name: " + neighborhood[0].properties.Name +
"<p><em>Name: " + neighborhood[0].properties.Description +
"</em></p>";
} else {
document.getElementById('pd').innerHTML = '<p>Hover over a Neighborhood</p>';

});
});


UPDATED Attempt
I'm not understanding the logic, but if I change neighborhood [0] to neighborhood [1], I'm able to identify most overlapping features but not all...



  //change info window on hover
map.on('mousemove', function(e) {
var neighborhood = map.queryRenderedFeatures(e.point, {
layers: ['Neighborhood_layer']
setHTML(e.features.map(function(neighborhood) { return feature.properties.Name; }).join(', '))
setHTML(e.features.map(function(neighborhood) { return feature.properties.Description; }).join(', '))
});

if (neighborhood.length > 0) {
document.getElementById('pd').innerHTML =
"<p><em>Name: " + neighborhood[1].properties.Name +
"<p><em>Name: " + neighborhood[1].properties.Description +
"</em></p>";
} else {
document.getElementById('pd').innerHTML = '<p>Hover over a Neighborhood</p>';

});
});









share|improve this question
















bumped to the homepage by Community 21 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















    1















    I'm trying to display popup information from overlapping polygons similar to this question, but instead of a click, I'm using the mouse over to identify my popup. In areas that have overlapping polygons, I'd like to display the Name and Description from all polygons. I'm trying to incorporate the correct answer to my particular case, but I'm just not understanding the logic.



    My Original Code



       //change info window on hover
    map.on('mousemove', function(e) {
    var neighborhood = map.queryRenderedFeatures(e.point, {
    layers: ['Neighborhood_layer']
    });

    if (neighborhood.length > 0) {
    document.getElementById('pd').innerHTML =
    "<p><em>Name: " + neighborhood[0].properties.Name +
    "<p><em>Name: " + neighborhood[0].properties.Description +
    "</em></p>";
    } else {
    document.getElementById('pd').innerHTML = '<p>Hover over a Neighborhood</p>';
    }
    });
    });


    My Attempt



      //change info window on hover
    map.on('mousemove', function(e) {
    var neighborhood = map.queryRenderedFeatures(e.point, {
    layers: ['Neighborhood_layer']
    setHTML(e.features.map(function(neighborhood) { return feature.properties.Name; }).join(', '))
    setHTML(e.features.map(function(neighborhood) { return feature.properties.Description; }).join(', '))
    });

    if (neighborhood.length > 0) {
    document.getElementById('pd').innerHTML =
    "<p><em>Name: " + neighborhood[0].properties.Name +
    "<p><em>Name: " + neighborhood[0].properties.Description +
    "</em></p>";
    } else {
    document.getElementById('pd').innerHTML = '<p>Hover over a Neighborhood</p>';

    });
    });


    UPDATED Attempt
    I'm not understanding the logic, but if I change neighborhood [0] to neighborhood [1], I'm able to identify most overlapping features but not all...



      //change info window on hover
    map.on('mousemove', function(e) {
    var neighborhood = map.queryRenderedFeatures(e.point, {
    layers: ['Neighborhood_layer']
    setHTML(e.features.map(function(neighborhood) { return feature.properties.Name; }).join(', '))
    setHTML(e.features.map(function(neighborhood) { return feature.properties.Description; }).join(', '))
    });

    if (neighborhood.length > 0) {
    document.getElementById('pd').innerHTML =
    "<p><em>Name: " + neighborhood[1].properties.Name +
    "<p><em>Name: " + neighborhood[1].properties.Description +
    "</em></p>";
    } else {
    document.getElementById('pd').innerHTML = '<p>Hover over a Neighborhood</p>';

    });
    });









    share|improve this question
















    bumped to the homepage by Community 21 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      1












      1








      1








      I'm trying to display popup information from overlapping polygons similar to this question, but instead of a click, I'm using the mouse over to identify my popup. In areas that have overlapping polygons, I'd like to display the Name and Description from all polygons. I'm trying to incorporate the correct answer to my particular case, but I'm just not understanding the logic.



      My Original Code



         //change info window on hover
      map.on('mousemove', function(e) {
      var neighborhood = map.queryRenderedFeatures(e.point, {
      layers: ['Neighborhood_layer']
      });

      if (neighborhood.length > 0) {
      document.getElementById('pd').innerHTML =
      "<p><em>Name: " + neighborhood[0].properties.Name +
      "<p><em>Name: " + neighborhood[0].properties.Description +
      "</em></p>";
      } else {
      document.getElementById('pd').innerHTML = '<p>Hover over a Neighborhood</p>';
      }
      });
      });


      My Attempt



        //change info window on hover
      map.on('mousemove', function(e) {
      var neighborhood = map.queryRenderedFeatures(e.point, {
      layers: ['Neighborhood_layer']
      setHTML(e.features.map(function(neighborhood) { return feature.properties.Name; }).join(', '))
      setHTML(e.features.map(function(neighborhood) { return feature.properties.Description; }).join(', '))
      });

      if (neighborhood.length > 0) {
      document.getElementById('pd').innerHTML =
      "<p><em>Name: " + neighborhood[0].properties.Name +
      "<p><em>Name: " + neighborhood[0].properties.Description +
      "</em></p>";
      } else {
      document.getElementById('pd').innerHTML = '<p>Hover over a Neighborhood</p>';

      });
      });


      UPDATED Attempt
      I'm not understanding the logic, but if I change neighborhood [0] to neighborhood [1], I'm able to identify most overlapping features but not all...



        //change info window on hover
      map.on('mousemove', function(e) {
      var neighborhood = map.queryRenderedFeatures(e.point, {
      layers: ['Neighborhood_layer']
      setHTML(e.features.map(function(neighborhood) { return feature.properties.Name; }).join(', '))
      setHTML(e.features.map(function(neighborhood) { return feature.properties.Description; }).join(', '))
      });

      if (neighborhood.length > 0) {
      document.getElementById('pd').innerHTML =
      "<p><em>Name: " + neighborhood[1].properties.Name +
      "<p><em>Name: " + neighborhood[1].properties.Description +
      "</em></p>";
      } else {
      document.getElementById('pd').innerHTML = '<p>Hover over a Neighborhood</p>';

      });
      });









      share|improve this question
















      I'm trying to display popup information from overlapping polygons similar to this question, but instead of a click, I'm using the mouse over to identify my popup. In areas that have overlapping polygons, I'd like to display the Name and Description from all polygons. I'm trying to incorporate the correct answer to my particular case, but I'm just not understanding the logic.



      My Original Code



         //change info window on hover
      map.on('mousemove', function(e) {
      var neighborhood = map.queryRenderedFeatures(e.point, {
      layers: ['Neighborhood_layer']
      });

      if (neighborhood.length > 0) {
      document.getElementById('pd').innerHTML =
      "<p><em>Name: " + neighborhood[0].properties.Name +
      "<p><em>Name: " + neighborhood[0].properties.Description +
      "</em></p>";
      } else {
      document.getElementById('pd').innerHTML = '<p>Hover over a Neighborhood</p>';
      }
      });
      });


      My Attempt



        //change info window on hover
      map.on('mousemove', function(e) {
      var neighborhood = map.queryRenderedFeatures(e.point, {
      layers: ['Neighborhood_layer']
      setHTML(e.features.map(function(neighborhood) { return feature.properties.Name; }).join(', '))
      setHTML(e.features.map(function(neighborhood) { return feature.properties.Description; }).join(', '))
      });

      if (neighborhood.length > 0) {
      document.getElementById('pd').innerHTML =
      "<p><em>Name: " + neighborhood[0].properties.Name +
      "<p><em>Name: " + neighborhood[0].properties.Description +
      "</em></p>";
      } else {
      document.getElementById('pd').innerHTML = '<p>Hover over a Neighborhood</p>';

      });
      });


      UPDATED Attempt
      I'm not understanding the logic, but if I change neighborhood [0] to neighborhood [1], I'm able to identify most overlapping features but not all...



        //change info window on hover
      map.on('mousemove', function(e) {
      var neighborhood = map.queryRenderedFeatures(e.point, {
      layers: ['Neighborhood_layer']
      setHTML(e.features.map(function(neighborhood) { return feature.properties.Name; }).join(', '))
      setHTML(e.features.map(function(neighborhood) { return feature.properties.Description; }).join(', '))
      });

      if (neighborhood.length > 0) {
      document.getElementById('pd').innerHTML =
      "<p><em>Name: " + neighborhood[1].properties.Name +
      "<p><em>Name: " + neighborhood[1].properties.Description +
      "</em></p>";
      } else {
      document.getElementById('pd').innerHTML = '<p>Hover over a Neighborhood</p>';

      });
      });






      mapbox popup mapbox-gl-js mapbox-gl mapbox-studio






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 25 '18 at 16:40







      pac_co

















      asked Jul 24 '18 at 13:47









      pac_copac_co

      329111




      329111





      bumped to the homepage by Community 21 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 21 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          neighbourhood is an Array of features under the mouse, so where you are grabbing the first only with neighbourhood[0] you can iterate over or concatenate.






          share|improve this answer
























          • Andrew, thank you so much for responding!! If I'm understanding you correctly, the neighborhood[0] only grabs the first one. Now how would I change that to include the other overlapping features? Sorry, I'm new to this!

            – pac_co
            Jul 25 '18 at 1:50












          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%2f290488%2fcombining-popup-info-from-overlapping-polygons-in-mapbox-studio%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









          0














          neighbourhood is an Array of features under the mouse, so where you are grabbing the first only with neighbourhood[0] you can iterate over or concatenate.






          share|improve this answer
























          • Andrew, thank you so much for responding!! If I'm understanding you correctly, the neighborhood[0] only grabs the first one. Now how would I change that to include the other overlapping features? Sorry, I'm new to this!

            – pac_co
            Jul 25 '18 at 1:50
















          0














          neighbourhood is an Array of features under the mouse, so where you are grabbing the first only with neighbourhood[0] you can iterate over or concatenate.






          share|improve this answer
























          • Andrew, thank you so much for responding!! If I'm understanding you correctly, the neighborhood[0] only grabs the first one. Now how would I change that to include the other overlapping features? Sorry, I'm new to this!

            – pac_co
            Jul 25 '18 at 1:50














          0












          0








          0







          neighbourhood is an Array of features under the mouse, so where you are grabbing the first only with neighbourhood[0] you can iterate over or concatenate.






          share|improve this answer













          neighbourhood is an Array of features under the mouse, so where you are grabbing the first only with neighbourhood[0] you can iterate over or concatenate.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 25 '18 at 1:26









          AndrewHarveyAndrewHarvey

          1,117510




          1,117510













          • Andrew, thank you so much for responding!! If I'm understanding you correctly, the neighborhood[0] only grabs the first one. Now how would I change that to include the other overlapping features? Sorry, I'm new to this!

            – pac_co
            Jul 25 '18 at 1:50



















          • Andrew, thank you so much for responding!! If I'm understanding you correctly, the neighborhood[0] only grabs the first one. Now how would I change that to include the other overlapping features? Sorry, I'm new to this!

            – pac_co
            Jul 25 '18 at 1:50

















          Andrew, thank you so much for responding!! If I'm understanding you correctly, the neighborhood[0] only grabs the first one. Now how would I change that to include the other overlapping features? Sorry, I'm new to this!

          – pac_co
          Jul 25 '18 at 1:50





          Andrew, thank you so much for responding!! If I'm understanding you correctly, the neighborhood[0] only grabs the first one. Now how would I change that to include the other overlapping features? Sorry, I'm new to this!

          – pac_co
          Jul 25 '18 at 1:50


















          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%2f290488%2fcombining-popup-info-from-overlapping-polygons-in-mapbox-studio%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

          Щит и меч (фильм) Содержание Названия серий | Сюжет |...

          is 'sed' thread safeWhat should someone know about using Python scripts in the shell?Nexenta bash script uses...

          Meter-Bus Содержание Параметры шины | Стандартизация |...