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;
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
add a comment |
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
add a comment |
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
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
javascript leaflet
edited Mar 22 at 15:42
chazsolo
5,41011234
5,41011234
asked Mar 22 at 14:59
MatthieuMatthieu
245
245
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
add a comment |
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
add a comment |
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
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
edited Mar 24 at 6:38
answered Mar 24 at 4:32
lusitanicalusitanica
755514
755514
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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