diff --git a/pycsw/ogc/api/templates/items.html b/pycsw/ogc/api/templates/items.html index a7b916781..fa9efe2c6 100644 --- a/pycsw/ogc/api/templates/items.html +++ b/pycsw/ogc/api/templates/items.html @@ -211,14 +211,16 @@ function facet(val){ location.href="{{updateurl('facets','facetprop')}}".replace('facetprop',val); } + //if url has a bbox, enable the spatial filter -{% if 'bbox' in attrs.keys() and (attrs['bbox'].split('%2C')|length) == 4 %} -var bbox = [ - [{{ attrs['bbox'].split('%2C')[1] }}, {{ attrs['bbox'].split('%2C')[0] }}], - [{{ attrs['bbox'].split('%2C')[3] }}, {{ attrs['bbox'].split('%2C')[2] }}] - ] -{% else %} -var bbox = null; +var bbox; +{% if 'bbox' in attrs.keys() %} + {% set bbox_tokens = attrs['bbox'].split('%2C') %} + {% if bbox_tokens|length == 4 %} + bbox = [[{{ + bbox_tokens[1] }}, {{ bbox_tokens[0] }}], [{{ + bbox_tokens[3] }}, {{ bbox_tokens[2] }}]]; + {% endif %} {% endif %} //if filter enabled, apply the spatial filter