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

photos[0].getUrl() is broken and can't get photos[0].photo_reference #18

Closed
joaomarceloods opened this issue Dec 24, 2015 · 1 comment
Closed

Comments

@joaomarceloods
Copy link

According to Google's documentation, the array photos in the results contains the attributes height, width, html_attributions, and photo_reference. See here: https://developers.google.com/places/web-service/search#PlaceSearchResponses

But with angularjs-google-places there is only height, width and getUrl(). When I call getUrl() something breaks in Places API's javascript and I get this error:

TypeError: Cannot read property 'maxWidth' of undefined
    at AN (http://maps.google.com/maps-api-v3/api/js/23/3/intl/pt_br/util.js:212:133)

If I could get photo_reference I could build the URL by myself, but it's not present as I just said.

Is there an workaround?

@joaomarceloods
Copy link
Author

Got getUrl() to work like this:

place.photos[0].getUrl({
    maxWidth: 640
});

Of course, if you want photos you need to include it in nearbySearchKeys filter:

app.config(function (ngGPlacesAPIProvider) {
    ngGPlacesAPIProvider.setDefaults({
        types: [],
        nearbySearchKeys: ['photos', 'place_id', 'name', 'geometry', etc, etc...]
    });
});

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

1 participant