python-visualization / branca

This library is a spinoff from folium, that would host the non-map-specific features.
https://python-visualization.github.io/branca/
MIT License
112 stars 64 forks source link

`scheme_info` wrong copy pasta #114

Closed ajabep closed 1 year ago

ajabep commented 2 years ago

A copy pasta to initialize the scheme_info variable make it wrong.

https://github.com/python-visualization/branca/blob/52b10bd969ac25d0b70640b2eee2ea1d8e8690b3/branca/utilities.py#L134-L135

The copy-paste is wrong, not because of "a bad name for a variable", but because the content loaded is not the expected one. The file _cnames.json does not embed the wanted information in the following line:

https://github.com/python-visualization/branca/blob/52b10bd969ac25d0b70640b2eee2ea1d8e8690b3/branca/utilities.py#L152

Fix

Replace by the right file.

 with open(os.path.join(rootpath, 'scheme_info.json')) as f: 
     scheme_info = json.loads(f.read()) 

Other comment

It may fix https://github.com/python-visualization/branca/issues/104, https://github.com/python-visualization/folium/issues/1270, but not sure, I have not tested.

ajabep commented 2 years ago

It may fix https://github.com/python-visualization/branca/issues/104, https://github.com/python-visualization/folium/issues/1270, but not sure, I have not tested.

Ok. It's a bit more complicated (code never tested...). I'm trying to fix it and open a fancy PR.

@python-visualization / @BibMartin: Why put a maximum value for n at 253 @ branca/utilities.py:108 ?

https://github.com/python-visualization/branca/blob/52b10bd969ac25d0b70640b2eee2ea1d8e8690b3/branca/utilities.py#L108