Automatically open popup of the second marker of geoJSON layer Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Leaflet popup does not open on the second click on the markerLeaflet - draggable marker with popup from geojson dataleaflet popup not opening for a particular markerPopulate leaflet popup on clickLeaflet: Load geoJSON file and specific PopUpL.circleMarker leafletChange marker position with click on map layerLeaflet circleMarker popup is now showingLeaflet - Center map on marker, zoom and open popupleaflet popup width on markers loaded with JSON

How to begin with a paragraph in latex

What to do with someone that cheated their way though university and a PhD program?

How long can a nation maintain a technological edge over the rest of the world?

Suing a Police Officer Instead of the Police Department

Translate text contents of an existing file from lower to upper case and copy to a new file

Is Bran literally the world's memory?

In search of the origins of term censor, I hit a dead end stuck with the greek term, to censor, λογοκρίνω

A journey... into the MIND

false 'Security alert' from Google - every login generates mails from 'no-reply@accounts.google.com'

Is it appropriate to mention a relatable company blog post when you're asked about the company?

Does using the Inspiration rules for character defects encourage My Guy Syndrome?

How do I deal with an erroneously large refund?

What do you call an IPA symbol that lacks a name (e.g. ɲ)?

Can gravitational waves pass through a black hole?

Marquee sign letters

Raising a bilingual kid. When should we introduce the majority language?

Is there a way to fake a method response using Mock or Stubs?

What were wait-states, and why was it only an issue for PCs?

Are there existing rules/lore for MTG planeswalkers?

What does こした mean?

Eigenvalues of the Laplacian of the directed De Bruijn graph

Why doesn't the university give past final exams' answers?

Has a Nobel Peace laureate ever been accused of war crimes?

Why aren't road bicycle wheels tiny?



Automatically open popup of the second marker of geoJSON layer



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Leaflet popup does not open on the second click on the markerLeaflet - draggable marker with popup from geojson dataleaflet popup not opening for a particular markerPopulate leaflet popup on clickLeaflet: Load geoJSON file and specific PopUpL.circleMarker leafletChange marker position with click on map layerLeaflet circleMarker popup is now showingLeaflet - Center map on marker, zoom and open popupleaflet popup width on markers loaded with JSON



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















Leaflet 1.3.4



I would like to know how to automatically open the 2nd marker popup of a GeoJSON layer.



With the code below, I manage to open automatically the popup of the 1st marker but not that of the 2nd...



L.geoJSON(data, 
pointToLayer: function (feature, latlng)
var icon_gisement = L.VectorMarkers.icon(
iconColor: "#FFFFFF"
);
return L.marker(latlng,
icon: icon_gisement
);

).bindPopup(function (layer)
return layer.feature.properties.description;
).addTo(map).openPopup();









