Reputation: 519
I made a choropleth using leaflet, based on population.
Is there a property in Leaflet that suppose 5 places have population exactly 10 then do not color them at all? Something like no fill?
I am also unable to understand why is there a dark blue color when I have set to be cream.
This is my style function . -999 just denotes the metric was not there and thats why I want to be no fill here.
function style(feature)
{
return {
fill: feature.properties.metric == -999 ? false :true,
fillColor: getColor(feature.properties.metric),
weight: 4,
opacity: 1,
color: feature.properties.metric == -999 ? '#e4e3db' :getColor(feature.properties.metric),
dashArray: feature.properties.metric == -999 ? '' : '3',
fillOpacity: feature.properties.metric == -999 ? 0 : 0.5
};
}
Upvotes: 1
Views: 980
Reputation: 28678
You can disable filling of polygons by using the fill: false
option.
Reference: http://leafletjs.com/reference.html#path-options
Here's a working example on Plunker so you can verify that fill: false
works, just comments out the fill
property line and you'll see: Example: http://plnkr.co/edit/5Kn94H?p=preview
That blue color that shows up is Leafet's default color for polygons. So where you see blue, it must mean that there is something wrong with your statement, featuredata or getColor method. But it's hard to say since you've left out a sample of your data, the getColor method and didn't supply a testcase on Fiddle/Plunker or somewhere else.
Upvotes: 1