Service

StreetViewService

google.maps.StreetViewService

StreetViewService 对象用于搜索街景数据。

通过调用 const {StreetViewService} = await google.maps.importLibrary("streetView") 进行访问。
请参阅 Maps JavaScript API 中的库

StreetViewService
StreetViewService()
参数:无
创建 StreetViewService,该对象提供了一个连接街景服务内所存储数据的接口。
getPanorama
getPanorama(request[, callback])
参数: 
返回值:  Promise<StreetViewResponse>
检索与提供的街景查询请求相匹配的全景图片的 StreetViewPanoramaDataStreetViewPanoramaData 会传递给所提供的回调。

StreetViewStatus 常量

google.maps.StreetViewStatus 常量

StreetViewService 在完成街景请求时返回的状态。这些值可以通过值或使用常量的名称来指定。例如 'OK'google.maps.StreetViewStatus.OK

通过调用 const {StreetViewStatus} = await google.maps.importLibrary("streetView") 进行访问。
请参阅 Maps JavaScript API 中的库

OK 请求已成功。
UNKNOWN_ERROR 无法成功处理请求,但确切的失败原因是未知的。
ZERO_RESULTS 找不到符合搜索条件的全景照片。

StreetViewLocationRequest 接口

google.maps.StreetViewLocationRequest 接口

要随 getPanorama 一起发送的街景请求。借助 StreetViewLocationRequest,您可以搜索指定位置的街景全景图片。

location optional
类型:  LatLng|LatLngLiteral optional
指定要搜索街景全景图片的位置。
preference optional
类型:  StreetViewPreference optional
用于设置偏好设置,确定应在半径范围内查找怎样的全景图片:离指定位置最近的全景图片,还是半径范围内最好的全景图片。
radius optional
类型:  number optional
默认值50
设置以米为单位的半径,以指定要在多大半径范围内搜索全景图片。
source optional
类型:  StreetViewSource optional
指定要搜索的全景图片的来源。这样,您就可以设置限制,例如仅搜索室外全景图片。
sources optional
类型:  Iterable<StreetViewSource> optional
指定要搜索的全景图片的来源。这样一来,您就可以设置限制,例如仅搜索室外全景图片。设置多个来源时,系统会将这些来源视为交集。

StreetViewPanoRequest 接口

google.maps.StreetViewPanoRequest 接口

StreetViewPanoRequestgetPanorama 搭配使用,可查找具有指定 ID 的全景图片。

pano optional
类型:  string optional
指定要搜索的全景图片 ID。

StreetViewResponse 接口

google.maps.StreetViewResponse 接口

针对 StreetViewService.getPanorama 中的 Promise 解析的响应。

data
全景的表示形式。

StreetViewLocation 接口

google.maps.StreetViewLocation 接口

街景视图全景图中某个位置的表示。

pano
类型:  string
全景图的唯一标识符。该项在一个会话持续期间内会保持不变,但在各会话之间会有所改变。
description optional
类型:  string optional
描述位置的本地化字符串。
latLng optional
类型:  LatLng optional
全景图的纬度/经度。
shortDescription optional
类型:  string optional
位置的简短说明。

StreetViewPreference 常量

google.maps.StreetViewPreference 常量

用于使搜索结果倾向于返回离请求位置最近的街景全景图片,或被认为最有可能满足用户需求的全景图片。您可以通过值或使用常量的名称来指定这些参数。例如,'best'google.maps.StreetViewPreference.BEST

通过调用 const {StreetViewPreference} = await google.maps.importLibrary("streetView") 进行访问。
请参阅 Maps JavaScript API 中的库

BEST 返回最有可能符合用户需求的街景全景图片。最佳结果由算法根据用户研究和参数(例如识别出的兴趣点、图片质量以及与指定位置的距离)来确定。
NEAREST 返回距离所提供位置最近的街景全景图片。此功能仅在有限的半径范围内有效。建议半径不超过 1 公里。

StreetViewSource 常量

google.maps.StreetViewSource 常量

用于将街景搜索限制为所选来源的标识符。这些值以字符串形式指定。例如 'outdoor'

通过调用 const {StreetViewSource} = await google.maps.importLibrary("streetView") 进行访问。
请参阅 Maps JavaScript API 中的库

DEFAULT 使用默认街景来源,搜索范围不限于特定来源。
GOOGLE 将街景搜索范围限制为 Google 官方全景图片。
OUTDOOR 将街景搜索范围限制为室外全景图片。室内拍摄的合集不会显示在搜索结果中。另请注意,搜索结果仅返回可以确定是室内还是室外的全景图片。例如,系统不会返回全景照片,因为无法确定它们是在室内还是室外拍摄的。

StreetViewPanoramaData 接口

google.maps.StreetViewPanoramaData 接口

使用 registerPanoProvider 定义的提供程序返回的全景图片表示形式。

tiles
类型:  StreetViewTileData
指定此全景图的自定义图块。
copyright optional
类型:  string optional
指定此全景图的版权文本。
imageDate optional
类型:  string optional
指定相应全景照片中影像的拍摄年份和月份。日期字符串的格式为 YYYY-MM。
location optional
类型:  StreetViewLocation optional
指定此全景图的位置元数据。

google.maps.StreetViewLink 接口

相邻街景视图全景图的参考集合。

description optional
类型:  string optional
描述链接的本地化字符串。
heading optional
类型:  number optional
链接的标题。
pano optional
类型:  string optional
全景图的唯一标识符。此 ID 在某会话持续期间保持固定不变,但在各会话之间会改变。