get_collection_map does not parse the transparent query parameter

未关闭
#2,444 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@tomkralidis 已经在做这个了。

开始于 2026年10月18日。

  • #2445 来自 @ozenyunus35 —— 已关闭,未合并

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
api

调研方向

The string transparent is copied into query_args without conversion in pygeoapi/api/maps.py near line 135, and MapScriptProvider in pygeoapi/provider/mapscript_.py around lines 185-188 tests it as a truthy value. Read both, then check how the other parsed parameters are converted. Done means the API passes a real bool and the provider's check works for 'false'. Pull request #2445 is already open against this issue, so review or coordinate with it before writing a new patch.

由索引模型根据 Issue 内容生成。

描述

bug OGC API - Maps

When handling an OGC API Maps request, pygeoapi does not parse the transparent query parameter into a bool, as seen in:

https://github.com/geopython/pygeoapi/blob/990e5f72ec938b3ad7aca5e493dda736806ebd6a/pygeoapi/api/maps.py#L135

As seen above, if request.params['transparent'] exists, then it is stored as is in query_args['transparent'] - i.e. as a string.

This means that map providers are left to parse this parameter, unlike all other parameters, which are parsed by pygeoapi before calling the map provider.

This is also causing a bug in the built-in MapScriptProvider. This provider does not parse the transparent parameter either. It simply tries to use it, as seen in:

https://github.com/geopython/pygeoapi/blob/990e5f72ec938b3ad7aca5e493dda736806ebd6a/pygeoapi/provider/mapscript_.py#L185-L188

In the above snippet, as explained before, it is possible that transparent is a string. When that is the case, the above if check will not work as intended (because in Python all strings are truthy, i.e. if "false" evaluates to True).

主要语言
Python
星标
630
派生
340
平均合并
3 天 17 小时
30 天内合并 PR
15

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

geopython/pygeoapi 的其他 Issue

查看 geopython/pygeoapi 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。