Service

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>
擷取與提供的街景服務查詢要求相符的全景 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 介面

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
類型:  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 在單一工作階段內是穩定的,但是如果橫跨多個工作階段就會不穩定。