OpenCageGeocoderService

open external class OpenCageGeocoderService(val url: Resource, apiKey: String, params: JsAny? = definedExternally)(source)

Provides geocoding via a OpenCage server.

// Configure a Viewer to use the OpenCage Geocoder
const viewer = new Viewer('cesiumContainer', {
geocoder: new OpenCageGeocoderService('https://api.opencagedata.com/geocode/v1/', '<API key>')
});

Parameters

apiKey

The OpenCage API Key.

params

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

params.abbrv

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

See also

Constructors

Link copied to clipboard
constructor(url: Resource, apiKey: String, params: JsAny? = definedExternally)
constructor(url: String, apiKey: String, params: JsAny? = definedExternally)

Properties

Link copied to clipboard
external val credit: Credit?

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

Link copied to clipboard
external val params: JsAny

Optional params passed to OpenCage in order to customize geocoding

Link copied to clipboard
external val url: Resource

The endpoint to the OpenCage server.

Functions

Link copied to clipboard
suspend external fun geocode(query: String): ReadonlyArray<GeocoderService.Result>
Link copied to clipboard