如何检测Google StreetView是否在地址/坐标中可用 [英] How to detect if Google StreetView is available in an address/coordinates
问题描述
我正在制作一款使用Google街景图API的应用程序
根据地址/坐标获取街景图的图像没有问题
但是 - 我想要检测特定地址是否有可用的街景图像(为了显示不具有此功能的地址的不同行为)
到目前为止,唯一的想法是读取返回图像的像素,并检测这是否是当我没有图像时获得的图像。
其他想法?
谢谢!
如果有街景全景图,那么必须有街景图。
您可以参考google的参考资料:
https://developers.google.com/maps/documentation/javascript/reference#StreetViewService
或者参考StreetViewService的示例:
https://google-developers.appspot.com/maps/documentation/javascript/examples/streetview-service
I'm making an app that uses the Google Street View Image API
I have no problem getting an image of the street view based on the address/coordinates
but - I want to detect if the specific address has a Street View image available (in order to show a different behavior for addresses that doesn't have it)
The only idea I got so far is to read the pixels of the returned image and detect whether this is the image the I got when there is no image available
Any other idea?
Thanks!
Using google.maps.StreetViewService.getPanoramaByLocation( latlng, radius, callback()), you can check whether there is a streetview panorama. If there is a streetview panorama, then there must be an image of streetview.
You can refer the reference of google : https://developers.google.com/maps/documentation/javascript/reference#StreetViewService
Or refer to the example of StreetViewService : https://google-developers.appspot.com/maps/documentation/javascript/examples/streetview-service
这篇关于如何检测Google StreetView是否在地址/坐标中可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!