【发布时间】:2018-07-27 14:52:35
【问题描述】:
我使用 Angular 5 从 Google Place 检索照片 URL,如下所示:
...
var request = {
location: new google.maps.LatLng(this.mylat,this.mylng),
radius: 100,
type: this.searchtype
};
let places = new google.maps.places.PlacesService(this.mymap);
places.nearbySearch(request, (results, status) => {
if (status == google.maps.places.PlacesServiceStatus.OK) {
results.forEach((place, index) => {
var img_url = place.photos[0].getUrl({"maxWidth": 200, "maxHeight": 200}); // This URL works only for a few days..
});
}
})
...
此 URL 存储在我的 Firestore 数据库中以供以后使用。
问题: 谷歌地图提供了一个临时网址(仅在几天内有效)。 此 URL 重定向到“真实”(永久)URL。
示例:
真实/永久(重定向到)网址:https://lh3.googleusercontent.com/p/AF1QipO4Xz37yaVeLaLL8ndNQKR93b5qvClsSis11koi=s1600-w200-h200
我怎样才能得到这个真实的 URL 而不是临时的?
【问题讨论】:
标签: angular google-maps google-maps-api-3 google-places-api