Google街景API参数改变范围

Google street view API parameters to change range

Google街景API

URL: https://maps.googleapis.com/maps/api/streetview?size=600x600&location=46.2277933992467,9.04836208165778&key=myapikey

结果:"sorry we have no imagery here"

我正在寻找一个特定的参数来改变这个 "range"。

示例:"no imagery here" 范围是 10 米 ---> 我需要 50 米,所以我会得到一个图像。

请帮帮我

谢谢

目前,您无法使用 Google 地图街景 API 或元数据在“范围”中找到现有全景图。 Google 问题跟踪器中有一个功能请求,要求在这些 API 中添加半径参数:

https://issuetracker.google.com/issues/35830450

请随时为该功能请求加注星标以表达您的兴趣。

解决方法可能是使用 Google 地图 JavaScript API 搜索全景 ID,如以下答案所示:

更新

好消息。 Google 实现了功能请求 35830450 并在街景图像中添加了 radius 参数 API。

radius (default is 50) sets a radius, specified in meters, in which to search for a panorama, centered on the given latitude and longitude. Valid values are non-negative integers.

来源:https://developers.google.com/maps/documentation/streetview/intro

对于您的示例,我发现将半径设置为 60 米将 return 全景。

元数据请求https://maps.googleapis.com/maps/api/streetview/metadata?location=46.2277933992467%2C9.04836208165778&radius=60&key=MY_API_KEYreturns

{
    "copyright":"© Google, Inc.",
    "date":"2014-11",
    "location":{
        "lat":46.22730779489779,
        "lng":9.048190155237283
    },
    "pano_id":"xB0bwJka4pfLk6hLri-t_w",
    "status":"OK"
}

查看代码片段

<img src="https://maps.googleapis.com/maps/api/streetview?location=46.2277933992467%2C9.04836208165778&size=600x400&radius=60&key=AIzaSyDztlrk_3CnzGHo7CFvLFqE_2bUKEq1JEU&signature=s7tfGqXSJ3csbFmE91-AXMieFfg=">