Reputation: 1760
I'm trying to get place details using place_id without having a map canvas. It appears that making a "http.get" call to the api itself wont work, but instead forced to use the angular google maps implementation.
currently stack on:
let service = new google.maps.places.PlacesService(map);
Upvotes: 1
Views: 991
Reputation: 1760
Finally managed to find the answer by looking at jquery examples. Turned out to be a pretty simple process by using a dummy dom div
document.createElement('div')
let service = new google.maps.places.PlacesService(document.createElement('div'));
service.getDetails({ placeId: placeId}, function(place, status){
console.log(JSON.stringify(place));
});
For example to get photos associated with place just loop of over the "photos" object array by using the getUrl method, see below (use your desired size):
place.photos[1].getUrl({'maxWidth': 100, 'maxHeight': 100})
Other available properties here https://developers.google.com/maps/documentation/javascript/places
Upvotes: 1