Learn how to customize the fill and border color for leaflet GeoJSON layers with the following options.
/**
* Generates GeoJSON layers and assigns event handlers.
*/
private createGeoJsonLayer(geodata: any, map: L.Map): L.GeoJSON<any> {
const layers: L.GeoJSON<any> = L.geoJSON(geodata as any, {
style: {
weight: 2,
color: 'orange',
opacity: 0.8,
fillColor: 'red',
fillOpacity: 0.6,
},
onEachFeature: (feature, layer) => {
this.onEachFeature(feature, layer);
},
});
Check out this Angular demo:
Want to change the selection fill and border colors?
Currently set to blue fill and yellow border, find out how to customize these values and locate leaflet's documentation for more options.