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 map - can only generate a single style #86

Closed
rayshan opened this issue Jul 28, 2015 · 1 comment
Closed

Static map - can only generate a single style #86

rayshan opened this issue Jul 28, 2015 · 1 comment

Comments

@rayshan
Copy link

rayshan commented Jul 28, 2015

Hi,

1.0.1

Params with a single style object:

var params = {
    center: '44.9545,-93.3365',
    zoom: 10,
    size: '640x640',
    scale: 2,
    maptype: 'roadmap',
    style: [
        {
            feature: 'all',
            rules: {
                invert_lightness: true,
                hue: '0x57574e'
            }
        }
    ]
}

Correctly generates:

https://maps.googleapis.com/maps/api/staticmap?center=44.9545%2C-93.3365&zoom=10&size=640x640&scale=2&maptype=roadmap&style=feature%3Aall%7Cinvert_lightness%3Atrue%7Chue%3A0x57574e&key=xyz

staticmap

But when there are multiple style objects:

var params = {
    center: '44.9545,-93.3365',
    zoom: 10,
    size: '640x640',
    scale: 2,
    maptype: 'roadmap',
    style: [
        {
            feature: 'all',
            rules: {
                invert_lightness: true,
                hue: '0x57574e'
            }
        },
        {
            feature: 'road.highway',
            rules: {
                visibility: "simplified"
            }
        }
    ]
}

Generated URI is missing &style=: https://maps.googleapis.com/maps/api/staticmap?center=44.9545%2C-93.3365&zoom=10&size=640x640&scale=2&maptype=roadmap&style=feature%3Aall%7Cinvert_lightness%3Atrue%7Chue%3A0x57574e%7Cfeature%3Aroad.highway%7Cvisibility%3Asimplified&key=xyz

staticmap-1

Expected: https://maps.googleapis.com/maps/api/staticmap?center=44.9545%2C-93.3365&zoom=10&size=640x640&scale=2&maptype=roadmap&style=feature%3Aall%7Cinvert_lightness%3Atrue%7Chue%3A0x57574e%7C&style=feature%3Aroad.highway%7Cvisibility%3Asimplified&key=xyz

staticmap-2

The test is also missing &style=: https://github.com/moshen/node-googlemaps/blob/master/test/unit/utils/parseStylesTest.js#L48

@felix
Copy link
Contributor

felix commented Aug 1, 2015

See my pull request #87 for a possible solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants