I am working towards gathering a selection of locations that meet specific criteria by making a "routeRequest" and storing them. To achieve this, I aim to utilize Google Places to search for locations around the central point of my map.
let map = new google.maps.Map(document.querySelector("#myMap"), {
center: { lat: 41.148481, lng: -8.606893 },
zoom: 15
});
let service = new google.maps.places.PlacesService(map);
service.nearbySearch(routeRequest, callback);
let routeRequest = {
location: map.center,
radius: '1000',
type: [this.typeRoute]
};
function callback(results, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
for (const result of results) {
this.listLocations.push(result);
}
}
}
However, there seems to be an issue as placesService is unable to recognize the map.