Doeiqw Dwe
Doeiqw Dwe

Reputation: 153

how to change folium/geojson color

i wish make it different color in different layer, so use the style_function as i googled like below:

style1 = {'fillColor': '#228B22', 'lineColor': '#228B22'}
style2 = {'fillColor': '#00FFFFFF', 'lineColor': '#00FFFFFF'}

test1=gpd.read_file('file2.geojson')
folium.GeoJson(test1,name='test1',style_function=lambda x:style).add_to(mainmap)

test2=gpd.read_file('file1.geojson')
folium.GeoJson(test2,name='test2', style_function=lambda x:style2).add_to(mainmap)

however,it does not work on the line, still the default blue.

Upvotes: 7

Views: 15997

Answers (1)

hugotothechillz
hugotothechillz

Reputation: 81

a simple way to do so is to replace

style1 = {'fillColor': '#228B22', 'lineColor': '#228B22'}
style2 = {'fillColor': '#00FFFFFF', 'lineColor': '#00FFFFFF'}

by

style1 = {'fillColor': '#228B22', 'color': '#228B22'}
style2 = {'fillColor': '#00FFFFFF', 'color': '#00FFFFFF'}

Upvotes: 8

Related Questions