I wanted to pass a value in pixels to the width and height parameters of Map, but found I couldn't. That seemed weird to me. Turns out there are two issues:
_parse_size only allows an integer, which it interprets as pixels, or something like '80 %'. It doesn't allow '800 px', which I think it should.
branca and folium both have the same nearly identical utility functions, such as _parse_size.
Lengths in CSS can have many units other than '%' or 'px': https://developer.mozilla.org/en-US/docs/Web/CSS/length. I think we should trust our users to know what unit they want to use. Change _parse_size to allow any unit. Add tests.
Why does _parse_size return the value and the unit separately? It makes our templates more verbose. We could just as well make it convert integers to strings, then returning those. But that's a bigger change.
I wanted to pass a value in pixels to the width and height parameters of
Map
, but found I couldn't. That seemed weird to me. Turns out there are two issues:_parse_size
only allows an integer, which it interprets as pixels, or something like '80 %'. It doesn't allow '800 px', which I think it should._parse_size
.Lengths in CSS can have many units other than '%' or 'px': https://developer.mozilla.org/en-US/docs/Web/CSS/length. I think we should trust our users to know what unit they want to use. Change
_parse_size
to allow any unit. Add tests.Other
In another change in folium I'll propose we'll remove the duplicate utility functions and use the ones from branca instead: https://github.com/python-visualization/folium/pull/1676
Why does
_parse_size
return the value and the unit separately? It makes our templates more verbose. We could just as well make it convert integers to strings, then returning those. But that's a bigger change.