English中文

OpenCageGeocoderService

new Cesium.OpenCageGeocoderService(url, apiKey, params)

通过提供地理编码 Provides geocoding via a OpenCage server.
名称 Name 类型 Type 说明 Description
url Resource | string OpenCage 服务器的端点。 The endpoint to the OpenCage server.
apiKey string OpenCage API 密钥。 The OpenCage API Key.
params object 可选 optional 具有以下属性的对象(请参阅 https://opencagedata.com/api#forward-opt): An object with the following properties (See https://opencagedata.com/api#forward-opt):
名称 Name 类型 Type 说明 Description
abbrv number 可选 optional 当设置为 1 时,我们尝试缩写并缩短返回的格式化字符串。 When set to 1 we attempt to abbreviate and shorten the formatted string we return.
options.add_request number 可选 optional 当设置为 1 时,各种请求参数将添加到响应中以便于调试。 When set to 1 the various request parameters are added to the response for ease of debugging.
options.bounds string 可选 optional 为地理编码器提供查询所在区域的提示。 Provides the geocoder with a hint to the region that the query resides in.
options.countrycode string 可选 optional 将结果限制为指定的一个或多个国家(由 ISO 3166-1 Alpha 2 标准定义)。 Restricts the results to the specified country or countries (as defined by the ISO 3166-1 Alpha 2 standard).
options.jsonp string 可选 optional 用函数名称包装返回的 JSON。 Wraps the returned JSON with a function name.
options.language string 可选 optional IETF 格式的语言代码。 An IETF format language code.
options.limit number 可选 optional 我们应该返回的最大结果数。 The maximum number of results we should return.
options.min_confidence number 可选 optional 1 到 10 之间的整数。仅返回至少具有此置信度的结果。 An integer from 1-10. Only results with at least this confidence will be returned.
options.no_annotations number 可选 optional 设置为 1 时,结果将不包含注释。 When set to 1 results will not contain annotations.
options.no_dedupe number 可选 optional 设置为 1 时,不会对结果进行重复数据删除。 When set to 1 results will not be deduplicated.
options.no_record number 可选 optional 当设置为 1 时,不记录查询内容。 When set to 1 the query contents are not logged.
options.pretty number 可选 optional 当设置为 1 时,结果会“漂亮”地打印以便于阅读。对于调试很有用。 When set to 1 results are 'pretty' printed for easier reading. Useful for debugging.
options.proximity string 可选 optional 向地理编码器提供提示,使结果偏向于更接近指定位置的结果(例如:41.40139,2.12870)。 Provides the geocoder with a hint to bias results in favour of those closer to the specified location (For example: 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

获取执行地理编码后要显示的信用。通常,这用于记入地理编码器服务。 Gets the credit to display after a geocode is performed. Typically this is used to credit the geocoder service.
传递给 OpenCage 的可选参数以自定义地理编码 Optional params passed to OpenCage in order to customize geocoding
用于访问 OpenCage 端点的资源。 The Resource used to access the OpenCage endpoint.

方法 Methods

名称 Name 类型 Type 说明 Description
query string 要发送到地理编码器服务的查询 The query to be sent to the geocoder service
返回: Returns:
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.