Provides geocoding via a OpenCage server.
参数名称 | 类型 | 描述信息 | ||||||
---|---|---|---|---|---|---|---|---|
url |
Resource | string | The endpoint to the OpenCage server. | ||||||
apiKey |
string | The OpenCage API Key. | ||||||
params |
object |
可选
An object with the following properties (See https://opencagedata.com/api#forward-opt):
|
||||||
options.add_request |
number | 可选 When set to 1 the various request parameters are added to the response for ease of debugging. | ||||||
options.bounds |
string | 可选 Provides the geocoder with a hint to the region that the query resides in. | ||||||
options.countrycode |
string | 可选 Restricts the results to the specified country or countries (as defined by the ISO 3166-1 Alpha 2 standard). | ||||||
options.jsonp |
string | 可选 Wraps the returned JSON with a function name. | ||||||
options.language |
string | 可选 An IETF format language code. | ||||||
options.limit |
number | 可选 The maximum number of results we should return. | ||||||
options.min_confidence |
number | 可选 An integer from 1-10. Only results with at least this confidence will be returned. | ||||||
options.no_annotations |
number | 可选 When set to 1 results will not contain annotations. | ||||||
options.no_dedupe |
number | 可选 When set to 1 results will not be deduplicated. | ||||||
options.no_record |
number | 可选 When set to 1 the query contents are not logged. | ||||||
options.pretty |
number | 可选 When set to 1 results are 'pretty' printed for easier reading. Useful for debugging. | ||||||
options.proximity |
string | 可选 Provides the geocoder with a hint to bias results in favour of those closer to the specified location (For example: 41.40139,2.12870). |
使用示例:
// 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>')
});
成员(属性)
readonly credit : Credit|undefined
Gets the credit to display after a geocode is performed. Typically this is used to credit
the geocoder service.
Optional params passed to OpenCage in order to customize geocoding
readonly url : Resource
The Resource used to access the OpenCage endpoint.
方法
geocode(query) → Promise.<Array.<GeocoderService.Result>>
参数名称 | 类型 | 描述信息 |
---|---|---|
query |
string | The query to be sent to the geocoder service |