title: How to customize leaflet style function to get color depending on properties values
body: <p>I have a dimension called length on geojson properties. I have a drop down list and want to filter by length for example and get different layers colors.</p>
  <pre><code>function getColor_by_length(d){
      return d &gt; 9 ? '#800026' :
             d &gt; 5 ? '#BD0026' :
             d &gt; 3 ? '#E31A1C' :
             d &gt; 0 ? '#FC4E2A' :
                     '#FFEDA0';
  }
  
  function linkDropDown(){
      var linkSelector = document.getElementById('linkSelector')    
      if (linkSelector.value == &quot;length&quot;){
          geo_json_layer.eachLayer(function (layer) {
              layer.setStyle({fillColor: getColor_by_length(layer.feature.properties.length)})
          });
      }
  </code></pre>
  <p>I always get only one and same color for all my layer. I couldn't figure out where I am wrong. Any idea please?</p>