允許搜尋方向、地理編碼、海拔高度取樣,以及建立靜態地圖圖片。
屬性
屬性 | 類型 | 說明 |
---|---|---|
DirectionFinder | DirectionFinderEnums | |
StaticMap | StaticMapEnums |
方法
方法 | 傳回類型 | 簡短說明 |
---|---|---|
decodePolyline(polyline) | Number[] | 將編碼後的折線字串解碼回點的陣列中。 |
encodePolyline(points) | String | 將點的陣列編碼為字串。 |
newDirectionFinder() | DirectionFinder | 建立新的 DirectionFinder 物件。 |
newElevationSampler() | ElevationSampler | 建立 ElevationSampler 物件。 |
newGeocoder() | Geocoder | 建立新的地理編碼器物件。 |
newStaticMap() | StaticMap | 建立新的 StaticMap 物件。 |
setAuthentication(clientId, signingKey) | void | 支援使用外部建立的 Google Maps API 付費方案帳戶,以便運用額外的配額用途。 |
內容詳盡的說明文件
decodePolyline(polyline)
將編碼後的折線字串解碼回點的陣列。
// Decodes a string representation of the latitudes and longitudes of Minneapolis and Milwaukee // respectively. var polyline = 'qvkpG`qhxPbgyI_zq_@'; var points = Maps.decodePolyline(polyline); for (var i = 0; i < points.length; i+= 2) { Logger.log('%s, %s', points[i], points[i+1]); }
參數
名稱 | 類型 | 說明 |
---|---|---|
polyline | String | 要解碼的編碼折線。 |
回攻員
Number[]
— 經緯度組合陣列 (lat0、long0、lat1、long1 ...)。
另請參閱
encodePolyline(points)
將點的陣列編碼為字串。
// The latitudes and longitudes of New York and Boston respectively. var points = [40.77, -73.97, 42.34, -71.04]; var polyline = Maps.encodePolyline(points);
參數
名稱 | 類型 | 說明 |
---|---|---|
points | Number[] | 要編碼的經緯度組合陣列。 |
回攻員
String
:代表這些點的編碼字串。
另請參閱
newDirectionFinder()
newElevationSampler()
newGeocoder()
newStaticMap()
setAuthentication(clientId, signingKey)
支援使用外部建立的 Google Maps API 付費方案帳戶,以便運用額外的配額用途。您可以從 Google 企業支援入口網站取得用戶端 ID 和簽署金鑰。將這些值設為 null
,即可改回使用預設的配額配額。
Maps.setAuthentication('gme-123456789', 'VhSEZvOXVSdnlxTnpJcUE');
參數
名稱 | 類型 | 說明 |
---|---|---|
clientId | String | 用戶端 ID。 |
signingKey | String | 私密簽署金鑰。 |