OpenCageGeocoderService

new Cesium.OpenCageGeocoderService(url, apiKey, params)

Provides geocoding via a OpenCage server.
Name Type Description
url Resource | String The endpoint to the OpenCage server.
apiKey String The OpenCage API Key.
params Object optional An object with the following properties (See https://opencagedata.com/api#forward-opt):
Name Type Description
abbrv Number optional When set to 1 we attempt to abbreviate and shorten the formatted string we return.
options.add_request Number optional 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 Restricts the results to the specified country or countries (as defined by the ISO 3166-1 Alpha 2 standard).
options.jsonp String optional Wraps the returned JSON with a function name.
options.language String optional An IETF format language code.
options.limit Number optional The maximum number of results we should return.
options.min_confidence Number optional An integer from 1-10. Only results with at least this confidence will be returned.
options.no_annotations Number optional When set to 1 results will not contain annotations.
options.no_dedupe Number optional When set to 1 results will not be deduplicated.
options.no_record Number optional When set to 1 the query contents are not logged.
options.pretty Number optional When set to 1 results are 'pretty' printed for easier reading. Useful for debugging.
options.proximity String optional 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

Optional params passed to OpenCage in order to customize geocoding
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.