StreetViewService class
google.maps.StreetViewService
class
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 interface
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 | 將街景服務搜尋範圍限制在室外集錦。搜尋結果不會顯示室內收藏內容。另請注意,搜尋結果只會傳回可判斷是否為室內或室外的全景。舉例來說,系統不會傳回全景相片,因為無法判斷相片是在室內還是室外拍攝。 | 
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 在單一工作階段內是穩定的,但是如果橫跨多個工作階段就會不穩定。 |