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

Offen
#514 2 Kommentare 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
45/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Veraltet
Tech-Stack
python
Bereich
api

Rechercherichtung

Beginne in googlemaps/maps.py und googlemaps/convert.py um Zeile 208 herum und reproduziere anschließend den bereitgestellten static_map-Aufruf mit mehreren Style-Dictionaries. Bestätige, dass die Style-Eingabe akzeptiert wird und dass die resultierende Anfrage alle aufgeführten Feature-Regeln beibehält.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

triage me type: bug

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
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
Vorherrschende Sprache
Python
Sterne
5k
Forks
1.4k
Ø Merge
5 Std. 9 Min.
Gemergte PRs (30 T.)
1

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus googlemaps/google-maps-services-python

Alle Issues in googlemaps/google-maps-services-python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.