Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
raj-abodey opened this issue Feb 15, 2024 · 1 comment
Open

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

raj-abodey opened this issue Feb 15, 2024 · 1 comment
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@raj-abodey
Copy link

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
@raj-abodey raj-abodey added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Feb 15, 2024
@wangela
Copy link
Member

wangela commented Feb 15, 2024

If you would like to upvote the priority of this issue, please comment below or react on the original post above with 👍 so we can see what is popular when we triage.

@raj-abodey Thank you for opening this issue. 🙏
Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants