Skip to content

Commit

Permalink
WmsTileLayer: allow cql_filter parameter (#1673)
Browse files Browse the repository at this point in the history
* WmsTileLayer: allow cql_filter parameter

* add test

* avoid function argument
  • Loading branch information
Conengmo committed Nov 29, 2022
1 parent 7bd9e8e commit 5c0b8be
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions folium/raster_layers.py
Expand Up @@ -214,6 +214,7 @@ def __init__(
super().__init__(name=name, overlay=overlay, control=control, show=show)
self.url = url
kwargs["format"] = fmt
cql_filter = kwargs.pop("cql_filter", None)
self.options = parse_options(
layers=layers,
styles=styles,
Expand All @@ -222,6 +223,9 @@ def __init__(
attribution=attr,
**kwargs
)
if cql_filter:
# special parameter that shouldn't be camelized
self.options["cql_filter"] = cql_filter


class ImageOverlay(Layer):
Expand Down
7 changes: 6 additions & 1 deletion tests/test_raster_layers.py
Expand Up @@ -59,9 +59,14 @@ def test_wms():
layers="nexrad-n0r-900913",
attr="Weather data © 2012 IEM Nexrad",
transparent=True,
cql_filter="something",
)
w.add_to(m)
m._repr_html_()
html = m.get_root().render()

# verify this special case wasn't converted to lowerCamelCase
assert '"cql_filter": "something",' in html
assert "cqlFilter" not in html

bounds = m.get_bounds()
assert bounds == [[None, None], [None, None]], bounds
Expand Down

0 comments on commit 5c0b8be

Please sign in to comment.