Adding Geojson Feature Attributes To Mapbox Popup
I am looking to add a popup with geoJSON attributes to each book store marker on my map. I have used 'layer.feature.properties.name' within the marker.bindpopup method, but am gett
Solution 1:
You're using the layer
variable:
marker.bindPopup("<p>" + layer.feature.properties.name + "</p>");
The layer
variable does not contain the feature
object. You are looping over the contained layers assigning them to the marker
variable, those have the feature
object, so you should that:
marker.bindPopup("<p>" + marker.feature.properties.name + "</p>");
Post a Comment for "Adding Geojson Feature Attributes To Mapbox Popup"