title: Interactive Choropleth Map - Highlighting - getcolor function
body: <p>I'm trying to create a map of bicycle routes which will get color from properties from geojson file. It is based on Interactive Choropleth Map. The problem I have at the moment is highlighting. This part of the code checks in geojson properties the colour of route:</p>
  
  <pre><code>function getColor(d) {
      return d == 'red' ? 'red' :
             d == 'blue' ? 'blue' :
             d == 'green' ? 'green' :
             d == 'black' ? 'black' :
             d == 'yellow' ? 'yellow' :
                  'orange';
  }
  
  function style(feature) {
      return {
          weight: 2,
          opacity: 1,
          color: getColor(feature.properties.colour),
          dashArray: '3',
          fillOpacity: 0.7,
  
      };
  }
  </code></pre>
  
  <p>It works ok but when I try to use the same function "get color" on highlighting :</p>
  
  <pre><code>function highlightFeature(e) {
      var layer = e.target;
  
      layer.setStyle({
          weight: 5,
          color: getColor(feature.properties.colour),
          dashArray: '',
          fillOpacity: 0.7
      });
  </code></pre>
  
  <p>It doesn't highlight in the colors from properties of geojson. It's probably some small problem but I'm still learning and I don't understand it. Could someone explain it and point a solution, please? Thanks very much!
  Here's a working example (not full working of course as I'm still learning):</p>
  
  <p><a href="http://members.upcpoczta.pl/w.racek/mapa.html" rel="nofollow">http://members.upcpoczta.pl/w.racek/mapa.html</a></p>
  
  <p>Thanks!</p>