I have GeoJSON that could be either a point or line and I am trying to make the layer red. Here is the code:
function styling(feature) { return { color: 'red', }; } geoms = new L.GeoJSON(jsdata,{ style: styling, onEachFeature: function(feature, layer) { if (feature.properties.Address){ return layer.bindPopup('<b>Segmentid</b> = ' +feature.properties.SegmentID +'<br>'+ '<b>Address</b> = ' +feature.properties.Address) } else if(feature.properties.NodeID){ return layer.bindPopup('<b>NodeID</b> = ' +feature.properties.NodeID +'<br>'+ '<b>Street1</b> = ' +feature.properties.XST1 +'<br>'+ '<b>Street2</b> = ' +feature.properties.XST2 ) } else if(feature.properties.SegmentID){ return layer.bindPopup('<b>SegmentID</b> = ' +feature.properties.SegmentID) } } }); geoms.addTo(map); There is NO error anywhere and the color is the default blue.
pointToLayeroption, see example leafletjs.com/examples/geojson