OpenCageGeocoderService

new Cesium.OpenCageGeocoderService(url, apiKey, params)

通过 OpenCage 服务器提供地理编码服务。
Name Type Description
url Resource | string 指向 OpenCage 服务器的端点。
apiKey string OpenCage API 密钥。
params object optional 包含以下属性的对象(参见 https://opencagedata.com/api#forward-opt):
Name Type Description
abbrv number optional 设置为1时,尝试缩写和缩短返回的格式化字符串。
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:
// 配置 Viewer 使用 OpenCage 地理编码器
const viewer = new Cesium.Viewer('cesiumContainer', {
  geocoder: new Cesium.OpenCageGeocoderService('https://api.opencagedata.com/geocode/v1/', '<API key>')
});

Members

获取执行地理编码后要显示的版权信息。通常用于注明地理编码服务的来源。
传递给 OpenCage 的可选参数,用于自定义地理编码。
用于访问 OpenCage 端点的资源。

Methods

Name Type Description
query string 要发送到地理编码服务的查询。
Returns:
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.