私はこのガイドに従う https://developers.google.com/maps/documentation/javascript/places#places_photos 私はマーカーアイコンとして場所の写真を作成する。これは私のマップ初期化コードです:場所APIを - マーカーアイコンとして場所の写真を取得
var map;
function initMap() {
// Create a map centered in Pyrmont, Sydney (Australia).
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -6.920812, lng: 107.604116},
zoom: 13
});
var request = {
location: map.getCenter(),
radius: '5000',
type: ['shopping_mall']
};
var service = new google.maps.places.PlacesService(map);
service.textSearch(request, callback);
}
// Checks that the PlacesServiceStatus is OK, and adds a marker
// using the place ID and location from the PlacesService.
function callback(results, status) {
console.log(results);
if (status == google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
var place = results[i];
createPhotoMarker(place);
}
}
}
google.maps.event.addDomListener(window, 'load', initMap);
これは場所の写真が利用できない場合、関数は、定期的なマーカーを作成しますcreatePhotoMarker機能
function createPhotoMarker(place) {
var photos = place.photos;
if (!photos) {
var marker = new google.maps.Marker({
map: map,
position: place.geometry.location,
title: place.name
});
return;
}
var marker = new google.maps.Marker({
map: map,
position: place.geometry.location,
title: place.name,
icon: photos[0].getUrl({'maxWidth': 35, 'maxHeight': 35})
});
}
です。しかし、利用できる写真のある場所のために、私はこのエラーを取得する:
は、リソースの読み込みに失敗しました:サーバーは、404の状態(と答え) lh3.googleusercontent.com/w35-h35-p/AF1QipOIL6GVVmtqp_cw_hBEQxdILZSa8poMO0HAqFHd=k
地図には通常のマーカのみが表示されます。 どうしたのですか?
これはフィドルhttp://jsfiddle.net/v90fmrhp/
==========アップデート2017年7月7日============答えと修正のための
おかげで
問題が解決したようです。私のフィドルは修正
グッドニュースとしてマーク https://issuetracker.google.com/issues/63298126
を働いています!この問題は修正されました。お待ち頂きまして、ありがとうございます。
ハッピーマッピング!
FWIW、私は現在全く同じ問題が発生しています。 Googleの終了時に一時的な問題になる可能性があります。 – deceze