StreetViewService 類別
google.maps.StreetViewService
類別
StreetViewService
物件會為街景服務資料執行搜尋。
呼叫 const {StreetViewService} = await google.maps.importLibrary("streetView")
即可存取。請參閱 Maps JavaScript API 中的程式庫。
建構函式 | |
---|---|
StreetViewService |
StreetViewService() 參數:無
建立 StreetViewService ,為街景服務中儲存的資料提供介面。 |
方法 | |
---|---|
getPanorama |
getPanorama(request[, callback]) 參數:
傳回值:
Promise<StreetViewResponse> 針對與所提供街景服務查詢要求的全景擷取 StreetViewPanoramaData 。StreetViewPanoramaData 會傳遞至提供的回呼。 |
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 設定搜尋全景的半徑 (以公尺為單位)。 |
|
類型:
StreetViewSource optional 指定要搜尋的全景來源。舉例來說,您可以只搜尋室外全景。 |
sources optional |
類型:
Iterable<StreetViewSource> optional 預設值:[
StreetViewSource.DEFAULT ]指定要搜尋的全景來源。舉例來說,您可以只搜尋室外全景。設定多個來源後,系統會將這些來源視為這些來源的交集。 |
StreetViewPanoRequest 介面
google.maps.StreetViewPanoRequest
介面
將 StreetViewPanoRequest
與 getPanorama
搭配使用,可找出具有指定 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
常數
僅限特定來源街景服務搜尋的 ID。這些值會指定為字串。例如 'outdoor'
。
呼叫 const {StreetViewSource} = await google.maps.importLibrary("streetView")
即可存取。請參閱 Maps JavaScript API 中的程式庫。
常數 | |
---|---|
DEFAULT |
使用街景服務的預設來源。搜尋範圍不限於特定來源。 |
GOOGLE |
將街景服務搜尋範圍限制在 Google 官方集錦。 |
OUTDOOR |
將街景服務搜尋範圍限制在室外集錦。室內集錦不會顯示在搜尋結果中。另請注意,搜尋只會傳回能夠判斷拍攝地點為室內或室外的全景。舉例來說,系統無法傳回 PhotoSphere,因為該相片無論是室內還是室外都不明。 |
StreetViewPanoramaData 介面
google.maps.StreetViewPanoramaData
介面
使用 registerPanoProvider
定義的提供者傳回的全景表示法。
屬性 | |
---|---|
tiles |
指定這個位置的自訂方塊。 |
copyright optional |
類型:
string optional 指定這個全景的版權文字。 |
imageDate optional |
類型:
string optional 指出這張全景相片中圖像的取得年份和月份。日期字串的格式為 YYYY-MM。 |
links optional |
類型:
Array<StreetViewLink> optional 指定相鄰全景的導覽連結。 |
location optional |
類型:
StreetViewLocation optional 為這個位置指定位置的中繼資料。 |
StreetViewLink 介面
google.maps.StreetViewLink
介面
一組相鄰「街景服務」全景的參考。
屬性 | |
---|---|
description optional |
類型:
string optional 描述連結的的本地化字串。 |
heading optional |
類型:
number optional 連結的方向。 |
pano optional |
類型:
string optional 全景的唯一識別碼。這個 ID 在單一工作階段內是穩定的,但是如果橫跨多個工作階段就會不穩定。 |