I have two different layers in a leaflet map. I have one layer in which I would like the popup to return some text from the layer's attributes. They other layer I would like the popup to return an image which I have embedded the link to in the layers attributes. I have successfully implemented both of the layer.bindpopup functions successfully individually but I'm having no luck implementing them together.
function onPlot(feature, layer) {
if (feature.properties) {
layer.bindPopup(
'<img src= "' + feature.properties.Plot +
'" "alt="Elk Hunting Success Trends Plot"' +
' height="500" width="500">');
}
};
function onEachFeature(feature, layer) {
if (feature.properties) {
layer.bindPopup(
'<center>' + feature.properties.Anum +
'<br><center> Hunting District: ' +
feature.properties.DISTRICT +
"<br><center> Elk Hunter Success " +
feature.properties.Success +" %");
}
};
function style (feature,layer){
if (feature.properties) {
return {
color: feature.properties.color,
fillColor: feature.properties.fillColor,
fillOpacity: feature.properties.fillOpacity
};
}
};
var Plot= new L.geoJson(Plots, {
onPlot:onPlot
style:style
}).addTo(map);
var S_2006= new L.geoJson(Success_2006, {
onEachFeature: onEachFeature,
style:style
}).addTo(map);