share|improve this question






























    1















    Leaflet 1.3.4



    I would like to know how to automatically open the 2nd marker popup of a GeoJSON layer.



    With the code below, I manage to open automatically the popup of the 1st marker but not that of the 2nd...



    L.geoJSON(data, 
    pointToLayer: function (feature, latlng)
    var icon_gisement = L.VectorMarkers.icon(
    iconColor: "#FFFFFF"
    );
    return L.marker(latlng,
    icon: icon_gisement
    );

    ).bindPopup(function (layer)
    return layer.feature.properties.description;
    ).addTo(map).openPopup();









    share|improve this question


























      1












      1








      1








      Leaflet 1.3.4



      I would like to know how to automatically open the 2nd marker popup of a GeoJSON layer.



      With the code below, I manage to open automatically the popup of the 1st marker but not that of the 2nd...



      L.geoJSON(data, 
      pointToLayer: function (feature, latlng)
      var icon_gisement = L.VectorMarkers.icon(
      iconColor: "#FFFFFF"
      );
      return L.marker(latlng,
      icon: icon_gisement
      );

      ).bindPopup(function (layer)
      return layer.feature.properties.description;
      ).addTo(map).openPopup();









      share|improve this question
















      Leaflet 1.3.4



      I would like to know how to automatically open the 2nd marker popup of a GeoJSON layer.



      With the code below, I manage to open automatically the popup of the 1st marker but not that of the 2nd...



      L.geoJSON(data, 
      pointToLayer: function (feature, latlng)
      var icon_gisement = L.VectorMarkers.icon(
      iconColor: "#FFFFFF"
      );
      return L.marker(latlng,
      icon: icon_gisement
      );

      ).bindPopup(function (layer)
      return layer.feature.properties.description;
      ).addTo(map).openPopup();






      javascript leaflet






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 22 at 15:42









      chazsolo

      5,41011234




      5,41011234










      asked Mar 22 at 14:59









      MatthieuMatthieu

      245




      245






















          1 Answer
          1






          active

          oldest

          votes


















          0














          In the case that you have a layer of points you´ll need to implement an onEachFeature function:



           function onEachFeature(feature, layer) 
          var popupContent = " " +
          feature.geometry.type + " ";

          if (feature.properties && feature.properties.popupContent)
          popupContent += feature.properties.popupContent;


          layer.bindPopup(popupContent);



          where you´ll invoke the bindPopup, but not in the L.geoJSON, that's where you´ll put the callback for onEachFeature



           L.geoJSON(data, 

          onEachFeature: onEachFeature,

          pointToLayer: function (feature, latlng)
          var icon_gisement = L.VectorMarkers.icon(
          iconColor: "#FFFFFF"
          );
          return L.marker(latlng,
          icon: icon_gisement
          );

          ).addTo(map);


          you can check a fully functional demo with a geojson layer of points I have on CodePen with Leaflet 1.3.4
          https://codepen.io/anon/pen/movBwb






          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            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: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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%2fstackoverflow.com%2fquestions%2f55302431%2fautomatically-open-popup-of-the-second-marker-of-geojson-layer%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














            In the case that you have a layer of points you´ll need to implement an onEachFeature function:



             function onEachFeature(feature, layer) 
            var popupContent = " " +
            feature.geometry.type + " ";

            if (feature.properties && feature.properties.popupContent)
            popupContent += feature.properties.popupContent;


            layer.bindPopup(popupContent);



            where you´ll invoke the bindPopup, but not in the L.geoJSON, that's where you´ll put the callback for onEachFeature



             L.geoJSON(data, 

            onEachFeature: onEachFeature,

            pointToLayer: function (feature, latlng)
            var icon_gisement = L.VectorMarkers.icon(
            iconColor: "#FFFFFF"
            );
            return L.marker(latlng,
            icon: icon_gisement
            );

            ).addTo(map);


            you can check a fully functional demo with a geojson layer of points I have on CodePen with Leaflet 1.3.4
            https://codepen.io/anon/pen/movBwb






            share|improve this answer





























              0














              In the case that you have a layer of points you´ll need to implement an onEachFeature function:



               function onEachFeature(feature, layer) 
              var popupContent = " " +
              feature.geometry.type + " ";

              if (feature.properties && feature.properties.popupContent)
              popupContent += feature.properties.popupContent;


              layer.bindPopup(popupContent);



              where you´ll invoke the bindPopup, but not in the L.geoJSON, that's where you´ll put the callback for onEachFeature



               L.geoJSON(data, 

              onEachFeature: onEachFeature,

              pointToLayer: function (feature, latlng)
              var icon_gisement = L.VectorMarkers.icon(
              iconColor: "#FFFFFF"
              );
              return L.marker(latlng,
              icon: icon_gisement
              );

              ).addTo(map);


              you can check a fully functional demo with a geojson layer of points I have on CodePen with Leaflet 1.3.4
              https://codepen.io/anon/pen/movBwb






              share|improve this answer



























                0












                0








                0







                In the case that you have a layer of points you´ll need to implement an onEachFeature function:



                 function onEachFeature(feature, layer) 
                var popupContent = " " +
                feature.geometry.type + " ";

                if (feature.properties && feature.properties.popupContent)
                popupContent += feature.properties.popupContent;


                layer.bindPopup(popupContent);



                where you´ll invoke the bindPopup, but not in the L.geoJSON, that's where you´ll put the callback for onEachFeature



                 L.geoJSON(data, 

                onEachFeature: onEachFeature,

                pointToLayer: function (feature, latlng)
                var icon_gisement = L.VectorMarkers.icon(
                iconColor: "#FFFFFF"
                );
                return L.marker(latlng,
                icon: icon_gisement
                );

                ).addTo(map);


                you can check a fully functional demo with a geojson layer of points I have on CodePen with Leaflet 1.3.4
                https://codepen.io/anon/pen/movBwb






                share|improve this answer















                In the case that you have a layer of points you´ll need to implement an onEachFeature function:



                 function onEachFeature(feature, layer) 
                var popupContent = " " +
                feature.geometry.type + " ";

                if (feature.properties && feature.properties.popupContent)
                popupContent += feature.properties.popupContent;


                layer.bindPopup(popupContent);



                where you´ll invoke the bindPopup, but not in the L.geoJSON, that's where you´ll put the callback for onEachFeature



                 L.geoJSON(data, 

                onEachFeature: onEachFeature,

                pointToLayer: function (feature, latlng)
                var icon_gisement = L.VectorMarkers.icon(
                iconColor: "#FFFFFF"
                );
                return L.marker(latlng,
                icon: icon_gisement
                );

                ).addTo(map);


                you can check a fully functional demo with a geojson layer of points I have on CodePen with Leaflet 1.3.4
                https://codepen.io/anon/pen/movBwb







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 24 at 6:38

























                answered Mar 24 at 4:32









                lusitanicalusitanica

                755514




                755514





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • 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%2fstackoverflow.com%2fquestions%2f55302431%2fautomatically-open-popup-of-the-second-marker-of-geojson-layer%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

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해