Combining popup info from overlapping polygons in Mapbox Studio? The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)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

Working through the single responsibility principle (SRP) in Python when calls are expensive

What information about me do stores get via my credit card?

"... to apply for a visa" or "... and applied for a visa"?

What can I do if neighbor is blocking my solar panels intentionally?

Word for: a synonym with a positive connotation?

How to determine omitted units in a publication

"is" operation returns false even though two objects have same id

Am I ethically obligated to go into work on an off day if the reason is sudden?

How to handle characters who are more educated than the author?

Can we generate random numbers using irrational numbers like π and e?

How do I design a circuit to convert a 100 mV and 50 Hz sine wave to a square wave?

60's-70's movie: home appliances revolting against the owners

What was the last x86 CPU that did not have the x87 floating-point unit built in?

Can a flute soloist sit?

How to politely respond to generic emails requesting a PhD/job in my lab? Without wasting too much time

For what reasons would an animal species NOT cross a *horizontal* land bridge?

How to read αἱμύλιος or when to aspirate

Why can't wing-mounted spoilers be used to steepen approaches?

Is there a writing software that you can sort scenes like slides in PowerPoint?

How many cones with angle theta can I pack into the unit sphere?

Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?

Is 'stolen' appropriate word?

How to make Illustrator type tool selection automatically adapt with text length

Do warforged have souls?



Combining popup info from overlapping polygons in Mapbox Studio?



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)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






























    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


























      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




















          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

          Crop image to path created in TikZ? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Crop an inserted image?TikZ pictures does not appear in posterImage behind and beyond crop marks?Tikz picture as large as possible on A4 PageTransparency vs image compression dilemmaHow to crop background from image automatically?Image does not cropTikzexternal capturing crop marks when externalizing pgfplots?How to include image path that contains a dollar signCrop image with left size given

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

          Ромео және Джульетта Мазмұны Қысқаша сипаттамасы Кейіпкерлері Кино Дереккөздер Бағыттау мәзірі