1
私はGoogle map apiで働いています[ここは私の近くのレストランを見つけることです。 。 。私がこれを実行すると、私は現在の場所だけを取得します。私はレストランのデータに関連する情報を受け取っていません。私の周辺の近くのレストランを見つけるためのGoogle Map API
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
center: { lat: 25.276987, lng: 55.296249 },
zoom: 15
});
var infoWindow = new google.maps.InfoWindow({ map: map });
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var pos = {
lat: position.coords.latitude,
lng: position.coords.longitude
};
infoWindow.setPosition(pos);
infoWindow.setContent('Location found.');
map.setCenter(pos);
var marker = new google.maps.Marker({
map: map,
position: pos.getPlace().location
});
var service = new google.maps.places.PlacesService(map);
service.nearbySearch({
location: rak,
radius: 5500,
type: ['restuarant']
}, callback);
}, function() {
handleLocationError(true, infoWindow, map.getCenter());
});
}
else {
handleLocationError(false, infoWindow, map.getCenter());
}
}
イメージへのリンクではなく、ご質問に実際のコードを投稿してください。 – Roberto
親切にコードを確認する –