1

my input is a shapefile, I am trying to save colour code my data based on different Traveltime.

I can pass the data through and save as a html, but it doesnt seem to colour my data.

gjson=isochrone.to_crs(epsg='4326').to_json()
iso=json.loads(gjson)
      
map_Baseline=folium.Map(location=[52.486044, -1.892751],zoom_start=12)

folium.GeoJson(iso,
               name='geojson',
               style_function= lambda x :{
                   'fillcolor': (
                     'green' if  x['properties']['Traveltime'] == '10800'
                     else 'orange' if '7800' == x['properties']['Traveltime'] == '5400' 
                     else 'red'},
           ).add_to(map_Baseline)

folium.LayerControl(iso).add_to(map_Baseline)
map_Baseline.save("map.html")

any ideas? Thanks

stellasia
  • 5,372
  • 4
  • 23
  • 43
Lilly
  • 25
  • 4
  • Does this answer your question? [folium.GeoJson (style function) not working as i want](https://stackoverflow.com/questions/44919669/folium-geojson-style-function-not-working-as-i-want) – stellasia Aug 04 '20 at 16:09
  • @stellasia thank you, I have applied this to my code but i still cant create colour bands based on there property. Not sure what i am missing. – Lilly Aug 05 '20 at 13:29
  • You mean that using `fillColor` instead of `fillcolor` does not work? – stellasia Aug 06 '20 at 13:25

0 Answers0