title: How can I set the opacity of a geojson object or layer in leaflet?
body: <p>I'm trying to apply <code>opacity</code> to a geojson layer in <code>leaflet.js</code>.  The <a href="http://leafletjs.com/examples/geojson.html" rel="noreferrer">documentation</a> seems to show that <code>opacity</code> can be set in the style configuration.</p>
  
  <pre><code>var exteriorStyle = {
      "color": "#ffffff",
      "weight": 0,
      "opacity": 0.99
  };
  
  var exteriorMaskLayer = L.geoJson(exteriorMaskGeojsonPoly, {style: exteriorStyle}).addTo(map);
  </code></pre>
  
  <p>I'd like the object to mask/hide the background map.  Here, using <code>exteriorStyle</code>, the color <em>does</em> get applied to the resulting <code>exteriorMaskLayer</code>, and the polygon is displayed.</p>
  
  <p>However, the <code>opacity</code> value appears to be ignored.</p>
  
  <p>I've also tried using the <code>setOpacity()</code> method of the <code>exteriorMaskLayer</code> with no effect.</p>
  
  <pre><code>var exteriorMaskLayer = L.geoJson(exteriorMaskGeojsonPoly, {style: exteriorStyle}).addTo(map);
  exteriorMaskLayer.setOpacity(1.0);
  </code></pre>
  
  <p>How can I set the opacity of a geojson object or layer in leaflet?</p>
  
  <p><em>using Leaflet-Leaflet-v0.5.1-0-gc1d410f.zip</em></p>