forgive me for not knowing where to ask this. I don't know how to use stack overflow.
I am able to get a place id returned when a user clicks on something in the map. With this id I would like to get the place details. From what I can gather I am getting pretty close with the code below. Despite trying different variations of the code, I keep getting: places_impl.js:38 Uncaught TypeError: this.b.getElementsByTagName is not a function
var request = {
placeId: "ChIJN1t_tDeuEmsRUsoyG83frY4"
}
google.maps.places.PlacesService(this._map).getDetails(request, callback)
function callback(place, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
console.log(place)
}
}
It seems this question is related directly to Google Maps JavaScript API. Please ask on StackOverflow instead like this:
https://stackoverflow.com/search?q=Google+Maps+JavaScript+API
Thanks!
I figured it out on my own, could be useful for someone else who wants to get a place by it's id.
if (this._map) {
var service = new google.maps.places.PlacesService(
this._map.context.__SECRET_MAP_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
);
service.getDetails(
{
placeId: "ChIJN1t_tDeuEmsRUsoyG83frY4"
},
function(place, status) {
if (status === google.maps.places.PlacesServiceStatus.OK) {
console.log(place);
}
}
);
}
Most helpful comment
I figured it out on my own, could be useful for someone else who wants to get a place by it's id.