JSFiddle - React, Tailwind, and code Playground
JavaScript
var AddressIcon = L.icon({
iconUrl: 'images/icon-address.png',
iconRetinaUrl: 'images/icon-address.png',
iconSize: [38, 95],
iconAnchor: [22, 94],
popupAnchor: [-3, -76],
shadowSize: [68, 95],
shadowAnchor: [22, 94]
});
var myLayer = L.geoJson("",{ icon : AddressIcon }).addTo(map);
var geojsonFeature;
json_result = $.parseJSON(data);
$.each(json_result,function(key,value) {
geojsonFeature = '';
geojsonFeature = {
"type": "Feature",
"properties": {
"name": value.name,
"amenity": value.address,
"popupContent": "This is where the Rockies play!"
},
"geometry": {
"type": "Point",
"coordinates": [value.lon,value.lat]
}
};
myLayer.addData(geojsonFeature);
});