通过 OpenCage 服务器提供地理编码服务。
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
url |
Resource | string | OpenCage 服务器的端点。 | ||||||
apiKey |
string | OpenCage API 密钥。 | ||||||
params |
object |
optional
包含以下属性的对象(参见 https://opencagedata.com/api#forward-opt):
|
||||||
options.add_request |
number | optional 设置为 1 时,各种请求参数将添加到响应中,以方便调试。 | ||||||
options.bounds |
string | optional 为地理编码器提供关于查询所在区域的提示。 | ||||||
options.countrycode |
string | optional 限制结果为指定国家或国家(按照 ISO 3166-1 Alpha 2 标准定义)。 | ||||||
options.jsonp |
string | optional 用函数名称包装返回的 JSON。 | ||||||
options.language |
string | optional IETF 格式的语言代码。 | ||||||
options.limit |
number | optional 我们应该返回的最大结果数量。 | ||||||
options.min_confidence |
number | optional 介于 1 到 10 之间的整数。仅返回至少具有此置信度的结果。 | ||||||
options.no_annotations |
number | optional 设置为 1 时,结果将不包含注释。 | ||||||
options.no_dedupe |
number | optional 设置为 1 时,结果将不会去重。 | ||||||
options.no_record |
number | optional 设置为 1 时,查询内容不会被记录。 | ||||||
options.pretty |
number | optional 设置为 1 时,结果将“美化”打印以便于阅读。对于调试非常有用。 | ||||||
options.proximity |
string | optional 为地理编码器提供关于偏向更接近指定位置的结果的提示(例如:41.40139,2.12870)。 |
Example:
// Configure a Viewer to use the OpenCage Geocoder
const viewer = new Cesium.Viewer('cesiumContainer', {
geocoder: new Cesium.OpenCageGeocoderService('https://api.opencagedata.com/geocode/v1/', '<API key>')
});
Members
readonly credit : Credit|undefined
获取在执行地理编码后显示的信用信息。通常用于给予地理编码服务以信用。
传递给 OpenCage 的可选参数,用于自定义地理编码。
readonly url : Resource
用于访问 OpenCage 端点的资源。
Methods
geocode(query) → Promise.<Array.<GeocoderService.Result>>
| Name | Type | Description |
|---|---|---|
query |
string | 要发送到地理编码服务的查询。 |
