Service

StreetViewService

google.maps.StreetViewService

StreetViewService 对象可搜索街景数据。

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

StreetViewService
StreetViewService()
参数:无
创建 StreetViewService,用于提供存储在街景服务中的数据的接口。
getPanorama
getPanorama(request[, callback])
参数
用于检索与所提供的街景查询请求相匹配的全景图片所对应的 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
指定要搜索的全景图片来源。这样一来,便可仅搜索室外全景图片。

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
全景图的 latlng。
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 使用街景的默认来源,搜索不会局限于特定的来源。
OUTDOOR 将街景搜索限制为户外集合。室内照片集不会显示在搜索结果中。另请注意,搜索只能确定有可能是在室内还是室外的全景图像。例如,不会返回 PhotoSphere,因为它并不知道在室内还是室外。

StreetViewPanoramaData 接口

google.maps.StreetViewPanoramaData接口

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

tiles
指定此全景图的自定义图块。
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 在某会话持续期间保持固定不变,但在各会话之间会改变。