googlemaps / googlemaps/google-maps-services-python
Static maps style only accepts a dict instead of a list of dict
- 主要語言
- Python
- 星號
- 5k
- 分支
- 1.4k
- PR 合併指標
- 30 天內沒有已合併 PR
描述
I am trying to create a static map with different styles. I would like to turn some poi features off and others on. However, the current approach only accepts a dict and only renders one feature set.
In here (https://github.com/googlemaps/google-maps-services-python/blob/master/googlemaps/maps.py), style is supposed to accept list of dict. However, convert (https://github.com/googlemaps/google-maps-services-python/blob/master/googlemaps/convert.py#L208) only accepts a dict.
---
#### Steps to reproduce
#### Code example
```python
for chunk in gmaps.static_map(
size=(1024, 1024),
center=base_address_location,
style=[
{
"feature": "poi.business",
"visibility": "off",
},
{
"feature": "poi.schools",
"visibility": "off",
},
{
"feature": "poi.restaurants",
"visibility": "on",
},
],
zoom=15,
format="png",
markers=marker,
maptype="roadmap",
):
if chunk:
f.write(chunk)
f.close()
```
#### Stack trace
```
raise TypeError(
TypeError: Expected a dict for components, but got list
```
貢獻指南
研究方向
從 googlemaps/maps.py 和 googlemaps/convert.py 的第 208 行附近開始,接著使用多個樣式字典重現提供的 static_map 呼叫。確認樣式輸入會被接受,且產生的請求保留所有列出的圖徵規則。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- api
- Issue 類型
- 缺陷
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100