Provides geocoding via a OpenCage server.
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
url |
Resource | string | OpenCage服务器的终点. | ||||||
apiKey |
string | The OpenCage API Key. | ||||||
params |
object |
optional
具有下列属性的天体(见 https://opencagedata.com/api#forward-opt ):
|
||||||
options.add_request |
number | optional 当设置为1时,在响应中添加各种请求参数,以便于调试. | ||||||
options.bounds |
string | optional 向地理编码器提示查询所在区域. | ||||||
options.countrycode |
string | optional 将结果限制在指定的国家(按照 NT 0 3166-1 Alpha 2标准的定义). | ||||||
options.jsonp |
string | optional 用函数名将返回的 NT% 0 围起来. | ||||||
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
Methods
geocode(query) → Promise.<Array.<GeocoderService.Result>>
| Name | Type | Description |
|---|---|---|
query |
string | 要发送到地理编码器服务的查询 |