javascript - 使用 js 和 google maps api v3(地点库)解析地点照片

标签 javascript google-maps google-maps-api-3

我正在开发一个可以显示几个地方的照片的网站。我得到这样的照片:

var photos = typeof place.photos !== 'undefined' ? place.photos[0].getUrl({ 'maxWidth': 100, 'maxHeight': 125 }) : '';
if (photos.length) {//...//}

不幸的是,当我想显示照片时,它们的清晰度很差:

enter image description here

注意:我用 w3schools slideshows 显示照片然后我这样设置照片:

var images = document.getElementById("PhotoFond").getElementsByTagName("img");
for (i=0; i<images.length; i++;) {

    if (!photosSlide[i]) {return;}
    images[n - 1].src = photosSlide[i];

}

但是,当我转到谷歌地图并找到相同的照片 ( link to the same photo ) 时,质量更好。

enter image description here

我怎样才能有相同的分辨率?

最佳答案

docs

photos[]: an array of PlacePhoto objects. A PlacePhoto can be used to obtain a photo with the getUrl() method, or you can inspect the object for the following values:

height: the maximum height of the image, in pixels.

width: the maximum width of the image, in pixels.

html_attributions: Attribution text to be displayed with this place photo.

.getUrl({ 'maxWidth': 1000, 'maxHeight': 1250 }) // Just set higher resolution, no?

google-place-api-placedetails-photo-reference

关于javascript - 使用 js 和 google maps api v3(地点库)解析地点照片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45374079/

相关文章:

css - 当我尝试将 Google map 集成到现有网页时,标记没有出现

google-maps - 低分辨率 KML GroundOverlay

javascript - node.js 中的相对路径问题

javascript - 如何获取除HTML之外的整个文档的文本内容?

android - 带有 CollapsingToolbar 和 NestedScrollView 的谷歌地图

javascript - 无法查看标题/信息窗口

javascript - 未捕获的类型错误 : Cannot read property 'latitude' of undefined

javascript - Node.js 进程内存不足

javascript - 瓷砖重叠有什么好处?

javascript - 谷歌地图 : How to add HTML elements to specific coordinates?