googlemaps / googlemaps/google-maps-services-python

Static maps style only accepts a dict instead of a list of dict

未关闭
#514 2 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看
triage me type: bug
主要语言
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
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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