0

I have a geojson layer. I set the style of some features based on property values. It displays correctly. When "highlight" on a mouseover it changes style to highlight correctly, when I mouseout it changes the style back to the default blue and not the changes made based on property values. As can be seen in the code, I have tried both L.Util.setOption and layer.setStyle. There is no difference with either. Help please.

var schemaL = new L.GeoJSON(schema, {
 onEachFeature:  schemaConvert,
 });

 function schemaConvert(feature,layer) {

  function getOptions(properties) {
     if ((properties.CodeLink == '14159500' && properties.PerFlow > 15) || 
         (properties.CodeLink == '14162200' && properties.PerFlow >1) || 
         (properties.CodeLink == '14158850' && properties.PerFlow > 5)) {
        return {
        weight: 6,
        color: "red",
        fillColor: "#FFCC00"
        };
  }
    }
    layer.setStyle(getOptions(feature.properties));

//  L.Util.setOptions(layer,  (getOptions(feature.properties)));

        layer.on({
            mouseout: function(e) {
               schemaL.resetStyle(this);
               info.update();   
            },

          mouseover: highlightFeature,

        });
 }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.