Skip to content

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

Description

@raj-abodey

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions