可用于查找路线、进行地理编码、海拔采样以及创建静态地图图像。
属性
媒体资源 | 类型 | 说明 |
---|---|---|
DirectionFinder | DirectionFinderEnums | |
StaticMap | StaticMapEnums |
方法
方法 | 返回类型 | 简介 |
---|---|---|
decodePolyline(polyline) | Number[] | 将编码多段线字符串解码回点数组。 |
encodePolyline(points) | String | 将点数组编码为字符串。 |
newDirectionFinder() | DirectionFinder | 创建一个新的 DirectionFinder 对象。 |
newElevationSampler() | ElevationSampler | 用于创建 ElevationSampler 对象。 |
newGeocoder() | Geocoder | 用于创建一个新的 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 Enterprise 支持门户获取客户端 ID 和签名密钥。将这些值设置为 null
可恢复为使用默认配额限额。
Maps.setAuthentication('gme-123456789', 'VhSEZvOXVSdnlxTnpJcUE');
参数
名称 | 类型 | 说明 |
---|---|---|
clientId | String | 客户端标识符。 |
signingKey | String | 私钥。 |