Skip to content

KBE3D / KBCore / Cesium / OpenCageGeocoderService

类: OpenCageGeocoderService

Provides geocoding via a OpenCage

server.

示例

ts
// 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>')
});

参数

The endpoint to the OpenCage server.

参数

The OpenCage API Key.

参数

An object with the following properties (See https://opencagedata.com/api#forward-opt

):

参数

When set to 1 we attempt to abbreviate and shorten the formatted string we return.

参数

When set to 1 the various request parameters are added to the response for ease of debugging.

参数

Provides the geocoder with a hint to the region that the query resides in.

参数

Restricts the results to the specified country or countries (as defined by the ISO 3166-1 Alpha 2 standard).

参数

Wraps the returned JSON with a function name.

参数

An IETF format language code.

参数

The maximum number of results we should return.

参数

An integer from 1-10. Only results with at least this confidence will be returned.

参数

When set to 1 results will not contain annotations.

参数

When set to 1 results will not be deduplicated.

参数

When set to 1 the query contents are not logged.

参数

When set to 1 results are 'pretty' printed for easier reading. Useful for debugging.

参数

Provides the geocoder with a hint to bias results in favour of those closer to the specified location (For example: 41.40139,2.12870).

属性

url

readonly url: Resource

The Resource used to access the OpenCage endpoint.


params

readonly params: any

Optional params passed to OpenCage in order to customize geocoding


credit

readonly credit: Credit | undefined

Gets the credit to display after a geocode is performed. Typically this is used to credit the geocoder service.

方法

geocode()

geocode(query: string): Promise<Result[]>

参数

query

string

The query to be sent to the geocoder service

返回

Promise<Result[]>

构造函数

构造函数

new OpenCageGeocoderService(url: string | Resource, apiKey: string, params?: { abbrv?: number; }): OpenCageGeocoderService

参数

url

string | Resource

apiKey

string

params?
abbrv?

number

返回

OpenCageGeocoderService

KBE3D @3.0.0 Copyright © 2024-present KBE3D