var geojsonMarkers = { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-1.44985, 53.26501] }, "properties": { "Heading": "Road block", "Description": "Location: Dunston Lane
Message: Road not gritted as it is closed for roadworks ", "DateAdded": "23/11/2017 14:31:23", "RouteDetails": "", "IconStyle": "iconRoadBlock" } } ] }; var markersLayer = L.geoJson(geojsonMarkers, { pointToLayer: function (feature, latlng) { if (feature.properties.IconStyle == 'iconParkingAlert'){ var iconName = iconParkingAlert; } if (feature.properties.IconStyle == 'iconOrange'){ var iconName = iconOrange; } if (feature.properties.IconStyle == 'iconPurple'){ var iconName = iconPurple; } if (feature.properties.IconStyle == 'iconBlue'){ var iconName = iconBlue; } if (feature.properties.IconStyle == 'iconParking'){ var iconName = iconParking; } if (feature.properties.IconStyle == 'iconPlain'){ var iconName = iconPlain; } if (feature.properties.IconStyle == 'iconBrightGreen'){ var iconName = iconBrightGreen; } if (feature.properties.IconStyle == 'iconInfo'){ var iconName = iconInfo; } if (feature.properties.IconStyle == 'iconAlert'){ var iconName = iconAlert; } if (feature.properties.IconStyle == 'iconRoadBlock'){ var iconName = iconRoadBlock; } return L.marker(latlng, { icon: iconName }); }, onEachFeature: function (feature, layer) { var popupText = '

' + feature.properties.Description + '

'; popupText += 'Date added: ' + feature.properties.DateAdded; layer.bindPopup(popupText); } }).addTo(map);