Skip to content

Conversation

sackh
Copy link
Contributor

@sackh sackh commented May 1, 2020

There was small bug in PR #559 if style is not present in input geojson properties, it fails with KeyError while updating style, Hence I added check for it. If style is present in input geojson properties then update the style provided by the user else assign the style.

e.g. from CountriesGeojson notebook

import ipyleaflet as ipyl
import ipywidgets as ipyw
import json
map = ipyl.Map(center=[53.88, 27.45], zoom=4)
label = ipyw.Label(layout=ipyw.Layout(width='100%'))

# geojson layer with hover handler
with open('./europe_110.geo.json') as f:
    data = json.load(f)
layer = ipyl.GeoJSON(data=data, hover_style={'fillColor': 'red'}, style = {'color': 'green', 'opacity':1, 'weight':1.9, 'dashArray':'9', 'fillOpacity':0.1})

This was failing with KeyError style
I have handled this in my changes.

@martinRenou - will you please review this.

@sackh sackh changed the title minor bug fix for the PR #559 which was raised for issue #555 bug fix for the PR #559 which was raised for issue #555 May 2, 2020
@martinRenou
Copy link
Member

Thanks a lot for fixing this issue and spotting it.

This code is getting out of hand it's becoming unreadable though, we might want to rewrite it a bit.

@martinRenou martinRenou merged commit 90d0c4f into jupyter-widgets:master May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants